Page MenuHome

flamenco-worker
No OneTemporary

flamenco-worker

#!/bin/bash
#
### BEGIN INIT INFO
# Provides: flamenco-worker
# Required-Start: $local_fs $network
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: flamenco-worker initial script starter
# Description: flamenco-worker initial script starter
### END INIT INFO
: ${FLAMENCO_WORKER:?"Need to set FLAMENCO_WORKER"}
start() {
(
exec >/dev/null 2>&1
LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 LC_ALL=en_US.UTF-8 screen -S fwork -d -m python2.7 "$FLAMENCO_WORKER" &
)
echo "Flamenco-Worker started"
}
stop() {
pid=`pgrep -f "$FLAMENCO_WORKER"`
if [ $pid ]; then
echo "Killing worker application"
kill -n 9 $pid
else
echo "No worker application found"
fi
# TODO currently this is hardcoded to look for a "farm" value in the
# process. This is not ideal and we should try to shutdown any task
# run by the worker in a clean way (possibly using a curl command)
pid_blender=`pgrep -f "farm"`
if [ $pid_blender ]; then
echo "Killing blender"
kill -n 9 $pid_blender
else
echo "No blender farm instance found"
fi
sleep 2
echo "Flamenco-Worker killed"
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo "Usage: /etc/init.d/flamenco-worker {start|stop|restart}"
exit 1
esac
exit 0

File Metadata

Mime Type
text/x-shellscript
Expires
Thu, Dec 9, 7:46 AM (2 d)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
69/67/120af7930f65790af295de2b0a65

Event Timeline