i have this crontab,
* * * * * php /etc/raddb/overloaded.php
but it is not running fine, meaning it doesnt run every minute, but when i manually enter this into the terminal (php /etc/raddb/overloaded.php), the script works
thank you guys
PS: im using centos 32 bit. also im using the "crontab -e" to insert and save crontab, but it looks like that crontab is not running? i typed "crontab -e" and yet (* * * * * php /etc/raddb/overloaded.php) appears. where is the issue here? thanks
Crontab syntax is right. Please check if your cron daemon is running and you can check log, maybe it conatins some usefull info.
I think the most possible problem is that cron has its own environment settings. Try to run php with its full path, e.g.
/sbin/php
or w\e path you have
Related
I have a pretty simple db back-up script that runs perfectly from shell.
php /home/db_backup/db_backup.php
When I attempt to add a Crontab, I get the vague 'Bad Command errors in crontab, can't install."
I've tried w/ php and full path to php.
which php
returns /usr/bin/php
* 1 * * * php /home/db_backup/db_backup.php
* 1 * * * /usr/bin/php /home/db_backup/db_backup.php
Both return the same error.
Centos 6.6. logged in as root. Editing crontab thusly
crontab -e
Spent too many hours trying to get this working. What am I missing?
I bet your problem is when editing the crontab file not with the commands itself.
Be sure to let a blank line at the end of file.
I mean the cursor must be in an empty line after the last entry.
I am using a plugin in moodle that requires running cron. I manually run localhost/moodle/admin/cron.php and it worked. So my question is how can I run this script all the time and not manually. I read about C panel but I'm not sure how to use it.
Any advise is appreciated. Thanks in advance.
If you go to your cpanel on your host, then go to the cron options. It should also you how often you want the cron to run and a script to run.
The script is
usr/bin/php /path/to/moodle/admin/cli/cron.php >/dev/null
If you choose to run every 15 minutes then you should see something like this after setting up cron.
*/15 * * * * /usr/bin/php /path/to/moodle/admin/cli/cron.php >/dev/null
http://docs.moodle.org/25/en/Cron
Im very new to command line so please forgive my ignorance. I can succesfully execute my script using putty by navigating to the relevant direcotry and typing
bash app_auth.sh
I'm now trying to set this scipt to run using cPanel cron job. I have tried the following but it doesnt work:
* * * * * /public_html/app/cron_jobs/app_auth.sh
Any help would be appreciated..
Though this thread is old but I found it unanswered hence replying.
Make sure that you have assigned execute permissions to your app_auth.sh file. Also, try setting the following cron:
* * * * * /public_html/app/cron_jobs/app_auth.sh > /home/YOUR_USER/cron.log 2>&1
Just for the record, I came across the same problem.
I found this webpage, which led me to do this:
/bin/sh /public_html/app/cron_jobs/app_auth.sh
And it worked fine!
I have a problem running a cronjob. No experience with it, so probably overseeing something nooby. The following script works like a charm (all old filters are deleted from db) when run from the shell:
dude#linux:~> /usr/bin/env /home/dude/RubyOnRails/myproject/script/rails runner /home/dude/RubyOnRails/myproject/script/delete_old_filters.rb
I made the script executable with chmod. Now I want this to run regularly using a cronjob:
dude#linux:~> crontab -e
This file was empty, and I placed this on a single line:
* * * * * /usr/bin/env /home/dude/RubyOnRails/myproject/script/rails runner /home/dude/RubyOnRails/myproject/script/delete_old_filters.rb
I expect the script to run every minute, but nothing happens. In /etc/cron.deny, only 'guest' is mentioned, and /etc/allow does not exist. Restarting my system did not help as well.
The crontab seems to be updated proberly:
dude#linux:~> crontab -l
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.f9Et2M installed on Thu May 3 14:04:47 2012)
# (Cronie version 4.2)
* * * * * /usr/bin/env /home/dude/RubyOnRails/myproject/script/rails runner /home/dude/RubyOnRails/myproject/script/delete_old_filters.rb
But I expected here a bit as well:
dude#linux:~> atq
dude#linux:~>
The cronjob does something. Every minute an entry is added to /var/log/cron.log:
2012-05-03T15:27:01+02:00 linux /USR/SBIN/CRON[5276]: (dude) CMD (/usr/bin/env /home/dude/RubyOnRails/myproject/script/rails runner /home/dude/RubyOnRails/myproject/script/delete_old_filters.rb)
The problem is, that the job is not executed. It should remove some records from the database, but it doesn't. Running the same script manually does the trick.
Anyone seeing the (perhaps trivial) thing that I missed?
Perhaps this will help, using the brackets.
* * * * * ( colon separated commands-to-execute )
Check it.
I maintained a database (MySQL), I would like back up some data to the database using a perl script. To save my trouble, I would like cron to do it for me, I inserted the following using crontab
*/5 * * * * blctrl /home/blctrl/code/perl/tt01.pl
However, cron never does its job, any suggestions to get it done? The Linux installed is Centos 5?
*/5 * * * * blctrl /home/blctrl/code/perl/tt01.pl
That looks like the syntax for /etc/crontab, the system-wide crontab file. The first 5 words indicate when to run the command, the 6th is the account under which to run it, and the rest of the line is the command to execute.
(The clue was that the command is under /home/blctrl, which would be the home directory for the account blctrl.)
The syntax for your own crontab, the one you feed to the crontab command, is different. You don't specify an account name, because it only runs under your own account.
Try this:
*/5 * * * * /home/blctrl/code/perl/tt01.pl
EDIT: Incidentally, the first thing I would have tried when encountering a problem like this would be to replace the command with something simple, perhaps touch /tmp/FOO. That would have told you whether the problem was with your Perl script or with your crontab.