libgpg-error: Fix compiling with uclibc
[openadk.git] / package / nut / files / upsd.init
blob0d451d1adab51e2f37840b0bec1022c9b9eded3b
1 #!/bin/sh
2 #PKG nut
3 #INIT 60
4 . /etc/rc.conf
6 case $1 in
7 autostop) ;;
8 autostart)
9 test x"${upsd:-NO}" = x"NO" && exit 0
10 test x"$upsd" = x"DAEMON" && test -x /bin/mksh && exec mksh -T- $0 start
11 exec sh $0 start
13 start)
14 [ -d /var/state/ups ] || mkdir -p /var/state/ups
15 /usr/bin/upsdrvctl start || exit 1
16 /usr/sbin/upsd || exit 2
18 stop)
19 /usr/sbin/upsd -c stop || kill $(pgrep -f /usr/sbin/upsd)
20 /usr/bin/upsdrvctl stop
22 restart)
23 sh $0 stop
24 sleep 1
25 sh $0 start
28 echo "Usage: $0 {start | stop | restart}"
29 exit 1
31 esac
32 exit $?