which tells me that the command has run, but no email has been received. The log file gets created, but its empty.
where as when I run the script by itself, the email is received.
the permissions of the file maildispatcher.sh are the following:
"This is the good place when you want to create cron job rule for your package and you want exact date/time of execution. Your crontab rule could be normal file,symlink or hardlink. It have to be owned by root (also write allowed only for root) and not executable. "
That is about the the defenition file in the /etc/cron.d directory and not about the file/command you want to execute.
The file you want to execute, must be executable (surprise) for the user executing it. In short, when the owner is root, the x-bit must be set for the owner of the file.
And when the file is a scipt, do not forget the shebang (e.g.
On 2014-09-11 22:26, harbir linuxuser wrote:
>
> I have created a cron job in the
> /etc/cron.d/dispatchingEmail_I
>
>
>
>
> content of the dispatchingEmail_I is:
>
> Code:
> --------------------
> 54 19 * * * root /home/harbir/project/L_ocalRepository/smallworks/maildispatcher.sh >> /tmp/try1.log
> --------------------
If it is going to run as root, why is the script hosted by user
“harbir”? It should be in “/root/bin/”, or maybe “/usr/local/bin/”.
> The permissions of the above cron file are the following:
>
>
> Code:
> --------------------
> -rw-r–r-- 1 root root 84 Sep 11 19:52 dispatchingEmail_I
> --------------------
Ok.
> when I check /var/log/messages I can see an entry
>
>
> Code:
> --------------------
> 2014-09-11T19:54:01.761269+10:00 linux-gn77-PC /USR/SBIN/CRON[4109]: (root) CMD (/home/harbir/project/L_ocalRepository/smallworks/maildispatcher.sh)
> --------------------
Ok.
> which tells me that the command has run, but no email has been received.
>
> The file you want to execute, must be executable (surprise) for the user
> executing it. In short, when the owner is root, the x-bit must be set
> for the owner of the file.
Looking at his post, it is executable by the owner:
Hi all, I have found the issue, its nothing to with the cron job. The script file that I was trying run was refering to the wrong class path, and hence the java program was not running, I will do extra checking next time. Thank you all for helping.