2013-02-21 06:55:49 +00:00
|
|
|
#!/bin/sh
|
2015-04-28 17:35:15 +00:00
|
|
|
SERVICES="pandora pandora-tasks pandora-encoding pandora-cron pandora-websocketd"
|
2013-04-21 15:59:18 +00:00
|
|
|
if [ -z "$1" ]; then
|
2013-04-28 02:24:19 +00:00
|
|
|
echo "Usage: $0 (start|stop|restart|reload)"
|
|
|
|
exit 1
|
2013-04-21 15:59:18 +00:00
|
|
|
else
|
|
|
|
action="$1"
|
|
|
|
fi
|
2013-04-28 02:24:19 +00:00
|
|
|
if [ `whoami` != 'root' ]; then
|
|
|
|
echo you have to be root or run $0 with sudo
|
|
|
|
exit 1
|
|
|
|
fi
|
2015-01-19 17:40:32 +00:00
|
|
|
if [ "$action" = "install" ]; then
|
|
|
|
cd "`dirname "$0"`"
|
|
|
|
BASE=`pwd`
|
|
|
|
if [ -x /bin/systemctl ]; then
|
|
|
|
if [ -d /lib/systemd/system/ ]; then
|
|
|
|
cp $BASE/etc/systemd/*.service /lib/systemd/system/
|
|
|
|
cp $BASE/etc/tmpfiles.d/pandora.conf /usr/lib/tmpfiles.d/
|
|
|
|
systemd-tmpfiles --create /usr/lib/tmpfiles.d/pandora.conf >/dev/null || true
|
2015-04-28 17:35:15 +00:00
|
|
|
for service in $SERVICES; do
|
2015-01-19 17:40:32 +00:00
|
|
|
systemctl enable ${service}.service
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
if [ -d /etc/init ]; then
|
|
|
|
cp $BASE/etc/init/* /etc/init/
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
exit 0
|
|
|
|
fi
|
2015-04-28 17:35:15 +00:00
|
|
|
for service in $SERVICES; do
|
2013-04-21 15:59:18 +00:00
|
|
|
service $service $action
|
2013-02-21 06:55:49 +00:00
|
|
|
done
|