-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Unai Goikoetxeta
authored and
Unai Goikoetxeta
committed
Jul 13, 2015
1 parent
0ae05d3
commit 6cb9236
Showing
3 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |