make manage.py accessible via ctl, install pandoractl
This commit is contained in:
parent
9c4728b997
commit
fa5cf7cf60
2 changed files with 29 additions and 5 deletions
27
ctl
27
ctl
|
@ -1,13 +1,17 @@
|
|||
#!/bin/sh
|
||||
SERVICES="pandora pandora-tasks pandora-encoding pandora-cron pandora-websocketd"
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: $0 (start|stop|restart|reload)"
|
||||
echo "Usage: $0 (start|stop|restart|reload|status)"
|
||||
exit 1
|
||||
else
|
||||
action="$1"
|
||||
fi
|
||||
self=`readlink "$0"`
|
||||
if [ -z $self ]; then
|
||||
self="$0"
|
||||
fi
|
||||
if [ "$action" = "init" ]; then
|
||||
cd "`dirname "$0"`"
|
||||
cd "`dirname "$self"`"
|
||||
BASE=`pwd`
|
||||
SUDO=""
|
||||
PANDORA_USER=`ls -l update.py | cut -f3 -d" "`
|
||||
|
@ -43,6 +47,18 @@ if [ "$action" = "init" ]; then
|
|||
fi
|
||||
exit 0
|
||||
fi
|
||||
if [ "$action" = "manage" ]; then
|
||||
cd "`dirname "$self"`"
|
||||
if [ `whoami` != 'root' ]; then
|
||||
manage="./pandora/manage.py"
|
||||
else
|
||||
manage="sudo -u pandora ./pandora/manage.py"
|
||||
fi
|
||||
shift
|
||||
$manage $@
|
||||
exit $?
|
||||
|
||||
fi
|
||||
if [ `whoami` != 'root' ]; then
|
||||
echo you have to be root or run $0 with sudo
|
||||
exit 1
|
||||
|
@ -74,6 +90,13 @@ if [ "$action" = "install" ]; then
|
|||
fi
|
||||
exit 0
|
||||
fi
|
||||
if [ "status" = "$action" ]; then
|
||||
export SYSTEMD_PAGER=
|
||||
fi
|
||||
for service in $SERVICES; do
|
||||
if [ -x /bin/systemctl ]; then
|
||||
/bin/systemctl $action $service
|
||||
else
|
||||
service $service $action
|
||||
fi
|
||||
done
|
||||
|
|
|
@ -12,7 +12,7 @@ NGINX=${NGINX-local}
|
|||
BRANCH=${BRANCH-stable}
|
||||
|
||||
# add a pandora user
|
||||
echo Installing pandora with user: $PANDORA
|
||||
echo Installing pandora with user: $PANDORA branch: $BRANCH
|
||||
getent passwd $PANDORA > /dev/null 2>&1 || adduser --disabled-password --gecos "" $PANDORA
|
||||
|
||||
#
|
||||
|
@ -197,8 +197,9 @@ fi
|
|||
if [ "$NGINX" == "local" ]; then
|
||||
|
||||
cp "/srv/pandora/etc/nginx/pandora" "/etc/nginx/sites-available/pandora"
|
||||
rm -f /etc/nginx/sites-enabled/default
|
||||
rm -f /etc/nginx/sites-enabled/default /etc/nginx/sites-enabled/pandora
|
||||
ln -s ../sites-available/pandora /etc/nginx/sites-enabled/pandora
|
||||
ln -s /srv/pandora/ctl /usr/local/bin/pandoractl
|
||||
|
||||
read -r -d '' GZIP <<EOI
|
||||
gzip_static on;\\
|
||||
|
|
Loading…
Reference in a new issue