Operating System - HP-UX
1833903 Members
2014 Online
110063 Solutions
New Discussion

disabling cron jobs for deleted user

 
SOLVED
Go to solution
Olga_1
Regular Advisor

disabling cron jobs for deleted user

User was deleted through SAM, but cron jobs that belonged to the user keep running. How to disable them?

Thank you.
4 REPLIES 4
Patrick Wallek
Honored Contributor
Solution

Re: disabling cron jobs for deleted user

Do the following:

# cd /var/spool/cron/crontabs
# mv userid_of_removed_user userid_of_removed_user.bad
or
# rm userid_of_removed_user
# /sbin/init.d/cron stop
# /sbin/init.d/cron start
Steven E. Protter
Exalted Contributor

Re: disabling cron jobs for deleted user

I would modify Patrick's process, just in case one of the jobs turns out to be necessary for transplantation to another user.

# cd /var/spool/cron/crontabs
# mv userid_of_removed_user userid_of_removed_user.bad
or

# change the next line to mv
# rm userid_of_removed_user
mv userid_of_removed_user /root
# keep a copy in case you need it.

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

regards,

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
A. Clay Stephenson
Acclaimed Contributor

Re: disabling cron jobs for deleted user

Here's probably the quickest method:

1) ps -e | grep cron and note the PID of the cron daemon.

2) cd /var/spool/cron/crontabs

3) rm theuser (or whatever)

4) kill -1 PID (from step 1) -- this will send a SIGHUP to the cron daemon forcing a reread of the crontabs w/o actually stopping the cron daemon.
If it ain't broke, I can fix that.
Patrick Wallek
Honored Contributor

Re: disabling cron jobs for deleted user

Good point Clay. A 'kill -1' or 'kill -HUP' is probably a better idea than stopping and starting cron.