Operating System - HP-UX
1830045 Members
9751 Online
109998 Solutions
New Discussion

SAM deleted crontab, possible recovery?

 
Janko Meskovski
Occasional Contributor

SAM deleted crontab, possible recovery?

When adding an automated backup SAM reported "error on previous line; unexpected character found in line." when adding the crontab entry and ended up with an empty crontab file.

Looking at the SAM log and /usr/sam/lbin/cron_change I don't see if the crontab was backed up before doing these changes. Is there any possibility of restoring the crontab file?

I also have a very recent make_tape_recovery backup so if its possible to get the crontab file from there it would be great.

Quick responses will be greatly appreciated. ty
10 REPLIES 10
Slawomir Gora
Honored Contributor

Re: SAM deleted crontab, possible recovery?

Hi,

you can use tape from make_tape_recovery

mt -f /dev/rmt/0mn fsf 1
tar xvf /dev/rmt/0m var/spool/cron/crontabs

Robert-Jan Goossens
Honored Contributor

Re: SAM deleted crontab, possible recovery?

Hi,

Check /var/cron/backup

Regards,
Robert-Jan
RAC_1
Honored Contributor

Re: SAM deleted crontab, possible recovery?

Slight correction in ealier post.

mt -f /dev/rmt/0mn fsf 1
tar xvf /dev/rmt/0mn var/spool/cron/crontabs

You will have to user no rewind device on tar command.

Anil
There is no substitute to HARDWORK
Slawomir Gora
Honored Contributor

Re: SAM deleted crontab, possible recovery?

Hi RAC

there is no need to use /dev/rmt/0mn by tar insted of /dev/rmt/0m :)

Important is to use "mn" by mt command.
Janko Meskovski
Occasional Contributor

Re: SAM deleted crontab, possible recovery?

Slawomir - unfortunately /var/spool/cron/crontabs seems not to have been backed up with make_tape_recovery. Should it have been in the archive by default?

Robert-Jan - there is no /var/cron/ or /var/adm/cron/backup.

Is it possible that SAM (or rather cron_change) executes "crontab -r" without backuping the crontab file?!? :(

Slawomir Gora
Honored Contributor

Re: SAM deleted crontab, possible recovery?

Hi,

on my tape there is var/spool/cron

look at directory:
/var/opt/ignite/recovery
and check file
grep "/var/spool/cron" arch.include

try to check tape by:

mt -f /dev/rmt/0mn fsf 1
tar tvf /dev/rmt/0mn | grep "var/spool/cron"

don't use /var/spool/cron but var/spool/cron

Ps,

I have cloned a lot of servers by make_recovery
and there was no problem with corntab.
Janko Meskovski
Occasional Contributor

Re: SAM deleted crontab, possible recovery?

Thank you for your answers. Unfortunately I wasn't able to restore the crontab from backup so I ended reconstructing it from the cron logs.

Slawomir - ty, I will check why make_tape_recovery didn't backup the crontab file.
MarkSyder
Honored Contributor

Re: SAM deleted crontab, possible recovery?

Ignite (on my systems at least) by default backs up only part of vg00 - /var and /opt are excluded. This might explain why cron wasn't on your backup. I always explicitly include the missing filesystems.

Mark Syder (like the drink but spelt different)
The triumph of evil requires only that good men do nothing
Steve Post
Trusted Contributor

Re: SAM deleted crontab, possible recovery?

Look in the forums for stuff you want to have a copy of.

I have a paper copy of the main crontabs on my boxes.
crontab -l
vgdisplay -v
bdf
cat /etc/fstab
cat /etc/hosts
netstat -in
netstat -i
ioscan -fun
lvlnboot -v
....and many more.
This can be very VERY useful on a maintenance day.

steve
steve
Geoff Wild
Honored Contributor

Re: SAM deleted crontab, possible recovery?

THis doesn't help you now - but will in the future...

Install cfg2html

http://come.to/cfg2html

It documents your server, inculding root's crontab.

Run it from cron:

# Run the cfg2html scripts,
35 6 1 * * cd /opt/cfg2html ; /opt/cfg2html/cfg2html_hpux.sh >/dev/null 2>&1

Then copy the html file to a central location...

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.