Skip to content

Instantly share code, notes, and snippets.

@iamniks
Last active December 12, 2017 13:52
Show Gist options
  • Save iamniks/7371ca06aa9469c3a61fbd21f5e8e7a9 to your computer and use it in GitHub Desktop.
Save iamniks/7371ca06aa9469c3a61fbd21f5e8e7a9 to your computer and use it in GitHub Desktop.
Stratup config for monit
#!/bin/bash
PID_FILE='/home/%USER%/.zen/zen_node.pid'
start() {
touch $PID_FILE
eval "/bin/su %USER% -c '/usr/bin/zend 2>&1 >> /dev/null'"
PID=$(ps aux | grep zend | grep -v grep | awk '{print $2}')
echo "Starting zend with PID $PID"
echo $PID > $PID_FILE
}
stop () {
pkill zend
rm $PID_FILE
echo "Stopping zend"
}
case $1 in
start)
start
;;
stop)
stop
;;
*)
echo "usage: zend {start|stop}" ;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment