#!/bin/sh # # chkconfig: 345 99 10 # description: Starts and stops the LiveCamera service. # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network PROGNAME1=ffserver PROGNAME2=ffmpeg PROGRAM1="/usr/bin/ffserver -f /etc/ffserver.conf" PROGRAM2="/usr/bin/ffmpeg -f oss -i /dev/dsp -vol 512 -f video4linux2 -s 640x480 -r 6 -b 1024k -i /dev/video0 http://localhost:8090/feed1.ffm" # Check that networking is up. [ ${NETWORKING} = "no" ] && exit 0 # See how we were called. case "$1" in start) echo -n "Starting LiveCamera services: " ${PROGRAM1} > /dev/null 2>&1 & if [ $? != 0 ]; then exit 1 fi sleep 2 ${PROGRAM2} > /dev/null 2>&1 & if [ $? != 0 ]; then killproc ${PROGNAME1} exit 1 fi echo "" ;; stop) echo -n "Shutting down LiveCamera services: " killproc ${PROGNAME2} killproc ${PROGNAME1} echo "" ;; restart) echo -n "Restarting LiveCamera services: " $0 stop $0 start echo "done." ;; *) echo "Usage: livecam {start|stop|restart}" exit 1 esac exit 0