Operating System - HP-UX
1833828 Members
2433 Online
110063 Solutions
New Discussion

Re: crontab with csh and sh scripts

 
Erwin Inauen
New Member

crontab with csh and sh scripts

Hi all
I submit a job in crontab as user A and get a nice mail when the script has finished successfully or when it aborts. Submitting a job as user B, I do not get a mail. How come? I don't use any redirection in the script or the crontab entry (such as >/dev/null 2>&1).

Thanks
Erwin
7 REPLIES 7
Simon Hargrave
Honored Contributor

Re: crontab with csh and sh scripts

Is user B allowed to run cron jobs? (are they listed in /var/adm/cron/cron.allow)

Can user B actually receive emails?

# echo test | mail userA
# echo test | mail userB

Can you see evidence the job ran in the cron log /var/adm/cron/log

Can you see any evidence of an attempt to email in /var/adm/syslog/mail.log?
Alex Lavrov.
Honored Contributor

Re: crontab with csh and sh scripts

Try to use it and redirect all the output (stdout/stderr) to some log file and check if there are error messages.

Probably some permissions issue and under user B script fails to run.

Alex.
I don't give a damn for a man that can only spell a word one way. (M. Twain)
Muthukumar_5
Honored Contributor

Re: crontab with csh and sh scripts

Before doing cron schedule, do it manually.

echo "hai erwin from $USER @ $(hostname)" | mail userb

It is good thing to redirect jobs log into /dev/null or some log file.

hth.
Easy to suggest when don't know about the problem!
harry d brown jr
Honored Contributor

Re: crontab with csh and sh scripts

Does USERB have a .forward file in their home directory?

Can you post the mail command you are issuing (& the crontab entry)?

live free or die
harry d brown jr
Live Free or Die
Erwin Inauen
New Member

Re: crontab with csh and sh scripts

Thanks for your various replies. I've run the job by hand and it work well. Also, user B has an entry in at.allow and cron.allow files.
Last but not least, this is the entry in the cron log:
> CMD:/pp11/sybase/dba/permissions/permsfile.sh
> sybpp 9029 c Wed May 18 09:35:00 METDST 2005
< sybpp 9029 c Wed May 18 09:35:01 METDST 2005 rc=127
The script is definitely being executed. Our Sysadmin assures that user B can receive mail.

Rgs,
Erwin
Erwin Inauen
New Member

Re: crontab with csh and sh scripts

Hi all
I just found the problem: user B is an alias to, say user C; user C receives the messages, but not user B.
Thanks for your help again, maybe I'll have more followup questions later on to cron that I'll post in a separate thread.

Rgs,
Erwin
Gopi Sekar
Honored Contributor

Re: crontab with csh and sh scripts

check whether MAILTO variable is given in the crontab. define this variable to the email id where you want outputs to be sent to
Never Never Never Giveup