Cron task not starting

The following is an entry in crontab:

MAILTO=abc@gmail.com
45 14 * * * /home/user/simple.sh

I also did chmod +xon simple.shBut crontab does not start, it does not even send an email.

pgrep cronshows id. I also tried bouncing on a Coke. But no luck! Can someone please point out the error here.

A simple .sh script is:

#! /bin/bash
echo hello

thanks

+4
source share
3 answers

Since you are executing echoa cron script in a job, you need to write its output somewhere.

In your mode shebangand the file (with chmod +x) everything is in order, so this is not a problem, and work without /bin/shshould work fine.

, cron.log ( )

* * * * * /home/user/simple.sh >> /home/user/cron.log

, cron , .

(, postman, mutt ..), cron .

+6

, . , , script, /bin/sh ( , which sh):

45 14 * * * /bin/sh /path/to/script/simple.sh
+4

, 1 .sh script:

#! /bin/bash

#!/bin/bash

, , ( # ).

, , cron- /bin/sh

0
source

All Articles