unable to start or stop motion with script

view full story

http://ubuntuforums.org – I have the following script that pretty much check for the status of motion daemon and based on that it stop it or start the daemon, I have added the command along with my username to sudoers file so I don't have to run the script with sudo credentials; however, the script is unable to start or stop the service. Code: #!/bin/bash # script to start/stop motion and remove content from file # 11/5/2012 dir=/tmp/motion ps -e | grep motion if [ $? -eq 0 ]; then         #motion is running and need to stop         echo "Stopping motion and removin (Hardware)