Skip to content

Instantly share code, notes, and snippets.

@blieberman
Created March 13, 2018 21:37
Show Gist options
  • Save blieberman/3e3b61a949d7bf0626bd52eac346d81f to your computer and use it in GitHub Desktop.
Save blieberman/3e3b61a949d7bf0626bd52eac346d81f to your computer and use it in GitHub Desktop.
pipelinedb init.d script
#! /bin/sh
# chkconfig: 2345 98 02
# description: PipelineDB
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# Data directory
PDATA="/data/pipelinedb/data"
PUSER=pipelinedb
PCTL="/usr/bin/pipeline-ctl"
set -e
# Only start if we can find pipeline-ctl.
test -x $PCTL ||
{
echo "$PCTL not found"
if [ "$1" = "stop" ]
then exit 0
else exit 5
fi
}
# Parse command line parameters.
case $1 in
start)
echo -n "Starting pipelinedb: "
su - $PUSER -c "$PCTL start -D $PDATA -w -s"
echo "ok"
;;
stop)
echo -n "Stopping pipelinedb: "
su - $PUSER -c "$PCTL stop -D $PDATA -s -m smart"
echo "ok"
;;
restart)
echo -n "Restarting pipelinedb: "
su - $PUSER -c "$PCTL restart -D $PDATA -w -s -m smart"
echo "ok"
;;
reload)
echo -n "Reload pipelinedb: "
su - $PUSER -c "$PCTL reload -D $PDATA -s"
echo "ok"
;;
status)
su - $PUSER -c "$PCTL status -D $PDATA"
;;
*)
echo "Usage: $0 {start|stop|restart|reload|status}" 1>&2
exit 1
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment