Differences between revisions 1 and 2
Revision 1 as of 2012-03-12 09:11:48
Size: 34
Editor: IanRees
Comment:
Revision 2 as of 2012-03-12 09:35:06
Size: 2373
Editor: IanRees
Comment:
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:

Similar to Apache HTTPD's "apachectl" script, EMEN2 includes an "[[EMEN2/emen2ctl]]" script. This can be used to start and stop the server and perform some basic administration tasks.

= Create an EMEN2 account =

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.

= Start EMEN2 using init.d =

emen2ctl can be run as a traditional "init.d" script, but this is not recommended because it will run with root privileges. You will also have to find a way to pass the "-h" database environment flag. Instead, I recommend starting EMEN2 using crontab as described below.

= 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 a regular user ("emen2" account") 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/db.test -e default,em,eman2,site
}}}

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 two arguments:

 * -h $HOME/db.test

This should point to your EMEN2 database environment. Alternatively, you can set the $EMEN2DBHOME environment variable.

 * -e default,em,eman2,site

This specifies the extensions that will be loaded. You could put this in the config.json file.

```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:

{{{
#!/home/emen2/EMAN2/Python/bin/python
}}}

I will correct this in future releases.

Running EMEN2 at system boot

Similar to Apache HTTPD's "apachectl" script, EMEN2 includes an "EMEN2/emen2ctl" script. This can be used to start and stop the server and perform some basic administration tasks.

Create an EMEN2 account

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.

Start EMEN2 using init.d

emen2ctl can be run as a traditional "init.d" script, but this is not recommended because it will run with root privileges. You will also have to find a way to pass the "-h" database environment flag. Instead, I recommend starting EMEN2 using crontab as described below.

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 a regular user ("emen2" account") 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/db.test -e default,em,eman2,site

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 two arguments:

  • -h $HOME/db.test

This should point to your EMEN2 database environment. Alternatively, you can set the $EMEN2DBHOME environment variable.

  • -e default,em,eman2,site

This specifies the extensions that will be loaded. You could put this in the config.json file.

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)