1820390 Members
3569 Online
109623 Solutions
New Discussion юеВ

cron job memory

 
SOLVED
Go to solution

cron job memory

Hello
I removed a user from a large number of HP-UX 11.00 and 11.11 servers (userdel -r) and I also removed that user's crontab file from under /var/spool/cron/crontabs.

However from the /var/adm/cron/log file it appears as though this user is still executing its cronjob, eventhough it has been removed from the system.

Is there a better method to remove a users crontab from the system? Are cron jobs held somewhere in memory, or another file? Do I need to recycle the cron daemon?

I noticed the user still remains in /var/adm/cron/cron.alllow, obviously since he is no longer on the system I should remove it from that file. However I do not think this is the source of the issue, since the user is attempting to run a crontab at precisely the same time he would have run it were his crontab file still present - hence my thoughts that something is being held about this in another file or in memory.

Any help would be much appreciated.
5 REPLIES 5
Prashanth.D.S
Honored Contributor

Re: cron job memory

Hi There,

With the user removed, here is how to rid the system of the cron jobs that have
been scheduled to run as the user:

1) If it exists, `vi /var/adm/cron/cron.allow` file and remove the user.

2) Remove the user's crontab:
#rm /var/spool/cron/crontabs/user_name

3) Stop and start cron:
# /sbin/init.d/cron stop
# /sbin/init.d/cron start

I guess you have to stop and start the cron, have you done this ?

Best Regards,
Prashanth
Prashanth.D.S
Honored Contributor

Re: cron job memory

Hi There,

With the user removed, here is how to rid the system of the cron jobs that have
been scheduled to run as the user:

1) If it exists, `vi /var/adm/cron/cron.allow` file and remove the user.

2) Remove the user's crontab:
#rm /var/spool/cron/crontabs/user_name

3) Stop and start cron:
# /sbin/init.d/cron stop
# /sbin/init.d/cron start

I guess you have to stop and start the cron, have you done this ? If not please try and let me know.

Best Regards,
Prashanth
Steven E. Protter
Exalted Contributor

Re: cron job memory

Shalom,

/sbin/init.d/cron stop
/sbin/init.d/cron start

You must restart the daemon after denying or authorizing users to use cron.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Peter Nikitka
Honored Contributor
Solution

Re: cron job memory

Hi,

I think, after executing a
crontab -r

before calling the 'userdel' no restart of the cron daemon should be necessary.

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
James R. Ferguson
Acclaimed Contributor

Re: cron job memory

Hi:

Peter is correct. The proper way to manage crontasks is to use the 'crontab' command. Manually adding and/or removing files in '/var/spool/cron/crontabs' does not signal the 'cron' daemon of any changes. While adding or removing files and then stopping and restarting 'cron' would indeed accomplish the same objective, this is overkill and could potentially result in one or more user's missing a scheduled job start.

Regards!

...JRF...