#!/bin/bash # Startup script for fswebcam # # chkconfig: 2345 95 05 # description: Grab image from webcam # Source function library. . /etc/rc.d/init.d/functions [ -x /usr/local/bin/fswebcam ] || exit 0 [ -e /etc/sysconfig/fswebcam ] && . /etc/sysconfig/fswebcam prog="fswebcam" start() { echo -n $"Starting $prog: " if [ 'x$WEBCAM_USER' == 'x' ]; then echo 'Please set WEBCAM_USER variable.' exit 1 fi chmod +rw /dev/video0 daemon --user=$WEBCAM_USER /usr/local/bin/fswebcam $OPTIONS RETVAL=$? echo return $RETVAL } stop() { if test "x`pidof fswebcam`" != x; then echo -n $"Stopping $prog: " killproc fswebcam echo fi RETVAL=$? return $RETVAL } case "$1" in start) start ;; stop) stop ;; status) status fswebcam ;; restart) stop start ;; condrestart) if test "x`pidof fswebcam`" != x; then stop start fi ;; *) echo $"Usage: $0 {start|stop|restart|condrestart|status}" exit 1 esac exit $RETVAL