#!/bin/bash
HEIGHT=27
WIDTH=40
CHOICE_HEIGHT=20
BACKTITLE="DEV servers update"
TITLE="DEV server actions"
MENU="Choose one of the following options:"
OPTIONS=(
1 "Sistema Quick Update"
2 "Sistema Full Update"
3 "Celery - RESTART"
4 "Celery - purge all tasks"
5 "Celery - events monitor"
)
CHOICE=$(dialog --clear \
--backtitle "$BACKTITLE" \
--title "$TITLE" \
--menu "$MENU" \
$HEIGHT $WIDTH $CHOICE_HEIGHT \
"${OPTIONS[@]}" \
2>&1 >/dev/tty)
clear
case $CHOICE in
1)
sudo -u django -- sh -c 'cd /www/sistema; git pull'
;;
2)
sudo -u django -- sh -c 'cd /www/sistema; git pull; make migrate'
;;
3)
sudo -- sh -c 'supervisorctl restart trans:*'
;;
4)
sudo -- bash -c 'cd /www/sistema; source ./env/bin/activate && python src/manage.py celery purge'
;;
5)
sudo -- bash -c 'cd /www/sistema; source ./env/bin/activate && python src/manage.py celery events'
;;
esac