Old crontab file reflected after server reboot


 
Thread Tools Search this Thread
Operating Systems HP-UX Old crontab file reflected after server reboot
# 1  
Old 09-18-2012
Old crontab file reflected after server reboot

Hi All,

We are working on HP_UNIX.
I am facing a strange problem regarding crontab in our unix environment.Whenever a server reboot takes place on our server the old crontab gets reflected due to which several scripts which were earlier uncommented starts running causing a huge problem .Is there any solution this as to why this is happening and how it can be avoided?


Thanks in advance
# 2  
Old 09-18-2012
you need to become root to do this:

1. who owns the crontab? this is hpux, I do not remember where the actual file lives - I THINK it may be
Code:
/var/spool/cron/crontabs/[username]

Please show the output of:
Code:
# note: use correct directory
find /var/spool/cron/crontabs -exec ls -l {} \;

# 3  
Old 09-19-2012
Exactly: when a server reboots, it reloads what is in /var/spool/cron/crontabs/ You should never leave anything unused in there... It is not to say you should delete without taking any precaution... I create a .save (as root and 750) directory one level above and mv what is unwanted in .save, the same I historize the cron files also in case of corruption or disagreement with production e.g. How come this job never finish when it used to? If you can prove someone changed the schedule, your out of trouble...
This is important to be done when you are going through a upgrade/update process where you risk rebooting a few times during one-two days : MOVE all cron file out or /var/spool/cron/crontabs while in maintenance!
# 4  
Old 09-20-2012
Hi vbe,

Thanks for your reply.
Generally we plan reboot every 3 months ..thats when we get this problem.
Also,can elaborate more on below :

"I create a .save (as root and 750) directory one level above and mv what is unwanted in .save, the same I historize the cron files also in case of corruption or disagreement with production e.g. How come this job never finish when it used to? If you can prove someone changed the schedule, your out of trouble...
This is important to be done when you are going through a upgrade/update process where you risk rebooting a few times during one-two days : MOVE all cron file out or /var/spool/cron/crontabs while in maintenance!"

with example....
# 5  
Old 09-20-2012
I had in older times 2 very bad issues with cron...
Since,I changed my way of doing, see above...I taught my cron users to be safe and not use anymore or at their own risk crontab -e and have a cronfile in their home directory and use -l option, it allows them to before complaining, compare what it is actually in cron v.s. their cronfile if different find out why... the ile itself should have the name of the cronfile and where it is otherwise if I pass and dont find that information I remove...
Now Im going in maintenance, I mv * to .save (no sentimetalism...) and od my job...
When finished, you have 2 options:
a) You put back ( not preferred except for root (but I know why, for root that is...)).

b) you tell your folk, ( you have their names in the cronfiles, see...) they can reload...
They can do it for they are the owners and have their files in $HOME (if they did follow the rules...) or they must know where they have the file...
This is preferable because it forces them to look at they schedule again to see if they were not affect timewise by the maintenance...
Is it important? depending where you work, yes... the unpredictable behaviour can make you loose $$$$$$$$ ...
In the second case you are initialysing your schedule, its from now-- on
In the first case, you are what????
# 6  
Old 09-20-2012
Hi Vbe,

Thanks for quick reply..
In short u mean I should follow below steps :

1) become the root and take backup of crontab file
e.g : I am user "xyz".Now my crontab file is located in /var/spool/crontabs/"xyz".

2) In order to modify this xyz file I should first become root(how to ,I don't know? I guess our server team will be able to help)
Then I should take backup of this crontab file in my $HOME dir ..say xyz2..

3) Then I should modify the original xyz file (say mod_xyz) .So now I have backup of my crontab file in case something goes wrong.

Please correct me wherever I am wrong. Also,which file out of xyz or mod_xyz will be reflected in crontab after server reboot.
# 7  
Old 09-21-2012
Read the man pages of crontab ( 1) then perhaps cron (1M)
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Server reboot

Hi, The server got rebooted and below messages can be seen in /var/log/messages Sep 7 10:49:12 minersville kernel: Call Trace: <IRQ> <ffffffff80167420>{__alloc_pages+796} Sep 7 10:49:12 minersville kernel: <ffffffff80182814>{kmem_getpages+106} <ffffffff80183c16>{fallback_alloc+304}... (3 Replies)
Discussion started by: admin_db
3 Replies

2. Solaris

Validate mountpoints on solaris server after server reboot

Hi, anyone please let us know how to write shell script to find the missing mountpoints after server reboot. i want to take the mountpount information before server reboot, and validate the mountpoints after server reboot if any missing.please let us know the shell script from begining to end as... (24 Replies)
Discussion started by: VenkatReddy786
24 Replies

3. UNIX for Dummies Questions & Answers

What crontab is in effect after reboot

A basic cron question and I hope I explain it enough. If a person creates a file to use with cron and issues the followin command: crontab I understand this will set the cron entries to whatever is in . However, if we now edit the crontab with: crontab -e and save, how does cron... (3 Replies)
Discussion started by: niswonp
3 Replies

4. Red Hat

when users ftp to server the timezone reflected is UTC but the server is set to TZ in localtime

Guys, Need your help coz my server runs in local time GMT +8, but when client use ftp and login, the resulting timestamp seen in each file is in UTC format. We need to set that the time should be the same as GMT +8 when in ftp session. I am using RHEL 5.3. root@]# ll total 1740... (2 Replies)
Discussion started by: shtobias
2 Replies

5. SCO

copy crontab file from backup server

Hi, I did a terrible mistake of issuing crontab -r command which deleted my table on a new installation. Is there any way i can transfer the table from an existing unix box. Regards, Joseph:confused: (4 Replies)
Discussion started by: njoroge
4 Replies

6. UNIX for Advanced & Expert Users

CRONTAB does not run since reboot

Hi, we reboot our Linux server yesterday and since then (specialy last night) no job from crontab has run. Any idea ? What should I look for to investigate? Many thanks. (5 Replies)
Discussion started by: big123456
5 Replies

7. Solaris

Reboot the server through console

Hi All, I want to know the procedure like if server is down, i want to reboot the server through console ($rsc or $sc prompt).Could you please help me out. I would really appreciate your cooperation. thanks for understanding regards krishna (5 Replies)
Discussion started by: murthy76
5 Replies

8. AIX

IP setting changes after server reboot

I've recently changed my gateway setting using SMIT. Everything went fine except that the gateway setting kept reverting back to the old one everytime I reboot the server. I'm on AIX 5.2 running p-Series. Thanks for any info. (3 Replies)
Discussion started by: dereklow
3 Replies

9. UNIX for Advanced & Expert Users

server reboot

hi all, :) for a reboot of sun box for patch installation i would like to know where do the reboot logs apart from /var/adm/messages and patch run messages would be available, i would like to know the sequence of messages logged in the file like requesting the users to log out sending a... (1 Reply)
Discussion started by: matrixmadhan
1 Replies

10. Shell Programming and Scripting

Server Reboot Alert

I want to get an email alert from a cronjob when a server got rebooted unexpectedly. Please help. Thanks! :confused: (2 Replies)
Discussion started by: angloi
2 Replies
Login or Register to Ask a Question