Running a cron job manually?

Michael Hipp Michael
Fri Jul 20 09:28:24 PDT 2007


Vu Pham wrote:
> On Fri, 2007-07-20 at 08:43 -0500, Michael Hipp wrote:
>> Does anyone know a way to force cron to run a job manually?
>>
>> Explanation: I need to test cron jobs. Obviously I can run the job from 
>> the command line, but it generally has a very different operating 
>> environment than what it has when run by cron. Constantly changing the 
>> time in crontab is a pain as I need to do this over and over for 
>> testing. Is there some way to say "Hey, cron, run the job listed on line 
>> twelve!"
>>
> 
> I don't know how to call cron to run manually as you ask, but when I
> need to test my cron jobs , I often get into that same situation and my
> solution is to make my test env to be alike cron's and I manually run
> the command from that "cron-fake" environment.
> 
> This link shows the cron's env.
> http://aplawrence.com/Unixart/crontab_not_running.html

Thanks. That's a good write-up. It covered some points I didn't know 
(e.g. crontab files can't be flagged executable).

Michael



More information about the Linux-users mailing list