0

Is it possible to stop all cronjobs for a particular cpanel user? The cronjobs should be resumable when required later.

There are several hundred cronjobs running under this user. Only this user's cronjobs should be paused/suspended.

Nyxynyx
  • 1,449
  • 10
  • 37
  • 47
  • 1
    See the options at: http://serverfault.com/questions/94351/how-to-disable-everything-in-crontab-l – ewwhite Sep 16 '12 at 21:33
  • I have several hundred cronjobs, it takes some time to manually comment and uncomment the lines. `/etc/init.d/crond stop` is not suitable as that will stop the cronjobs of **all** users, I just need to stop cronjobs of a user. – Nyxynyx Sep 16 '12 at 21:48

1 Answers1

2

I think there is a cleaner way :

According to centos documentation , you can use /etc/cron.allow and /etc/cron.deny to achieve this.

However, these file are os dependent (I assume you are using centos/redhat from the tags of your question).

Though, in newer versions this has stopped working.

sysadmin1138
  • 131,083
  • 18
  • 173
  • 296
  • 1
    That only controls access to the crontab, it does not stop the existing cronjobs from running. You have to rename the crontab file: http://superuser.com/a/675338/190858 – Perleone Nov 13 '13 at 09:53
  • Yes it does : If you add a user to /etc/cron.deny, no more cronjob will be started for this user. Have you tried the solution? What problem did you encounter? –  Nov 13 '13 at 10:21
  • No problem, just wanted to clarify. With Ubuntu 12.04.3 LTS an entry in /etc/cron.deny only prevents the user from accessing her crontab, as stated in the man page. "You (user) are not allowed to use this program (crontab). See crontab(1) for more information." The cron daemon itself does not care about cron.deny. Does CentOS handle that differently, or is it a cpanel feature? – Perleone Nov 13 '13 at 11:29
  • You are right : Can't get it working anymore and redhat has changed for cronie. I flagged it as outdated. I wasn't aware about ubuntu using cron.deny and cron.allow –  Nov 13 '13 at 13:49