Starting Datameer at Boot Time
The following describes how to edit and set up the attached Datameer X startup script in CentOS 5.6. These should work the same on other Linux distributions.
An example of shell script code is below:
Prerequisites
Datameer X should be installed and running successfully. (i.e., <path to das>/bin/conductor.sh start
)
Datameer
- Create the script on the Linux machine.
- Move the
das.server
script to/etc/init.d/
. Note: These scripts should be owned by root: - Edit the
das.server
script:- Change the value of
DAS_HOME
to the correct path- export DAS_HOME=/opt/das
- Change
DAS_USER
to the same user that owns/opt/das
directory and has been previously defined indas-env.sh
- export DAS_USER=datameer
- Change
PID_PATH
to a location where the das pid file can be stored.- export PID_PATH=/var/lock/subsys
- Change the value of
- Add das server to the list of available services in Linux:
- chkconfig --add das.server
- Check what init levels are active for Das:
- chkconfig --list |grep das.server (Notice init 3,4,5 have das “on”)
das.server 0:off 1:off 2:off 3:on 4:on 5:on 6:off
This automates the start of Datameer X at bootup.
#!/bin/bash #set -x # # Starts a Datameer X Server # chkconfig: 345 90 10 # description: DAS Server export DAS_HOME=/opt/das export DAS_USER=das export PID_PATH=/var/lock/subsys #Source Function Library . /etc/rc.d/init.d/functions RETVAL=0 PIDFILE="/var/lock/subsys/das.pid" desc="DAS Server daemon" ####################################################################### start() { echo -n $"Starting $desc (DAS): " daemon --user $DAS_USER $DAS_HOME/bin/conductor.sh start /dev/null2>&1 RETVAL=$? echo [ $RETVAL -eq 0 ] && touch $PID_PATH/das return $RETVAL } stop() { echo -n $"Stopping $desc (DAS): " daemon --user $DAS_USER $DAS_HOME/bin/conductor.sh stop RETVAL=$? sleep 5 echo [ $RETVAL -eq 0 ] && rm -f $PID_PATH/das $PIDFILE } checkstatus(){ ps |grep das } restart() { stop start } case "$1" in start) start ;; stop) stop ;; status) checkstatus ;; restart) restart ;; *) echo $"Usage: $0 {start|stop|status|restart}" exit 1 esac exit $RETVAL