Reset Camera using "After snapshot script"

I use a PS EYE camera, and am struggling with that mjpg_streamer freezes up.

I've kinda given up on finding the cause, all google suggestions has been tested other than "buy a better camera"..

If i ssh in and do a "sudo killall mjpg_streamer", it comes back up and stays up for hours.

I tried to make a script called "reset_cam.sh", in order to call it from "After snapshot script" in Octolapse:

#!/bin/bash
sudo killall mjpg_streamer

..which offcourse doesn't work.. How do I make this work?

Have you made it executable?

chmod +x reset_cam.sh

yep, but i think the sudo password is the issue?

from octolapse log:
"sudo: no tty present and no askpass program specified"

^ this
and I'm not sure if this would work without a password.
Test the command in ssh in check if you need it.

This describes how you make sudo commands passwordless

but I'm not sure what you have to put in there for the kill command

edit: might be /bin/killall

which tells what the path of a command is.

pi@octopi:~ $ which killall
/usr/bin/killall
1 Like

Ok, then i have some things to try tomorrow. Thanks!

If someone knows a non-sudo way to reset mjpg streamer, that would be valuable too!

You could add your script to the sudoers file via visudo. That's how I get gphoto2 working for DSLRs without a password. You can also embed the password within your script, though that is probably not a good idea.

1 Like

You can also embed the password within your script, though that is probably not a good idea.

How? I think thats a perfectly fine solution in the mean time, octopi is only visible at LAN, and if someone pokes around in here they can do alot more than fiddling with my printer anyway..