Operating System - HP-UX
1822895 Members
3480 Online
109645 Solutions
New Discussion юеВ

crontab disappears after boot

 
Michael_356
Frequent Advisor

crontab disappears after boot

Hi all,

i discovered a strange problem on some (not all) of my machines. All machines are identical in configuration, running HP-UX 11.00 in MC/SG-clusters and with mirrored disks.
But on some of this machines roots crontab disappears after reboot. I can't find any message about that, syslog and rc.log doesn't show unusual values.
This crontab contains contains jobs for security-scripts and scripts for truncating large files (auditingfiles etc.).
The machines runs in malfunction if this jobs doesn't run periodically.

i don't know, why this file will removed and where it goes to.

What could be the next steps to check what happened?

I need your help to find a solution for that.

Thanks in advance
Michael
6 REPLIES 6
Sridhar Bhaskarla
Honored Contributor

Re: crontab disappears after boot

Hi Michael,

One the reason that I can think of is a startup job that is messing up the cronjobs. Do the following

#cd /sbin/init.d
#grep crontab *

See if you get anything. Unfortunately init.d scripts may in turn call scripts from another directory in which case you will have to find them manually. OS default scripts won't do this. May one of your customized scripts are doing it.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Borislav Perkov
Respected Contributor

Re: crontab disappears after boot

Hi,
If this happens after switchover of the cluster the crontab is on standby node and you cannot see it, then you can only copy the crontab to the active node.
Regards,
Borislav
Michael_356
Frequent Advisor

Re: crontab disappears after boot

@Sridhar:
Used this command before i wrote my message here, there's no appearance for crontab in /sbin/init.d
Also no appearance in other scripts, only the crontab for the main-user will be loaded by the MC/SG startup script.

@Borislav:
All machines running with identical parameters, roots crontab is identical on !all! nodes

Michael
Borislav Perkov
Respected Contributor

Re: crontab disappears after boot

Try to find in startup scripts, /sbin/init.d, is there something that disables the crontab or remove it from the system.
Sridhar Bhaskarla
Honored Contributor

Re: crontab disappears after boot

Michael,

As far as I know, there is no system default script that will remove the crontab file. As I said before, there may be another script indirectly run from another location by a script in /sbin/init.d. In this case 'grepping' in that directory may not list it.

Coming to the solution - You can keep a copy of your crontab always in root's home directory. You can produce it by simply running 'crontab -l > /root/crontab.root'. Have a startup script in /sbin/init.d that will read crontab.root after 'cron' is up. "crontab /root/crontab.root" will do it. Meanwhile you look for the problem.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Borislav Perkov
Respected Contributor

Re: crontab disappears after boot

You can also check /var/adm/cron/cron.allow and /var/adm/cron/cron.deny files to resolve the problem.
Regards