LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to start my cronjob manually? (http://www.linuxquestions.org/questions/linux-newbie-8/how-to-start-my-cronjob-manually-711950/)

xpucto 03-16-2009 07:47 AM

How to start my cronjob manually?
 
Hi!

I would like to know how I may start a cronjob manually?

thanks.

linuxlover.chaitanya 03-16-2009 08:04 AM

Your cron job scheduled should be some script that you have written for some purpose. Why not run the script manually?

JaksoDebr 03-16-2009 09:22 AM

Run the content from the cron job's script field in a shell. If your cron job is this (a sample):
* * * * * php /home/me/my.php
then run from the command-line the 'php /home/me/my.php' part. Note: some hosted servers would replace 'php /home/me/my.php' with something like '/ramdisk/home/me/php5 /home/me/my.php' or similar - this can be misleading.

JD

Linux Archive

malekmustaq 03-16-2009 10:40 AM

xpucto:

The easiest <muy facil> way to start cronjob is to place your script inside the folder --make your choice of job time frequency: hourly, daily, weekly or monthly.

Then fix your time on the crontab:

# crontab -e <Enter>
{for help read manual about crontab: $ man crontab}

To find out whether your script goes according to your expectation run it manually first:

# /etc/cron.daily/your.script <Enter>

If you want to be certain if cron will run it according to crontab, test set it in current time. You will need "reload" or "restart" cron daemon for that, or you want, reboot the system. Then check if your job is running:

# ps axu

See if your job is among the processes. Sometimes you will need wait few moments before cron starts then try ps axu it again.

Goodluck. Hope it helps.

drupalfever 07-10-2012 10:56 PM

Use SH to test your Shell Scripts.
 
If your Cron job is a Linux Shell Script with the ".sh" extension, you could do the following:
[root@localhost ~]# sh /etc/cron.daily/your_script.sh

classic123 08-10-2014 04:37 PM

This works
 
I know this is an old post but it worked for me.
Give drupalfever a cookie.
I hated when you search and search just to find out that people post these so called fixes and they never work.

Thanks drupalfever for a real solution.


All times are GMT -5. The time now is 05:18 AM.