Running EMEN2 at system boot

For systems that will run EMEN2 continuously, I highly recommend creating a dedicated "emen2" account. This will run EMEN2 using regular user-level permissions instead of as root. Please see your operating system documentation for creating a new account.

Start EMEN2 using crontab

Cron is a tool for running commands (jobs) at specified times and intervals and is generally available on unix-like systems. Modern cron implementations also include an "@reboot" setting that will run a job the system is started. Additionally, each user account can usually schedule their own cron jobs using the "crontab" command. This will allow us to have EMEN2 run as under a regular user account (e.g. "emen2") at boot.

bash$ crontab -e

This will open a text editor (usually vi or pico) to edit your cron file. On a typical Linux installation, insert the following line:

@reboot . $HOME/EMAN2/eman2.bashrc; $HOME/EMAN2/Python/bin/emen2ctl start -h $HOME/test.db

The first argument is "@reboot" that will schedule this job to run whenever the system is booted. The remainder of the line is a command to start EMEN2 using emen2ctl. First, the EMAN2 shell init file is loaded because cron jobs start with a very minimal environment. The second part runs "emen2ctl start" to start the server, passing the -h argument to specify the database environment. Alternatively, you can set the $EMEN2DBHOME environment variable.

Note: Currently, on Linux you will need to patch one file. Edit $HOME/EMAN2/Python/bin/twistd and change the first line to the EMAN2 Python interpreter:


I will correct this in future releases.

EMEN2/Startup (last edited 2013-06-27 07:00:57 by IanRees)