/[pdpsoft]/trunk/grid-mw-security/ees/setup/ees.init.d
ViewVC logotype

Contents of /trunk/grid-mw-security/ees/setup/ees.init.d

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1852 - (show annotations) (download) (as text)
Fri Jul 9 12:08:06 2010 UTC (11 years, 10 months ago) by aramv
File MIME type: text/x-dsrc
File size: 2890 byte(s)
Made error message shorter so it fits well
1 #!/bin/sh
2 #
3 # ees Starting, stopping and restarting the ees daemon.
4 #
5 # Author: Aram Verstegen
6 #
7 # chkconfig: 2345 99 01
8 # description: Starts and stops EES daemon
9
10
11 prog="ees"
12 fullprog="/tmp/build/glite/sbin/ees"
13 configfile="/tmp/build/glite/etc/ees.conf"
14 lockfile="/tmp/lock/subsys/ees"
15 nonprivaccount="ees"
16
17 # Source function library
18 if [ -f /etc/redhat-release ]; then
19 # Redhat-style
20 . /etc/rc.d/init.d/functions
21
22 start_ees_daemon="daemon --user $nonprivaccount $fullprog $configfile"
23 elif [ -f /etc/debian_version ]; then
24 # Debian-style
25 . /lib/lsb/init-functions
26 echo_success(){
27 echo success
28 }
29 echo_failure(){
30 echo failure
31 }
32 start_ees_daemon="start-stop-daemon --start --chuid $nonprivaccount --exec $fullprog $configfile"
33 elif [ -f /etc/SuSE-release ]; then
34 # SUSE-style
35 . /etc/rc.status
36 echo_success(){
37 rc_reset
38 rc_status -v
39 }
40 echo_failure(){
41 rc_failure
42 rc_status -v
43 }
44 start_ees_daemon="start-stop-daemon --start --chuid $nonprivaccount --exec $fullprog $configfile"
45 else
46 echo_success(){
47 echo success
48 }
49 echo_failure(){
50 echo failure
51 }
52 echo -n "Warning! Unable to determine the correct daemon runner for your distribution."
53 start_ees_daemon="exec $fullprog $configfile"
54 fi
55
56 start() {
57 echo -n "Starting EES: "
58 # Check if there should be an EES instance running
59 if [ -f $lockfile ]; then
60 eespid=`pidofproc $fullprog`
61 if [ -z "$eespid" ]; then
62 echo -n "removing stale lockfile... "
63 rm -f $lockfile
64 else
65 # EES already running
66 echo -n "already running. "
67 echo_failure
68 echo
69 exit $?
70 fi
71 fi
72 # Starting EES daemon now.
73 ${start_ees_daemon} && touch $lockfile
74 if [ $? -eq 0 ]; then
75 echo_success
76 else
77 echo -n "EES failed to start. "
78 echo_failure
79 fi
80 echo
81 }
82
83 stop() {
84 # Stopping EES
85 echo -n "Stopping EES: "
86 if [ -f $lockfile ]; then
87 # Killing EES now.
88 kill -TERM `pidofproc $fullprog`
89 rm -rf $lockfile
90 echo_success
91 else
92 # No EES running, nothing to kill
93 echo -n "no EES running. "
94 echo_failure
95 fi
96 echo
97 }
98
99 restart(){
100 echo -n "Restarting EES. "
101 eespid=`pidofproc $fullprog`
102 if [ -f $lockfile ]; then
103 kill -HUP $eespid
104 if [ $? -eq 0 ]; then
105 echo_success
106 fi
107 else
108 echo -n "EES not running. "
109 echo_failure
110 fi
111 echo
112 }
113
114 # See how we are called
115 case "$1" in
116 start)
117 start
118 ;;
119 stop)
120 stop
121 ;;
122 restart)
123 restart
124 ;;
125 status)
126 if [ -f $lockfile ]; then
127 echo "ees is running"
128 else
129 echo "ees is stopped"
130 fi
131 ;;
132 *)
133 echo "Usage $0 {start|stop|restart|status}"
134 exit 1
135 esac
136
137 exit 0

grid.support@nikhef.nl
ViewVC Help
Powered by ViewVC 1.1.28