Editing
Scanco Administration
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
====Running long calculations==== Here are some useful tips for running long jobs. =====Getting the prompt back after starting a job===== Use & at the end of the command. This puts the job in the background. For example: ./myjob someargs & To see all your background jobs (the ones started in the current shell), enter: jobs To bring one of these to the foreground, use: fg %n where <tt>n</tt> is the job number (yes it needs a <tt>%</tt> in front of it). To move it to the background again, hit CTRL-Z. This however doesn't just move the job to the background, it suspends it. To get it running again, use bg %n [[Image:Redirect.jpg|15px]] [[#top|''Return to Contents'']] or [[Main_Page|''Return to Main Page'']] =====Keeping a job running after you log out===== Use nohup. For example, suppose you want to run <tt>./myjob 20</tt>. In this case, you could use: nohup nice ./myjob 20 &> output & There are several things to note here: * The <tt>&</tt> at the end of the command line is there so you get the command prompt back immediately (see the previous section). * We have redirected the output to a file out_file with <tt>&> output</tt>. If you don't do this, any output to STDIN (normally the console) will automatically go into a file called <tt>nohup.out</tt>. * We've niced the job to reduce it's execution priority. This is courteous if you're a multiuser system. If you want to see what's in nohup.out (or whatever you called it) at any time, you can do the usual cat nohup.out Here's another potentially more useful command: tail -f nohup.out tail shows you the last few lines of the files. In addition, the -f flag ("follow") means that as lines get added to the file, they are displayed on the screen. This looks just like when you run the program without nohup, except when you hit CTRL-C, the program keeps on running in the background. [[Image:Redirect.jpg|15px]] [[#top|''Return to Contents'']] or [[Main_Page|''Return to Main Page'']] =====Finding out if any of your jobs are still running===== This command will show all jobs that belong to user "eric": ps -u eric Another useful command is "top", which will show interactively which processes are using the most processor cycles. [[Image:Redirect.jpg|15px]] [[#top|''Return to Contents'']] or [[Main_Page|''Return to Main Page'']] =====Terminating a job prematurely===== If you decide that you want to kill the job before it completes, this is the command: kill PID where PID is the actual PID (a number) of the process. You find the PID with 'top' or 'ps -u eric' (replace eric by your user ID of course). Occasionally a process will decline to terminate when you request it to. This is the more brutal, never-fails method to kill a job immediately: kill -s KILL PID [[Image:Redirect.jpg|15px]] [[#top|''Return to Contents'']] or [[Main_Page|''Return to Main Page'']] =====Suspending a long-running job and restarting it later===== First find the PID (process ID) with top or with ps. For example, I might list all jobs belonging to me with: ps -u eric To stop the job, send it a STOP signal: kill -s STOP PID (replace PID with the actual PID number). It is now no longer running, but it still occupies memory (although the memory it uses will probably be swapped out to disk). When you want to resume execution, give it a CONT signal: kill -s CONT PID [[Image:Redirect.jpg|15px]] [[#top|''Return to Contents'']] or [[Main_Page|''Return to Main Page'']]
Summary:
Please note that all contributions to bone.wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
BoneWiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Log in
associated-pages
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Documents
Recent changes
Help
Tools
What links here
Related changes
Page information