install systemd/upstart services via pandora/ctl install

This commit is contained in:
j 2015-01-19 18:40:32 +01:00
commit a8ca6fbb96
3 changed files with 26 additions and 13 deletions

19
ctl
View file

@ -9,6 +9,25 @@ if [ `whoami` != 'root' ]; then
echo you have to be root or run $0 with sudo
exit 1
fi
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
for service in pandora pandora-tasks pandora-encoding pandora-cron; do
systemctl enable ${service}.service
done
fi
else
if [ -d /etc/init ]; then
cp $BASE/etc/init/* /etc/init/
fi
fi
exit 0
fi
for service in pandora pandora-tasks pandora-encoding pandora-cron; do
service $service $action
done