cancel
Showing results for 
Search instead for 
Did you mean: 

Crontab entries disappeared

SOLVED
Go to solution
Din_1
Frequent Advisor

Crontab entries disappeared

Hi All,

One of my user's crontab entry went empty this morning.All the entries contained for that particular user disappeared. I dont know what happened in the middle.

I do checked in /var/spool/cron/crontabs/user
and /var/adm/cron/crontabs/user, where i do see a 0 byte file. But other user file contain a valid cron entries.

Please help me in solving this issue...

Thanks in advance,
Din
4 REPLIES
Roopesh Francis_1
Trusted Contributor

Re: Crontab entries disappeared

hi,

please check below logs for any entries for this user.
/var/adm/cron/log
/var/adm/syslog/syslog.log

thanks
Sunny123_1
Esteemed Contributor

Re: Crontab entries disappeared

Hi

Look like your crontab file got corrupted for the user.Or someone has remove it


Regards
Sunny
Prashantj
Valued Contributor
Solution

Re: Crontab entries disappeared

Hi Din,

Itâ s difficult to retrieve the crontab entries.
But If you have ignite backup or contab.old file (before editing cronntab file)

Check the
1) crontab file permission.
2) Check crontab.allow file
3) Check .sh_history if anybody enter crontab -r

Action need to be taken

1) check and update the permission
2) check and update corntab.allow file
3) Take a backup before editing crontab file along with date
4) Put the below script, so you have full proof backup of crontab file.
Script

mailto="xxxxxx@xxxxx.com"
for file in `crontab -l | grep -v '^#'| awk '{print $6}'`
do
echo
echo "-------- ${file}" >> /crontabdetails
echo >> /crontabdetails
cat $file >> /crontabdetails
echo >> /crontabdetails
done
mailx -s "Crontab List" xxxxx@xxxx.com < /crontabdetails


Hope this will help

Prashant
Good judgment comes from experience and experience comes from bad judgment.
Din_1
Frequent Advisor

Re: Crontab entries disappeared

Hi Prasanthj,

As you said, i have found a crontab -r command in .sh_history from that user around that time.
But somehow i have managed to restore that particular user's crontab file from yesterday's backup, and now it's working fine.

Thanks for your support.

Thanks and Regards,
Din