Crontab Issue

My colleague who was a sysadmin , has created a cron job script which collects logs and process them.

The script works perfectly as per the defined time set by him.

it works when we keep the timing as 55 05 * * * , whereas if we try to prepone the cron task is not getting executed.

Where could be the problem and how to change this.

What is in the script? Does it contain anything that looks at the time when it is being run?

What entry are you making in crontab to prepone the task? Are you adding the new cron task to the same user's crontab that contained the working task?

Are you getting any error messages?

it doesnt check any time stamp and we are not getting any error in the cron logs also.

That answers two of my five questions. What about the other three?

  1. Changing it to 30 3 * * * /script

  2. user credentials are same.

  3. Script has collecting the logs and ftping the dump to another server.

What platform and operating system is this?

How are you changing the time of the cron job exactly?

I'm surprised that you have an executable shell script in your root directory. Did you modify the contents of /script in any way?

Is there something else that runs between 3:30 and 5:55 in the morning that affects the logs your script collects or the dump it transfers?

Do you have syslog entries for the early job? Do the files your script works on already exist at 3:30h?

It has to be an external dependency to the shell script - assuming what has been said is correct. That said, without seeing the script, cron is practically guaranteed not to be the problem. As the original wording of the question implies. The script is the problem. Please post the script.

@jim mcnamara.....I see where you are coming from but the OP says that the script was running fine and it's not been changed. Hence my question about how the crontab is being modified. If the crontab is being edited directly (not using the correct tools) then the change of time will not be noticed for up to 24 hrs unless the cron service is restarted.

We don't know the distro but on some the crontab update process is implemented separately and, if it's not running for some reason, the change of time will never get updated on the crontabs in memory.

So I agree with you that cron in itself is not the problem but how the change is being made could be.

My take was an external dependency. A lot of crontab files, like vixie cron, work correctly when editied by vi directly. Oldtime crond did not like that and would not notice a change for quite a while. Since we nothing to go on, I'm stuck.