FAQ: Running Sawmill in the Background

When I run Sawmill in a UNIX terminal window, and then close the window, Sawmill
stops working. What can I do about that?

Short Answer

Add an ampersand (&) to the end of the command line to run it in the background.

Long Answer

When you run Sawmill from the command line in UNIX by just typing
the name of the program, it runs in the foreground. That means that
you don't get your prompt back until Sawmill exits, and it also means
that if you close your terminal window, the Sawmill server will terminate
and you will not be able to use it anymore until you open another terminal window
and restart Sawmill. Often, that's not what you want--you want Sawmill to
keep running after you close the window. You can do that by running
Sawmill in the background.

To run Sawmill (or any other UNIX program) in the background,
add an ampersand (a & character) to the end of the command line; for instance,
you might use the following command line:

./sawmill &

if the name of your Sawmill program is sawmill.
When you type this, you will see one line of output as Sawmill is backgrounded,
and a few lines from Sawmill describing the running web server,
and then you will have your shell prompt back, so you can type more commands.
At this point, Sawmill is running in the background. You can type exit
at the prompt to close the shell, or you can just close the window, and Sawmill
will continue to run in the background.

On some rare occasions, Sawmill may generate output to the shell console.
This is not usually a problem, but on some systems, background programs that generate
output may be suspended, and that can make Sawmill inaccessible. To prevent
this from happening, you may want to use this command line instead:

nohup ./sawmill &

The "nohup" part of the command line stands for "no hang-up" and
prevents this sort of output-related suspension problem.
Unfortunately nohup doesn't exist on all systems.
If you don't know if your system supports nohup,
try including nohup on the command line--if it doesn't run that way, don't use it.

You can see current background jobs started from the current terminal using the jobs
command (with most shells). You can terminate a background job by bringing it to the front using the fg
command and then using control-C, or using the kill command together with its process ID.
You can find the process ID (pid) of any background process (including ones started in other windows)
using the ps command. For more information about any of these commands, use the man
command (e.g. type man ps), or consult your UNIX documentation.