#!/bin/bash

case $1 in
	start)
		echo "Starting webcam..."
		sudo /etc/init.d/lircd stop
		sudo /sbin/rmmod quickcam
		sudo /sbin/rmmod lirc_atiusb
		sudo /sbin/rmmod lirc_dev
		#sudo /sbin/rmmod bttv
		sleep 1
		sudo /sbin/modprobe quickcam
		sleep 1
		echo > /home/n/.caminfo
		echo > /tmp/xmms-info
		camE
		sleep 1
		sudo /sbin/modprobe lirc_atiusb
		sleep 1
		sudo /etc/init.d/lircd start
		#sudo /etc/init.d/lircmd start
		#sudo /sbin/modprobe bttv
		killall camE
		;;
	stop)
		echo "Stopping webcam..."
		killall camE
		scp /home/n/.block.jpg root@web:/www/website/images/webcam.jpg > /dev/null
		echo > /home/n/.caminfo
		;;
	restart)
		echo "Restarting webcam..."
		killall camE
		camE
		;;
	*)
		echo "Usage: $0 [start|stop|restart]"
esac