hello,
I'm on Ubuntu 18.04.5 LTS and I wrote a script to take pictures and send an email with ssmtp when someone removes a USB device from my computer.
the udev rule works fine and execute the script but only the "picture taking" part works, not the email sending.
when I execute the script myself in a terminal, everything goes well, the pictures are taken, the email is sent. It just doesn't work when it is triggered by the udev rule.
the rule:
Code:
ACTION=="remove", SUBSYSTEM=="usb", RUN+="/home/jensen/Documents/script.sh"
the script:
Code:
#!/bin/bash
cd /home/jensen
fswebcam -r 640x480 --jpeg 85 webcamshot1.jpg
fswebcam -r 640x480 --jpeg 85 webcamshot2.jpg
fswebcam -r 640x480 --jpeg 85 webcamshot3.jpg
echo "Subject: test mail" | /usr/sbin/sendmail -v testmail@gmail.com
and the ssmtp config:
Code:
root=**********@gmail.com
mailhub=smtp.gmail.com:587
hostname=jensen
AuthUser=**********@gmail.com
AuthPass=**********
UseSTARTTLS=yes
UseTLS=yes
FromLineOverride=yes
I tried changing the permissions on the script file with chmod but nothing works. what could be the issue ?
Another precision, I can create a new folder with my script with mkdir but if I try the following code, nothing happen
Code:
"spd-say 'something'
Bookmarks