-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The scripts use a configuration file to setup options. This options file should live under /etc/default or /etc/sysconfig depending on the user's distribution. Signed-off-by: Rodrigo Tobar <rtobar@icrar.org>
- Loading branch information
Showing
3 changed files
with
242 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
#!/bin/sh | ||
### BEGIN INIT INFO | ||
# Provides: dlg-dim | ||
# Required-Start: $all | ||
# Required-Stop: $local_fs $network | ||
# Default-Start: 2 3 4 5 | ||
# Default-Stop: 0 1 6 | ||
# Short-Description: DALiuGE Data Island Manager daemon | ||
### END INIT INFO | ||
# | ||
# | ||
# chkconfig: 2345 99 70 | ||
# description: Starts and stops the DALiuGE Data Island Manager as a daemon | ||
|
||
# RH, Centos, Fedora configuration style | ||
if [ -r /etc/sysconfig/dlg ]; then | ||
. /etc/sysconfig/dlg | ||
# Debian, Ubuntu configuration style | ||
elif [ -r /etc/default/dlg ]; then | ||
. /etc/default/dlg | ||
else | ||
echo "Missing configuration file, cannot start DALiuGE" > /dev/stderr | ||
exit 1 | ||
fi | ||
|
||
OPTS="" | ||
if [ -n "${DIM_HOST}" ]; then | ||
OPTS="$OPTS --host ${DIM_HOST}" | ||
fi | ||
if [ -n "${DIM_PORT}" ]; then | ||
OPTS="$OPTS --port ${DIM_PORT}" | ||
fi | ||
if [ -n "${DIM_LOGLEVEL}" ]; then | ||
case "${DIM_LOGLEVEL}" in | ||
INFO) | ||
OPTS="$OPTS -v" | ||
;; | ||
DEBUG) | ||
OPTS="$OPTS -vv" | ||
;; | ||
*) | ||
echo "Unknown DIM_LOGLEVEL value" | ||
exit 1 | ||
esac | ||
fi | ||
|
||
|
||
# See how we were called. | ||
RETVAL=0 | ||
case "$1" in | ||
start) | ||
|
||
# Prepare command-line options based on options file | ||
if [ -n "${DIM_NODES}" ]; then | ||
OPTS="$OPTS -N ${DIM_NODES}" | ||
fi | ||
|
||
# Launch the server and check right away if it started correctly | ||
su $USER -c "$DLG dim -d $OPTS" | ||
RETVAL=$? | ||
if [ $RETVAL -eq 0 ]; then | ||
echo "Successfully started the DALiuGE Data Island Manager, checking it started correctly" | ||
$0 status | ||
RETVAL=$? | ||
if [ $RETVAL -ne 0 ]; then | ||
echo "DALiuGE Data Island Manager didn't come up in time, shutting it down" | ||
$0 stop | ||
fi | ||
fi | ||
;; | ||
stop) | ||
echo "Shutting down DALiuGE Data Island Manager server" | ||
su $USER -c "$DLG dim -s" | ||
RETVAL=$? | ||
;; | ||
status) | ||
echo "Checking DALiuGE Data Island Manager status" | ||
su $USER -c "$DLG dim --status" | ||
RETVAL=$? | ||
;; | ||
restart) | ||
echo -n "Restarting DALiuGE Data Island Manager" | ||
$0 stop | ||
$0 start | ||
RETVAL=$? | ||
;; | ||
*) | ||
echo "Usage: $0 {start|stop|status|restart}" | ||
RETVAL=1 | ||
esac | ||
|
||
exit $RETVAL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
#!/bin/sh | ||
### BEGIN INIT INFO | ||
# Provides: dlg-nm | ||
# Required-Start: $all | ||
# Required-Stop: $local_fs $network | ||
# Default-Start: 2 3 4 5 | ||
# Default-Stop: 0 1 6 | ||
# Short-Description: DALiuGE Node Manager daemon | ||
### END INIT INFO | ||
# | ||
# | ||
# chkconfig: 2345 99 70 | ||
# description: Starts and stops the DALiuGE Node Manager as a daemon | ||
|
||
# RH, Centos, Fedora configuration style | ||
if [ -r /etc/sysconfig/dlg ]; then | ||
. /etc/sysconfig/dlg | ||
# Debian, Ubuntu configuration style | ||
elif [ -r /etc/default/dlg ]; then | ||
. /etc/default/dlg | ||
else | ||
echo "Missing configuration file, cannot start DALiuGE" > /dev/stderr | ||
exit 1 | ||
fi | ||
|
||
OPTS="" | ||
if [ -n "${NM_HOST}" ]; then | ||
OPTS="$OPTS --host ${NM_HOST}" | ||
fi | ||
if [ -n "${NM_PORT}" ]; then | ||
OPTS="$OPTS --port ${NM_PORT}" | ||
fi | ||
if [ -n "${NM_LOGLEVEL}" ]; then | ||
case "${NM_LOGLEVEL}" in | ||
INFO) | ||
OPTS="$OPTS -v" | ||
;; | ||
DEBUG) | ||
OPTS="$OPTS -vv" | ||
;; | ||
*) | ||
echo "Unknown NM_LOGLEVEL value" | ||
exit 1 | ||
esac | ||
fi | ||
|
||
|
||
# See how we were called. | ||
RETVAL=0 | ||
case "$1" in | ||
start) | ||
|
||
# Prepare command-line options based on options file | ||
if [ "${NO_DLM}" = "YES" ]; then | ||
OPTS="$OPTS --no-dlm" | ||
fi | ||
if [ -n "${CWD}" ]; then | ||
cd "${CWD}" | ||
OPTS="$OPTS --cwd" | ||
fi | ||
|
||
# Launch the server and check right away if it started correctly | ||
su $USER -c "$DLG nm -d $OPTS" | ||
RETVAL=$? | ||
if [ $RETVAL -eq 0 ]; then | ||
echo "Successfully started the DALiuGE Node Manager, checking it started correctly" | ||
$0 status | ||
RETVAL=$? | ||
if [ $RETVAL -ne 0 ]; then | ||
echo "DALiuGE Node Manager didn't come up in time, shutting it down" | ||
$0 stop | ||
fi | ||
fi | ||
;; | ||
stop) | ||
echo "Shutting down DALiuGE Node Manager server" | ||
su $USER -c "$DLG nm -s" | ||
RETVAL=$? | ||
;; | ||
status) | ||
echo "Checking DALiuGE Node Manager status" | ||
su $USER -c "$DLG nm --status" | ||
RETVAL=$? | ||
;; | ||
restart) | ||
echo -n "Restarting DALiuGE Node Manager" | ||
$0 stop | ||
$0 start | ||
RETVAL=$? | ||
;; | ||
*) | ||
echo "Usage: $0 {start|stop|status|restart}" | ||
RETVAL=1 | ||
esac | ||
|
||
exit $RETVAL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Options configuration for the dlg-nm and dlg-dim scripts | ||
# | ||
# This file defines the configuration options for the DALiuGE daemons | ||
# started by the init system | ||
# | ||
|
||
# | ||
# The user used to run DALiuGE | ||
# | ||
USER=dlg | ||
|
||
# | ||
# DALiuGE process to invoke | ||
# | ||
DLG=dlg | ||
|
||
# | ||
# Hosts to bind the Managers to. | ||
# An empty value means that Managers will bind to 127.0.0.1 | ||
# 0.0.0.0 means all interfaces | ||
# | ||
NM_HOST= | ||
DIM_HOST= | ||
|
||
# | ||
# Ports used to expose the Managers. | ||
# An empty value means that Managers will use their default ports | ||
# (8000/8001 for Node/DataIsland Manager, respectively) | ||
# | ||
NM_PORT= | ||
DIM_PORT= | ||
|
||
# | ||
# Logging level used by the DALiuGE Managers | ||
# Allowed values are INFO and DEBUG. | ||
# | ||
NM_LOGLEVEL=INFO | ||
DIM_LOGLEVEL=INFO | ||
|
||
# | ||
# Don't start the Data Lifecycle Manager on the Node Manager | ||
# | ||
NO_DLM=YES | ||
|
||
# | ||
# The directory where the DALiuGE Managers should run in | ||
# An empty value means that the Managers will run under / | ||
# | ||
CWD= | ||
|
||
# | ||
# Comma-separated list of nodes that the Data Island Manager should manage | ||
# | ||
DIM_NODES= |