Skip to content

Instantly share code, notes, and snippets.

@virajkanwade
Last active August 29, 2015 14:26
Show Gist options
  • Save virajkanwade/a744359c874f8e0a9595 to your computer and use it in GitHub Desktop.
Save virajkanwade/a744359c874f8e0a9595 to your computer and use it in GitHub Desktop.
Script to download init.d scripts (celeryd and celerybeat) for your celery version. Also pass your app name to get the files as celeryd-<APP_NAME> and celerybeat-<APP_NAME>
#!/bin/bash
########################################
# AUTHOR: Viraj Kanwade #
# http://viraj-workstuff.blogspot.com/ #
########################################
set -e
CELERYD_INITD=celeryd
CELERYBEAT_INITD=celerybeat
if [[ -n $1 ]]
then
CELERYD_INITD=${CELERYD_INITD}-$1
CELERYBEAT_INITD=${CELERYBEAT_INITD}-$1
fi
VERSION=`celery --version | awk '{ print $1 }'`
echo "Celery version: ${VERSION}"
CELERYD_URL="https://raw.githubusercontent.com/celery/celery/v${VERSION}/extra/generic-init.d/celeryd"
CELERYBEAT_URL="https://raw.githubusercontent.com/celery/celery/v${VERSION}/extra/generic-init.d/celerybeat"
{
wget $CELERYD_URL -O $CELERYD_INITD
wget $CELERYBEAT_URL -O $CELERYBEAT_INITD
} || {
curl $CELERYD_URL -o $CELERYD_INITD
curl $CELERYBEAT_URL -o $CELERYBEAT_INITD
} || {
echo 'Could not find wget or curl'
exit 1
}
echo "Saved as ${CELERYD_INITD} and ${CELERYBEAT_INITD}."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment