Size: 2393
Comment:
|
← Revision 16 as of 2013-06-27 07:00:57 ⇥
Size: 1738
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 3: | Line 3: |
Similar to Apache HTTPD's "apachectl" script, EMEN2 includes an "[[EMEN2/emen2ctl|emen2ctl]]" script. This can be used to start and stop the server and perform some basic administration tasks. = Create a system account for EMEN2 = 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. |
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. |
Line 15: | Line 7: |
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. | 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. |
Line 24: | Line 16: |
@reboot . $HOME/EMAN2/eman2.bashrc; $HOME/EMAN2/Python/bin/emen2ctl start -h $HOME/db.test -e default,em,eman2,site | @reboot . $HOME/EMAN2/eman2.bashrc; $HOME/EMAN2/Python/bin/emen2ctl start -h $HOME/test.db |
Line 27: | Line 19: |
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: | 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. |
Line 29: | Line 21: |
* -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: |
'''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: |
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:
#!/home/emen2/EMAN2/Python/bin/python
I will correct this in future releases.