Operating System - HP-UX
1752781 Members
6185 Online
108789 Solutions
New Discussion юеВ

Re: cron job still running after user deleted

 
Terence Lee_1
Occasional Contributor

cron job still running after user deleted

I used to have a user in my server who has a cron job running. Although I had deleted the user, the cron job under this user is still running, creating files showing only userid without ownership. I have tried to restart the cron service but it does not work. Can anyone advise on how the cron job can be stopped? Is it a requirement to remove any cron job before deleting a user?
8 REPLIES 8
Paul_481
Respected Contributor

Re: cron job still running after user deleted

Hello Terence,

Try to execute:

#crontab -e

Then deleted all the cron entry

regards,

paul
Michael Tully
Honored Contributor

Re: cron job still running after user deleted

yes it is, but ...

You could add an entry to the cron.deny file for that user or simply re-instate the user id and then remove the cron file.
Anyone for a Mutiny ?
Steven E. Protter
Exalted Contributor

Re: cron job still running after user deleted

cd /var/spool/cron/crontabs

every users crontab will be listed there.

You delete the file named after the user and his cron jobs will stop running.

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
Terence Lee_1
Occasional Contributor

Re: cron job still running after user deleted

Yes, I have tried the method of crontab -e 'username' but it reply 'Not a valid user', and the cron job file is no longer in /var/spool/cron/crontabs.
Thierry Poels_1
Honored Contributor

Re: cron job still running after user deleted

hmmm, when editing directly in /var/spool/cron/crontabs you will need to stop/start the cron daemon. Cron caches all crontabs and does not reread them.

So if you remove the crontab of this user in /var/spool/cron/crontabs and stop/start cron his job will stop running.

Did you check /var/adm/cron/log if it is indeed a cron job that is still started.

regards,
Thierry.
All unix flavours are exactly the same . . . . . . . . . . for end users anyway.
Terence Lee_1
Occasional Contributor

Re: cron job still running after user deleted

Thanks, I don't see any cron logs after I restart the service. It seems that when I deleted the user, all the files beloning to the user, including the cron job file in /var/spool/cron/crontabs is deleted but the job is still running until after the cron service is restarted. 'Crontab -e username' cannot be used to remove the job since cron no longer recognize the user.
Victor BERRIDGE
Honored Contributor

Re: cron job still running after user deleted

Hi,
I always removed the userfile (the file name beeing userID ) in /var/spool/cron/crontabs and it always worked...
The files beeing removed are normally the onee ownes but this is not the case for cronfiles (root)

All the best
Victor

To be sure if the file is removed - /do a /sbin/init.d/cron stop/start
What do you see now?
only the files existing in /var/spool/cron/crontabs are executed...

Victor BERRIDGE
Honored Contributor

Re: cron job still running after user deleted

Hi again,
Have you thought reading what the other files in /var/spool/cron/crontabs do? It may be after all someone else generating these files...

All the best
Victor