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

Re: Script to email details not working in cron



Manikandan M <mani.mk1@gmail.com> wrote:

> I couldn't find why the script is not working in cron. Just replaced the
> crontab entry with the following and it worked

> * 9 * * * /bin/bash /user/bin/email-script

This will run the script _every minute_ on the ninth hour. I don't think
this is what you really want.

It should look like this:

0 9 * * * /bin/bash /user/bin/email-script

Also:

You don't need the manually invoke /bin/bash if you just add
"#!/bin/bash" as the first line of your shell script, which Don already
pointed out:

>> > 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
>>
>> If this is actually the script,
>>
>> 1) It's missing #!/bin/sh or #!/bin/bash
>>
>> 2) It's in /home/user/bin/email-script, not /home/user/email-script
>>
>> 3) It may not be executable.

Grüße,
Sven.

-- 
Sigmentation fault. Core dumped.


Reply to: