- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: crontab for certain user doesn't work
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2012 06:32 AM
10-08-2012 06:32 AM
Crontab for certain user doesn't work
Hi, I am unable to create a job for certain user (oracle), this user is in /usr/lib/cron/cron.allow, cron service is running and work for other users (such as root), the crontab file is in /usr/spool/cron/crontabs as expected. The crontab log has entry for each execution but the file is NOT executed.
I inserted to beginning of script:
#!/bin/sh
echo `date` >> /some/path/log
(where /some/path is a path for log file), when I start the script from terminal it create an entry in this log file, it never creates an entry when it is running from cron, therefore the script isn't executed.
Is there a way to check why it happens?
This is a log from cron:
> CMD: /usw/app/oracle/admin/CRMISEF1/statspack/test.sh >> /usw/app/oracle/admin/CRMISEF1/statspack/sh.log 2>/dev/null
> oracle 21019 c Mon Oct 8 15:58:00 METDST 2012
< oracle 21019 c Mon Oct 8 15:58:00 METDST 2012 ts=9
- Tags:
- cron
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2012 07:27 AM
10-08-2012 07:27 AM
Re: Crontab for certain user doesn't work
First, remove the "2>/dev/null" from the end of the cron job specification. By redirecting the standard error output to /dev/null, you are destroying the error message that would tell you more about the problem.
After removing the "2>/dev/null" part, the cron will gather any error messages the script produces and send them as email to the oracle account. (The email file will be /var/mail/oracle by default; if you don't want to use a real email application, you can read it directly with "more" or similar.)
Alternatively, you could replace the "2>/dev/null" part with something like "2>/usw/app/oracle/admin/CRMISEF1/statspack/sh.errorlog", which would redirect the error messages to the file of your choice.
- Tags:
- redirect
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2012 12:34 PM - edited 10-08-2012 12:35 PM
10-08-2012 12:34 PM - edited 10-08-2012 12:35 PM
Re: crontab for certain user doesn't work
>echo `date` >> /some/path/log
(You do know you can just use: date >> /some/path/log)
>it never creates an entry when it is running from cron, therefore the script isn't executed.
Then there must be something wrong with your .profile? You might want to change your line to:
#!/bin/sh -x
(And make sure you don't send stderr to /dev/null as Matti said.)
>< oracle 21019 c Mon Oct 8 15:58:00 METDST 2012 ts=9
This says you got exit status 9.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2012 12:06 AM
10-09-2012 12:06 AM
Re: crontab for certain user doesn't work
Thank you,
I removed the part as you mentioned:
> CMD: /usw/app/oracle/admin/CRMISEF1/statspack/test.sh >> /usw/app/oracle/admin/CRMISEF1/statspack/sh.log
> oracle 22478 c Tue Oct 9 10:02:00 METDST 2012
< oracle 22478 c Tue Oct 9 10:02:01 METDST 2012 ts=9
/export/home/oracle$ mail
No mail.
there is no entry in /usw/app/oracle/admin/CRMISEF1/statspack/sh.log please note that test.sh contains only 2 lines:
#!/bin/sh
date >> /usw/app/oracle/admin/CRMISEF1/statspack/sh.log
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2012 12:35 AM
10-09-2012 12:35 AM
Re: crontab for certain user doesn't work
> /export/home/oracle$ mail
> No mail.
Has someone redirected the mail of the oracle user somewhere else?
Does /export/home/oracle/.forward file exist? If it exists, read the file to find out where the oracle user's mail goes.
Also check /etc/mail/aliases. Does it mention "oracle"? If you modify /etc/mail/aliases, remember to run "newaliases" after modifications.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2012 12:53 AM
10-09-2012 12:53 AM
Re: crontab for certain user doesn't work
cofftz01:/#mailx oracle
Subject: test
this is test
.
EOT
/export/home/oracle$ mailx
No mail for oracle
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2012 06:10 AM
10-09-2012 06:10 AM
Re: crontab for certain user doesn't work
Please run "bdf". Is your /var or /tmp filesystem 100% full?
If /var is full, it will certainly cause email issues, and might cause some issues to cron too. Since the system logs are written to /var by default, having it 100% full would mean your logs may be incomplete, making troubleshooting harder.
If /tmp is full, it will cause many things to fail.
You might also want to look at /var/adm/syslog/mail.log, to get more information on email errors.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2012 09:26 AM
10-09-2012 09:26 AM
Re: crontab for certain user doesn't work
>there is no entry in /usw/app/oracle/admin/CRMISEF1/statspack/sh.log please note that test.sh contains only 2 lines:
Redirect stderr to the same logfile in crontab, that way you don't need mail: 2>&1
Also add -x as I mentioned.
>date >> /usw/app/oracle/admin/CRMISEF1/statspack/sh.log
No need to redirect this if the cron output is also going there.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2012 04:50 AM
10-10-2012 04:50 AM
Re: crontab for certain user doesn't work
/tmp is 70%
/var is 74%
Log from cron after changing the path:
> CMD: /usw/app/oracle/admin/CRMISEF1/statspack/test.sh 2>&1
> oracle 29430 c Wed Oct 10 12:08:00 METDST 2012
< oracle 29430 c Wed Oct 10 12:08:00 METDST 2012 ts=9
I didn't change /bin/sh to /bin/sh -x but I doubt it would do anything since the script is clearly not even loaded
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2012 05:55 AM
10-10-2012 05:55 AM
Re: crontab for certain user doesn't work
Hi petrbena,
Are there emails for the cronjobs of your other users?
What shells are listed in /etc/shells?
Have you tryed to only enter a command in the crontab instead of a script? (46 14 * * * date > /tmp/foo )
How did you execute the script from the CLI and as which user?
Do the environment variables (exp. $PATH) of user oracle look fine?
What are the ownership and permissions of your scriptfile?
Bye
Ralf