[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Script to email details not working in cron



Thanks for the quick response Patrick. I have given the full path for all the executables in the script. Still i'm not getting the email. The first line of the script works which updates the details-file. The third line of the script works which updates the status of the email operation. Both the details-file and mail-status are getting the updated at the time mentioned in the cron. i think this indicated that the script is being executed, but not sure why ssmtp command is not working.
 
The script still works if i execute it manually.

On Fri, Jan 2, 2015 at 6:48 PM, Patrick Wiseman <pwiseman@gmail.com> wrote:
On Fri, Jan 2, 2015 at 1:39 PM, Manikandan M <mani.mk1@gmail.com> wrote:
> Hi,
>
> I have written a small script to email (using ssmpt) some details, and
> scheduled it in crontab. The script is running as per time mentioned in the
> cron but ssmtp is not sending the mail. please find the details below.
>
> user@host ~ $ cat bin/email-script
> /home/user/bin/actual-script > ~/details-file
> ssmtp username@gmail.com < ~/details-file
> echo $? > ~/email-status
>
> The crontab entry is as below
> 0 9 * * * /home/user/email-script
>
> When i execute the script manually i'm getting the email from ssmtp. but
> when the script is executed using cron i'm not getting the email. I checked
> the status of the ssmtp and the status is 127.
>
> Please can anyone suggest what might be wrong in my setup.

cron operates in a restricted environment, so what works in an
ordinary user's environment will often not work in cron. Try giving
the full path to your executable in the script.

Patrick


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: [🔎] CAJVvKsO5BRnij2sCLPUoS4Fh_xdmpTaAnVRYfb5SdJwrBhRC8g@mail.gmail.com" target="_blank">https://lists.debian.org/[🔎] CAJVvKsO5BRnij2sCLPUoS4Fh_xdmpTaAnVRYfb5SdJwrBhRC8g@mail.gmail.com



Reply to: