For medium term jobs (more than 18 hours, but less than 28 days), or any job that you wish to leave running in the background (so you can log out) use longjob.
Simply place the command(s) you want to run within a bash script, then run that script with longjob, e.g
longjob -28day -c ./script_name.sh
You will be asked to enter your DICE password, then the job will run for up to 28 days. Read the longjob manual (man longjob) for more details.
You can check that your longjob process is running with
ps -ef | grep script_name.shThis will only show that your script is running. Should you want to close all the processes spawned by it, you will need to look for these via ps -ef | grep [Your UUN}. Then you can use the kill command together with the process ID to end a process.
Make sure your script is executable by you, or longjob will fail returning Permission denied messages.
Remember to save your results regularly, and always nice your processes (with at least a value of +10).
Rather than occupying a lab machine, it may be more appropriate to use a compute server. See our list of general purpose servers.
Long term jobs (greater than 28 days) need extra setup. Ask for this via the Support Form.
Longjob with screen and tmux
A tip on using longjob with terminal multiplexers such as screen and tmux.
When: If connecting to the terminal of a machine with homedirectory on AFS, i.e. a DICE server, lab machine.
Why: You will not lose access to the file space in AFS, as your AFS access token will not expire in 17 hours without refreshing.
How to:
SCREEN: $ longjob -28day -c 'screen -D -m -S longjob' TMUX: $longjob -28day -c 'tmux new-session -A -s workspace -d'
Should you not be able to start a session and get the error open terminal failed: not a terminal , try to kill the tmux server first:
$ tmux kill-server.
That will kill any existing sessions though.
Tmux : https://github.com/tmux/tmux/wiki
Screen: https://linux.die.net/man/1/screen