1

To my surprise a trial of using crontab and rsync for backups of some test files, that I started last December (2015), is still running although, in the only crontab file I have, the only line is

#55 20 * * * /home/Harry/testrsync/trial_bak.sh

which is, or should be, commented out by the # added when I thought I had ended the trial after a couple of weeks.

My question is Why is it still being executed? Or is there any other way this line (without the #) could be executed?

The backups are made daily at 20-55 and only the last four are kept, this is still going on exactly as the crontab entry and trial_bak.sh script defines it.

I am using zshell and Fedora 20, this is part of my preparation to update to the latest Fedora.


Solved:

Thanks to all who responded. Following @Marki555's answer I found that I have a /etc/cron.daily directory that contains the script that does the daily backup, so the entry in crontab is indeed commented out and is not actuated.

  • 3
    Check if some other user (or maybe root) has the uncommented entry. Otherwise, wait till 20:55 to see which process is starting a process named trial_bak.sh and follow that clue. (I would capture ps output into a text file continuously from 20:54 to 20:56 and process that leisurely) – Prem Jun 14 '16 at 18:33
  • How did you comment out the line? Specifically, if it's a per-user file did you use crontab -e (or an equivalent crontab -l > file; ${EDITOR:-vi} file; crontab file), or did you edit the crontab file directly in /var/spool/cron...? – roaima Jun 14 '16 at 22:05
2

The cron daemon takes crontabs from several files.

Dir /etc/cron.d and file /etc/crontab are special, they can be manually edited and the daemon will always see the new version automatically. Also these are the only crontab files which have also username field.

The crontabs of individual users (usually in /var/spool/cron/crontabs) are not re-read automatically by the cron daemon. You should either edit them by using command crontab -e, or restart the cron daemon after each change.

So in your case I suggest you first restart the cron daemon. Also you can add some debugging output to the trial_bak.sh script like running pstree -p.

2

Is the line you showed extracted from the output of crontab -l or did it come from a file named crontab?

The running crontabs are usually found in a directory under /var/spool. This location can vary. The actual crontabs are usually named according the the userid they apply to.

It is common to extract the crontab to a file in order to edit it. However, unless this is reloaded with command like crontab crontab the original crontab entries will continue to run.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.