|
a/web/init/scweb-service |
|
b/web/init/scweb-service |
|
... |
|
... |
281 |
exit 1
|
281 |
exit 1
|
282 |
fi
|
282 |
fi
|
283 |
}
|
283 |
}
|
284 |
|
284 |
|
285 |
start() {
|
285 |
start() {
|
|
|
286 |
#echo "START"
|
286 |
if ! test -f $PIDFILE; then
|
287 |
if ! test -f $PIDFILE; then
|
|
|
288 |
#echo "DORUN?"
|
|
|
289 |
[ "$SCWEB_DORUN" = "yes" ] || exit 0
|
|
|
290 |
#echo "USER SET?"
|
287 |
[ -z "$SCWEB_USER" ] && exit 0
|
291 |
[ -z "$SCWEB_USER" ] && exit 0
|
288 |
begin_msg "Starting scweb Songcast control web interface";
|
292 |
begin_msg "Starting scweb Songcast control web interface";
|
289 |
check_single_user $SCWEB_USER
|
293 |
check_single_user $SCWEB_USER
|
290 |
echo SCWEB_USER $SCWEB_USER single ok
|
294 |
#echo SCWEB_USER $SCWEB_USER single ok
|
291 |
PARAMS=""
|
295 |
PARAMS=""
|
292 |
[ -n "$SCWEB_ADDRESS" ] && PARAMS="$PARAMS -a $SCWEB_ADDRESS"
|
296 |
[ -n "$SCWEB_ADDRESS" ] && PARAMS="$PARAMS -a $SCWEB_ADDRESS"
|
293 |
[ -n "$SCWEB_PORT" ] && PARAMS="$PARAMS -p $SCWEB_PORT"
|
297 |
[ -n "$SCWEB_PORT" ] && PARAMS="$PARAMS -p $SCWEB_PORT"
|
294 |
|
298 |
|
295 |
echo start_daemon $SCWEB_USER $binary $PARAMS
|
299 |
#echo start_daemon $SCWEB_USER $binary $PARAMS
|
296 |
start_daemon $SCWEB_USER $binary $PARAMS > /dev/null 2>&1
|
300 |
start_daemon $SCWEB_USER $binary $PARAMS > /dev/null 2>&1
|
297 |
# ugly: wait until the final process has forked
|
301 |
# ugly: wait until the final process has forked
|
298 |
sleep .1
|
302 |
sleep .1
|
299 |
PID=`ps ax | egrep 'python .*/scweb-standalone' | grep -v grep | awk '{print $1}'`
|
303 |
PID=`ps ax | egrep 'python .*/scweb-standalone' | grep -v grep | awk '{print $1}'`
|
300 |
if [ -n "$PID" ]; then
|
304 |
if [ -n "$PID" ]; then
|
|
... |
|
... |
303 |
succ_msg
|
307 |
succ_msg
|
304 |
else
|
308 |
else
|
305 |
RETVAL=1
|
309 |
RETVAL=1
|
306 |
fail_msg
|
310 |
fail_msg
|
307 |
fi
|
311 |
fi
|
|
|
312 |
else
|
|
|
313 |
echo "Pidfile $PIDFILE already exists" 1>&2
|
|
|
314 |
fi
|
308 |
fi
|
315 |
|
309 |
return $RETVAL
|
316 |
return $RETVAL
|
|
|
317 |
}
|
|
|
318 |
|
|
|
319 |
scwebpid()
|
|
|
320 |
{
|
|
|
321 |
echo `ps ax | grep 'python.*scweb-standalone' |grep -v grep | \
|
|
|
322 |
awk '{print $1}'`
|
310 |
}
|
323 |
}
|
311 |
|
324 |
|
312 |
stop() {
|
325 |
stop() {
|
313 |
if test -f $PIDFILE; then
|
326 |
if test -f $PIDFILE; then
|
314 |
begin_msg "Stopping scweb web interface";
|
327 |
begin_msg "Stopping scweb web interface";
|
315 |
killproc $binary
|
328 |
|
|
|
329 |
RPID=`scwebpid`
|
|
|
330 |
[ -n "$RPID" ] && kill "$RPID"
|
316 |
RETVAL=$?
|
331 |
RETVAL=$?
|
317 |
if ! pidof $binary > /dev/null 2>&1; then
|
332 |
|
|
|
333 |
RPID=`scwebpid`
|
|
|
334 |
if test -z "$RPID"; then
|
318 |
rm -f $PIDFILE
|
335 |
rm -f $PIDFILE
|
319 |
succ_msg
|
336 |
succ_msg
|
320 |
else
|
337 |
else
|
321 |
fail_msg
|
338 |
fail_msg
|
322 |
fi
|
339 |
fi
|