-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopenhpi-subagent.rc
executable file
·96 lines (85 loc) · 1.6 KB
/
openhpi-subagent.rc
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#! /bin/sh
# chkconfig: 35 55 55
# description: HPI SNMP Subagent
# processname: hpiSubagent
# Source function library.
# /etc/init.d/hpisnmpd
#
### BEGIN INIT INFO
# Provides: hpiSubagent
# Required-Start: $network net-snmp
# X-UnitedLinux-Should-Start: network net-snmp
# Required-Stop:
# Default-Start: 3 5
# Default-Stop:
# Description: init script for HPI SNMP Subagent
### END INIT INFO
isUnited=`grep "UnitedLinux" /etc/issue`
isSUSE=`grep "SuSE" /etc/issue`
prog=/usr/bin/hpiSubagent
# Enable forking
OPTIONS="-f"
if [ "$isUnited" ] || [ "$isSUSE" ]; then
. /etc/rc.status
rc_reset
RETVAL=$rc_done
case "$1" in
start)
echo -n "Starting up HPI SNMP sub-agent daemon "
startproc $prog $OPTIONS
rc_status -v
;;
stop)
echo -n "Shutting down HPI SNMP sub-agent daemon "
killproc -TERM $proc
rc_status -v
;;
try-restart)
$0 stop && $0 start
rc_status
;;
restart)
$0 stop
$0 start
rc_status
;;
status)
echo -n "Checking for HPI SNMP sub-agent:"
checkproc $prog ; rc_status -v
;;
*)
echo "Usage: $0 {start|stop|status|try-restart|restart}"
exit 1
;;
esac
rc_exit
else
. /etc/rc.d/init.d/functions
RETVAL=0
# Red Hat/Turbo/Caldera
case "$1" in
start)
echo -n $"Starting up HPI SNMP sub-agent daemon: "
daemon $prog $OPTIONS
RETVAL=$?
echo
;;
stop)
echo -n $"Shutting down HPI SNMP sub-agent daemon: "
killproc $prog
RETVAL=$?
echo
;;
status)
status $prog
RETVAL=$?
;;
restart|reload)
$0 stop && $0 start
;;
*)
echo "Usage: $0 {start|stop|status|restart|reload}"
exit 1
esac
exit $RETVAL
fi