Last active
December 12, 2017 13:52
-
-
Save iamniks/7371ca06aa9469c3a61fbd21f5e8e7a9 to your computer and use it in GitHub Desktop.
Stratup config for monit
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
#!/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