From d2ccacb3e47baa2b738acc0afa517258b3366ba9 Mon Sep 17 00:00:00 2001 From: Alex Malinovich Date: Tue, 16 Aug 2016 12:26:09 -0700 Subject: [PATCH] Fix service checking for autostart and add fallback error --- plexupdate.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plexupdate.sh b/plexupdate.sh index dd464a7..cca3eee 100755 --- a/plexupdate.sh +++ b/plexupdate.sh @@ -519,10 +519,15 @@ if [ "${AUTOSTART}" = "yes" ]; then echo "The AUTOSTART [-s] option may not be needed on your distribution." >&2 fi # Check for systemd - if ! hash systemctl 2>/dev/null; then + if hash systemctl 2>/dev/null; then systemctl start plexmediaserver.service + elif hash service 2>/dev/null; then + service plexmediaserver start + elif [ -x /etc/init.d/plexmediaserver ]; then + /etc/init.d/plexmediaserver start else - /sbin/service plexmediaserver start + echo "ERROR: AUTOSTART was specified but no startup scripts were found for 'plexmediaserver'." >&2 + cronexit 1 fi fi