Jim Long | 27 Jul 2012 19:19

Re: using sudo in an alert

On Fri, Jul 27, 2012 at 05:36:41PM +0100, Andrew Pattison wrote:
> I used the -m flag with su to change to the smokeping user and my script
> ran fine using sudo on the command line. The test of writing to /tmp did
> not work due to file permissions, but creating a file in another place that
> I had opened up the permissions on worked and showed the user and group and
> smokeping:smokeping. I have a bang line in the script and it runs when I
> call it on the command line as ./adsl_alert.py. Maybe the line in my Alerts
> file is wrong? Here it is:
> 
> to = |/usr/bin/sudo /home/pi/adsl_alert.py
> 
> Thanks
> 
> Andrew.

And just for paranoia, what is the output from:

ls -ld /home/pi /home/pi/adsl_alert.py

I don't use alerts in smokeping, so I can't say about the syntax,
but you might try quotes around the whole thing, like

to = "|/usr/bin/sudo /home/pi/adsl_alert.py"

If that still doesn't help, then to continue with the debugging,
I would suggest this:

Comment out your smokeping alert line, and change it to be just a
dummy test script.  Something like

(Continue reading)


Gmane