This is post is how to run a program from the terminal in the background so that it will continue to run even when the terminal window is closed. I use the nohup command to accomplish this. I have a server that I log into with ssh. I run a rysnc backup command to that copies data to a usb3, 2 GB external hard drive. This can take several hours to complete. Sometimes I need to close my ssh session, for example to reboot my client computer, yet I don’t want the backup to stop. I am running linux, Ubuntu Gnome 15.04 and all commands are run from the terminal.
Example of no hup command
nohup nice -n20 bkup.offsite.cc.com.py > /dev/null 2>&1 &
I will break down what is happening.
nohup – prevents the commands following from stopping if the terminal window is closed
nice -n20 – runs the program bkup.offsite.cc.com.py at a lower priority for cpu resources to prevent other programs on the computer from slowing down
bkup.offsite.cc.com.py – the python backup program to execute
> /dev/null 2>&1 – This does not show error messages and output, nohup normally writes standard output to a file nohup.txt. When my output was written to nohup.txt, the file size was 1.2 GB!
& – puts the command in the background so that you can use the terminal for other tasks
To see the status of your running application run the following command:
Output will be:
+ Running nohup nice -n20 bkup.offsite.cc.com.py &
A good reference for working with jobs: http://linuxcommand.org/lc3_lts0100.php
Click on this link, http://itunes.apple.com/us/app/owncloud/id543672169?ls=1&mt=8, to open the owncloud client in the App Store. Download and instructions are here https://owncloud.com/products/mobileapps/.
Mac Laptop or Desktop running OSX Yosemite
Click on the following link to install the software https://owncloud.com/download#desktop-clients.
Download and instructions here https://owncloud.com/products/desktop-clients/. “Simply copy a file into the directory and the ownCloud desktop client does the rest. Make a change to the files on one computer, it will flow across the others using these desktop sync clients. Always have your latest files with you wherever you are.”
I needed to see what version of mythtv was installed on my Ubuntu 14.04 server and what dependencies it requires. Here is the solution.
.deb packages are stored at /var/cache/apt/archives
View mythtv package name
#ls -l /var/cache/apt/archives/mythtv*
Display Package Version
# apt-show-versions mythtv
mythtv:all/trusty 2:0.27.4+fixes.20150514.6b73976-0ubuntu0mythbuntu4 uptodate
Display Package Information
#dpkg -I mythtv_2%3a0.27.4+fixes.20150514.6b73976-0ubuntu0mythbuntu4_all.deb
new debian package, version 2.0.
size 78060 bytes: control archive=1084 bytes.
1449 bytes, 34 lines control
209 bytes, 3 lines md5sums
Maintainer: MythTV Ubuntu Maintainers <firstname.lastname@example.org>
Depends: mysql-server | mysql-server-5.6, mythtv-database, mythtv-frontend, mythtv-backend, ntp | time-daemon | ntp-simple
Description: Personal video recorder application (client and server)
MythTV implements the following PVR features, and more, with a
unified graphical interface:
- Basic 'live-tv' functionality. Pause/Fast Forward/Rewind "live" TV.
- Video compression using RTjpeg or MPEG-4
- Program listing retrieval using XMLTV
- Themable, semi-transparent on-screen display
- Electronic program guide
- Scheduled recording of TV programs
- Resolution of conflicts between scheduled recordings
- Basic video editing
This package will install a complete MythTV client/server environment on a
single system. If you are intended on using this as your only MythTV machine,
and this machine is already configured as a desktop, this package will get you
up and running switfly.
If you are intended on installing this on a standalone/non-desktop machine,
you should look into the metapackages available:
mythtv-backend-master (backend with a local database)
mythtv-backend (backend needing a remote database)