-
Notifications
You must be signed in to change notification settings - Fork 0
/
procman.redhat
executable file
·85 lines (78 loc) · 1.61 KB
/
procman.redhat
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
#!/bin/sh
#
# This file is public domain.
#
# Author: Ids van der Molen <[email protected]>
#
# chkconfig: 2345 40 20
# description: (user space) process manager
#
### BEGIN INIT INFO
# Provides: procman
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: (user space) process manager
### END INIT INFO
#
name=procman
lockfile=/var/lock/subsys/$name
PROCMAN_PID=/var/run/${name}.pid
PROCMAN_BIN=/opt/${name}/bin/${name}
PROCMAN_LOG=/var/log/${name}.log
PROFILE_DIR=/var/opt/${name}
test -x $PROCMAN_BIN || { echo "$PROCMAN_BIN not installed";
if [ "$1" = "stop" ];then exit 0;
else exit 5; fi; }
test -d $PROFILE_DIR || { echo "$PROFILE_DIR not found";
if [ "$1" = "stop" ];then exit 0;
else exit 5; fi; }
# Source function library.
. /etc/rc.d/init.d/functions
retval=0
start() {
# Start daemons.
echo -n "Starting $name: "
daemon $PROCMAN_BIN -dqv -l $PROCMAN_LOG $PROFILE_DIR $PROCMAN_PID
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop() {
# Stop daemons.
echo -n "Shutting down $name: "
killproc -p $PROCMAN_PID
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status -p $PROCMAN_PID
retval=$?
;;
restart|reload)
stop
start
retval=$?
;;
condrestart)
if [ -f $lockfile ]; then
stop
start
retval=$?
fi
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
exit 1
esac
exit $retval