install systemd/upstart services via pandora/ctl install

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

3
README
View file

@ -100,7 +100,8 @@ Important: "use_your_own" is a password and you have to use the same value here
./manage.py init_db ./manage.py init_db
4) install init scripts and start daemons 4) install init scripts and start daemons
cp /srv/pandora/etc/init/*.conf /etc/init/
/srv/pandora/ctl install
/srv/pandora/ctl start /srv/pandora/ctl start
5) Setup Webserver 5) Setup Webserver

19
ctl
View file

@ -9,6 +9,25 @@ if [ `whoami` != 'root' ]; then
echo you have to be root or run $0 with sudo echo you have to be root or run $0 with sudo
exit 1 exit 1
fi 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 for service in pandora pandora-tasks pandora-encoding pandora-cron; do
service $service $action service $service $action
done done

View file

@ -122,19 +122,12 @@ echo "UPDATE django_site SET domain = '$HOST.local', name = '$HOST.local' WHERE
mkdir /srv/pandora/data mkdir /srv/pandora/data
chown -R pandora:pandora /srv/pandora chown -R pandora:pandora /srv/pandora
if [ "$SYSTEMD" == "yes" ]; then /srv/pandora/ctl install
cp /srv/pandora/etc/systemd/*.service /lib/systemd/system/
cp /srv/pandora/etc/tmpfiles.d/pandora.conf /usr/lib/tmpfiles.d/ if [ "$LXC" == "yes" ]; then
if [ "$LXC" == "yes" ]; then if [ "$SYSTEMD" == "yes" ]; then
sed -i s/127.0.0.1/0.0.0.0/g /lib/systemd/system/pandora.service sed -i s/127.0.0.1/0.0.0.0/g /lib/systemd/system/pandora.service
fi else
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
else
cp /srv/pandora/etc/init/* /etc/init/
if [ "$LXC" == "yes" ]; then
sed -i s/127.0.0.1/0.0.0.0/g /etc/init/pandora.conf sed -i s/127.0.0.1/0.0.0.0/g /etc/init/pandora.conf
fi fi
fi fi