/[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 1847 - (show annotations) (download) (as text)
Thu Jul 8 15:54:25 2010 UTC (11 years, 6 months ago) by aramv
File MIME type: text/x-dsrc
File size: 2564 byte(s)
Fixed init script a bit more
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="/opt/glite/sbin/ees"
13 configfile="/opt/glite/etc/ees.conf"
14 lockfile="/var/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 --conf $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="exec 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="exec 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 success "Looks like there is still another EES running."
67 echo
68 exit $?
69 fi
70 fi
71 # Starting EES daemon now.
72 ${start_ees_daemon} && touch $lockfile
73 if [ $? -eq 0 ]; then
74 echo_success
75 else
76 echo -n "EES failed to start"
77 echo_failure
78 fi
79 echo
80 }
81
82 stop() {
83 # Stopping EES
84 echo -n "Stopping EES: "
85 if [ -f $lockfile ]; then
86 # Killing EES now.
87 killproc $fullprog
88 rm -rf $lockfile
89 echo_success
90 else
91 # No EES running, nothing to kill
92 echo "No EES running "
93 echo_failure
94 fi
95 }
96
97 restart(){
98 kill -HUP `pidofproc $fullprog`
99 }
100
101 # See how we are called
102 case "$1" in
103 start)
104 start
105 ;;
106 stop)
107 stop
108 ;;
109 restart)
110 echo "Restarting EES."
111 restart
112 ;;
113 status)
114 status $fullprog
115 ;;
116 *)
117 echo "Usage $0 {start|stop|restart|status}"
118 exit 1
119 esac
120
121 exit 0

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