diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..d4cda9a Binary files /dev/null and b/.DS_Store differ diff --git a/extra/transcode-init.d/README.md b/extra/transcode-init.d/README.md new file mode 100644 index 0000000..f749c50 --- /dev/null +++ b/extra/transcode-init.d/README.md @@ -0,0 +1,29 @@ +Celery Init script +================== +Having installed all the requirements for transcoding within WhatManager2, follow these steps to setup the init script for Ubuntu or Debian: + + 1. Install screen: + + sudo apt-get install screen + + 2. Replace USERNAME in wm2celery with the username you wish Celery to run from. + + + 3. Copy wm2celery to /etc/init.d/ + + 4. Make sure it has execution rights: + + sudo chmod +x /etc/init.d/wm2celery + + 5. Set the init script for boot time: + + sudo update-rc.d wm2celery defaults + + + +Once installed, the service will be handled the usual way: + + sudo service wm2celery start | stop | restart + + +You will be able to reattach to the screen session that is running Celery using screen normally. \ No newline at end of file diff --git a/extra/transcode-init.d/wm2celery b/extra/transcode-init.d/wm2celery new file mode 100644 index 0000000..9689d9e --- /dev/null +++ b/extra/transcode-init.d/wm2celery @@ -0,0 +1,43 @@ +#!/bin/bash +# /etc/init.d/wm2celery + +### BEGIN INIT INFO +# Provides: whatmanager2 +# Required-Start: $local_fs $remote_fs +# Required-Stop: $local_fs $remote_fs +# Should-Start: $network +# Should-Stop: $network +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Run Celery for WhatManager2 +# Description: Runs Celery on a detached screen session for WhatManager2. +### END INIT INFO + +USER="USERNAME" + +case "$1" in + + start) + echo "Starting Celery for WhatManager2" + sudo -H -u $USER screen -dmS WM2Celery /usr/bin/python /opt/WhatManager2/manage.py celery worker --loglevel=info --concurrency=1 + ;; + stop) + echo "Stopping Celery for WhatManager2" + PID=`ps -ef | grep manage.py | grep pts | grep -v grep | awk '{print $2}'` + kill -9 $PID + ;; + + restart|force-reload) + echo "Restarting $screen" + PID=`ps -ef | grep manage.py | grep pts | grep -v grep | awk '{print $2}'` + kill -9 $PID + sleep 2 + sudo -H -u $USER screen -dmS WM2Celery /usr/bin/python /opt/WhatManager2/manage.py celery worker --loglevel=info --concurrency=1 + ;; + *) + N=/etc/init.d/$NAME + echo "Usage: $N {start|stop|restart}" >&2 + exit 1 + ;; +esac +exit 0 \ No newline at end of file