Enable & disable cronjob

Hi All,

I am new to cronjob and need some guidance on this.

1) How do i enable a cronjob ?
Can it be done by "crontab mycronfile" or "crontab -e mycronfile"

2) How can i disable the cronjob?
Can deleting of the "mycronfile" disable the cron or do i need to perform "crontab -r mycronfile" ?

1) yes, yes

2) crontab -r

Hi,

Is there any way that i can check whether the cron has been disabled or enabled ?

If you mean the cron subsystem then do a check of the process list and see if cron is running. Otherwise it depends on your operating system.

If you mean your tasks, then do "crontab -l", if nothing is listed that does not start with # then you have nothing scheduled.

Hi ,

I can't disable my cron. Can you help ?
Below is the error msg

$ crontab -r cronline
crontab: you are not a valid user (no entry in /etc/passwd).

  1. What about

echo >empty
crontab ./empty

  1. Are you listed in /etc/passwd ?

  2. What are the rights to the /etc/passwd file? eg "ls -ld /etc/passwd"

  3. What is the result of "id"?

Does "crontab -r" remove all cronjobs regardless of which user id u are using ?

Hopefully it only removes all for the current user. Also, why did you have an additional argument?