aboutsummaryrefslogtreecommitdiff
path: root/system/apcupsd/patches/init-script-fixups.diff
blob: 2e68c463fd9f52ac435a1f95e00ecdbcd8ee9c54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
diff -Nur apcupsd-3.14.14.orig/platforms/slackware/apcupsd.in apcupsd-3.14.14/platforms/slackware/apcupsd.in
--- apcupsd-3.14.14.orig/platforms/slackware/apcupsd.in	2015-01-29 08:13:25.000000000 -0600
+++ apcupsd-3.14.14/platforms/slackware/apcupsd.in	2017-05-29 21:34:28.782782149 -0500
@@ -9,17 +9,18 @@
 APCPID=@PIDDIR@/apcupsd.pid
 DISTVER="@DISTVER@"
 
-return="  Done."
+return=""
 
 
 case "$1" in
     start)
 	rm -f @PWRFAILDIR@/powerfail
 	rm -f @nologdir@/nologin
-	echo -n "Starting apcupsd power management.."
+	echo -n "Starting apcupsd power management:  /sbin/apcupsd"
 	if [ -f ${APCPID} ]; then
 		return="  Already running."
 	else
+		mkdir -p @LOCKDIR@
 		@sbindir@/apcupsd && touch @LOCKDIR@/apcupsd \
 		|| return="  Failed."
 	fi
@@ -29,8 +30,9 @@
     stop)
 	echo -n "Stopping apcupsd power management.."
 	if [ -f ${APCPID} ]; then
-		THEPID=`cat ${APCPID}`
+		THEPID=$(cat ${APCPID})
 		kill ${THEPID} || return="  Failed."
+		sleep 2
 		rm -f ${APCPID}
 	else
 		return="  Nothing to stop."