~hww3/caudium

ref: 93d5a75fba08db71b832716377276978cdd7888d caudium/tools/caudium-rc_script.in -rw-r--r-- 3.6 KiB
93d5a75fWilliam Welliver storage: method "None" was missing stop function. should fix error on shutdown 1 year, 1 month ago
                                                                                
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
#!/bin/sh
#
# $Id$
#
# init.d script for Caudium. Set the variables below to something fitting..
# This is only an example script.
#
#############

#
# This is actually for Debian, but might come useful
#
if [ -f /etc/default/caudium ]; then
    . /etc/default/caudium
fi

# The server directory where the 'start' script is located.
#
caudiumhome=${caudiumhome:-@CAUDIUM_SERVERDIR@}

# Set this to something unique to be able to stop, reload and restart
# with this init script. It will override the setting in the config
# interface. '0' is typically replaced with the uid.
#
pidfile=${pidfile:-/tmp/caudium_pid}

# Set these to kill all processes owned by wwwuser on stop. Useful to
# reap CGI scripts.
#
killallwww=${killallwww:-no}
wwwuser=${wwwuser:-www}

umask 022

# If you want to start with another configuration directory:
#
# configdir=dirname

# If you want to start with another log directory:
#
# logdir=dirname

# Here you can add extra flags to the start script, like enabling or
# disabling threads.
# 
# flags="--without-threads"
# flags="--with-threads"

### You should not _have_ to change anything below here...

test -n "$pidfile" && flags="$flags --pid-file=$pidfile"
test -n "$configdir" && flags="$flags --config-dir=$configdir"
test -n "$logdir" && flags="$flags --log-dir=$logdir"

case $1 in
	'start')
          echo "Starting Caudium from $caudiumhome..."
	  if [ -z "$pidfile" ]; then
	    echo "Warning: No pid file set - cannot stop or reload."
	  elif [ -f "$pidfile" ]; then
	    read pid < $pidfile
	    if kill -0 $pid ; then
	      echo "Caudium is already running."
	      exit 0
	    fi
	    rm -f $pidfile
	    if [ -f "$pidfile" ]; then
	      echo Cannot remove pid file $pidfile
	      exit 1
	    fi
	  fi
	  if [ -x "$caudiumhome/start-caudium" ]; then
 	    cd $caudiumhome
	    ./start-caudium $flags
            RET=$?
            if [ $RET != 0 ]; then
              echo "Failed ($RET)"
            else
              echo "Done."
            fi
          else
            echo "I cannot find the Caudium dir '('$caudiumhome')'"
	  fi
	;;

	'reload')
	  if [ -z "$pidfile" ] ; then
	    echo "No pid file set."
	    exit 1
	  fi
	  echo "Reloading configurations..."
	  if [ -f $pidfile ] ; then
	    read pid < $pidfile
	    kill -HUP $pid || kill 1 $pid
	    exit 0
	  fi
	  echo "Caudium doesn't seem to be running."
	  ;;

	'restart')
	  if [ -z "$pidfile" ] ; then
	    echo "No pid file set."
	    exit 1
	  fi
	  echo Restarting Caudium...
	  if [ -f "$pidfile" ] ; then
	    read pid < $pidfile
	    kill -INT $pid || kill 2 $pid
	    rm "$pidfile"
	    echo Done.
	    exit 0
	  fi
	  echo "Caudium doesn't seem to be running."
	  echo Starting a new Caudium in $caudiumhome...
	  if [ -x "$caudiumhome/start-caudium" ]; then
 	    cd $caudiumhome
	    ./start-caudium $flags
            RET=$?
            if [ $RET != 0 ]; then
              echo "Failed ($RET)"
            else
              echo "Done."
            fi
          else
            echo "I cannot find the Caudium dir '('$caudiumhome')'"
	  fi
          echo "Done."
	;;

	'stop')
	   if [ -z "$pidfile" ] ; then
	     echo "No pid file set."
	     exit 1
	   fi
           echo "Stopping Caudium..."
	   if [ -f $pidfile ] ; then
	     if kill `cat $pidfile` ; then
               echo Caudium stopped.
	     fi
	     rm $pidfile
	   else
	     echo "Caudium doesn't seem to be running."
           fi
           # Get all the CGI scripts... :-)
           if [ x$killallwww = xyes ] ; then
	     echo Killing all programs running as the $wwwuser user.
             su $wwwuser -c "kill -9 -1"
           fi
	;;

	*)
          echo "Syntax: $0 [start|stop|restart|reload]"
          ;;
esac

exit 0