Lines 1-5
Link Here
|
1 |
#!/bin/sh |
1 |
#!/bin/sh |
2 |
# |
2 |
# |
3 |
# chkconfig: 2345 87 13 |
3 |
# chkconfig: 2345 51 89 |
4 |
# description: The UPS drivers |
4 |
# description: The UPS drivers |
5 |
# config: /etc/ups/ |
5 |
# config: /etc/ups/ |
Lines 12-15
Link Here
|
12 |
# Source service configuration. |
12 |
# Source service configuration. |
13 |
SourceIfNotEmpty /etc/sysconfig/upsd |
13 |
SourceIfNotEmpty /etc/sysconfig/upsd |
|
|
14 |
SourceIfNotEmpty /etc/sysconfig/nut |
14 |
|
15 |
|
15 |
LOCKFILE=/var/lock/subsys/upsdrv |
16 |
LOCKFILE=/var/lock/subsys/upsdrv |
Lines 19-24
Link Here
|
19 |
get_drvlist() |
20 |
get_drvlist() |
20 |
{ |
21 |
{ |
21 |
DRVLIST="$((find $CHROOTDIR/ -maxdepth 1 -name '*-*.pid' -type f | |
22 |
DRVLIST="$((find $PIDDIR/ -maxdepth 1 -name '*-*.pid' -type f | |
22 |
sed -ne 's,'$CHROOTDIR'/\([^/-]\+\)-[^/-]\+\.pid$,/lib/nut/\1,p'; |
23 |
sed -ne 's,'$PIDDIR'/\([^/-]\+\)-[^/-]\+\.pid$,/lib/nut/\1,p'; |
23 |
upsdrvctl list 2>/dev/null |grep ^/ |
24 |
upsdrvctl list 2>/dev/null |grep ^/ |
24 |
) |sort -u)" |
25 |
) |sort -u)" |
Lines 37-50
Link Here
|
37 |
stop() |
38 |
stop() |
38 |
{ |
39 |
{ |
39 |
local f list rc=0 |
40 |
upsd_configured || return 0 |
40 |
get_drvlist |
41 |
act="stop" |
41 |
[ -n "$DRVLIST" ] || rc=3 |
42 |
if [ -f /etc/killpower ]; then |
42 |
for f in $DRVLIST; do |
43 |
UPS_SHUTDOWN=${UPS_SHUTDOWN:=9} |
43 |
msg_stopping $"${f##*/} UPS driver" |
44 |
if [ $UPS_SHUTDOWN -eq 1 ]; then |
44 |
stop_daemon --expect-user upsdrv --no-announce -- "$f" |
45 |
act="shutdown" |
45 |
RETVAL=$? |
46 |
fi |
46 |
[ "$RETVAL" = 0 ] || rc="$RETVAL" |
47 |
fi |
47 |
done |
48 |
|
48 |
RETVAL="$rc" |
49 |
action "Stopping UPS drivers:" upsdrvctl $UPSDRV_OPTIONS $act |
|
|
50 |
RETVAL=$? |
49 |
[ $RETVAL -eq 0 ] && rm -f "$LOCKFILE" |
51 |
[ $RETVAL -eq 0 ] && rm -f "$LOCKFILE" |
50 |
return $RETVAL |
52 |
return $RETVAL |