Last active
December 25, 2018 09:27
-
-
Save BbsonLin/1902ccce538af3685585b5830e206a1a to your computer and use it in GitHub Desktop.
Daemonize celery flower by `start-stop-daemon`, in pipenv's virtualenv
This file contains hidden or 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 | |
NAME=flowerd | |
DESC="flower daemon" | |
PIDFILE=./$NAME.pid | |
PIPENV_VENV_PATH=`pipenv --venv` | |
FLOWER="$PIPENV_VENV_PATH/bin/celery flower" | |
FLOWER_OPTS="--broker=redis://localhost:6379/15 --port=5566" | |
DAEMON=$FLOWER | |
set -e | |
case "$1" in | |
start) | |
echo -n "Starting $DESC: " | |
# For Busybox/Termux version | |
# start-stop-daemon -S -b -p $PIDFILE \ | |
# -m \ | |
# -x $DAEMON -- $FLOWER_OPTS | |
start-stop-daemon --start --background --pidfile $PIDFILE \ | |
--make-pidfile \ | |
--exec $DAEMON -- $FLOWER_OPTS | |
echo "$NAME." | |
;; | |
stop) | |
echo -n "Stopping $DESC: " | |
# For Busybox/Termux version | |
# start-stop-daemon -K -q -o -p $PIDFILE | |
start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE | |
rm -f $PIDFILE | |
echo "$NAME." | |
;; | |
*) | |
echo "Usage: "$1" {start|stop}" | |
exit 1 | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment