diff --git a/BuildFiles/Packaging/templates/postinst-backend.template b/BuildFiles/Packaging/templates/postinst-backend.template index 1901f941..9018c527 100644 --- a/BuildFiles/Packaging/templates/postinst-backend.template +++ b/BuildFiles/Packaging/templates/postinst-backend.template @@ -5,8 +5,16 @@ mkdir -p /var/lib/swarmops/upload #todo: check for database upgrade -#start the daemon -/etc/init.d/swarmops-backend start +#if we're running systemd, use systemd; +#otherwise, use upstart + +if [ -z $(pidof systemd) ]; then + #start the daemon + /etc/init.d/swarmops-backend start + #register the daemon + update-rc.d swarmops-backend defaults 90 10 > /dev/null +else + systemctl enable swarmops-backend + systemctl start swarmops-backend +fi -#register the daemon -update-rc.d swarmops-backend defaults 90 10 > /dev/null diff --git a/BuildFiles/Packaging/templates/prerm-backend.template b/BuildFiles/Packaging/templates/prerm-backend.template index 792f0d7c..86fa849e 100644 --- a/BuildFiles/Packaging/templates/prerm-backend.template +++ b/BuildFiles/Packaging/templates/prerm-backend.template @@ -1,5 +1,13 @@ #! /bin/bash -update-rc.d -f swarmops-backend remove > /dev/null -/etc/init.d/swarmops-backend stop +# Different paths for systemd and upstart + +if [ -z $(pidof systemd) ]; then + update-rc.d -f swarmops-backend remove > /dev/null + /etc/init.d/swarmops-backend stop +else + systemctl stop swarmops-backend + systemctl disable swarmops-backend +fi +