How to set cron path?? Any easy way - php

I set
use /usr/local/bin/php /home2/bollyzz1/public_html/Bollyzz/latest_auditions_by_email.php
Error:
/usr/local/cpanel/bin/jailshell: use: command not found

Login to your cPanel and click Cronjobs under the Advanced section
Enter the following command in the Command to run field.
lynx -source "http://www.yourdomain.com/Bollyzz/latest_auditions_by_email.php" > /dev/null

Make your crone file path like this.
/usr/bin/php -q /home2/bollyzz1/public_html/Bollyzz/latest_auditions_by_email.php

Use wget command
wget http://domain.com/latest_auditions_by_email.php
set your time ( * * * * *) and check

Related

What command would I use to run a cron job on a file not in public_html

I have a php file which I want to be executed every 15 minutes. I have the cron job set up already. I just want to know what command I would use?
My file is located in ~/app/example/myfile.php. So you can't access it through a URL. Otherwise I would have just used wget -q -O /dev/null "URL"
In your crontab it'd be
0,15,30,45 * * * * php /path/to/file.php

How can I prevent creating log files by CronJob?

I have a Cronjob. My command is that: wget mysite.com/bot.php But this command will automatically creates log files that names are like:
bot.php
bot.php.1
bot.php.2
bot.php.3
etc...
How can I prevent this?
Thanks!
I assume you're trying to run your script without storing any information locally.
Try adding &> /dev/null to the end of your cron command, this will dump the output to /dev/null which is basically a black hole ( anything that ends up here is irretrievable ).
An example cron command would be:
*/5 * * * * wget -qO- http://example.com/check &> /dev/null

cron job set up in magento on server

I worked on magento and I want to run cron job on the server.
If I run domainname/magentofolder/cron.php in the address bar it works.
But when I try to set up cron job on cpanel it will not working.
If executing the php cron file doesn't work you can also try so set up the cron to use the cron.sh file like this:
*/5 * * * * /bin/sh /absolute/path/to/magento/cron.sh
Try this
*/5 * * * * wget -O /dev/null -q http://www.YOURDOMAIN.com/PATH_TO_MAGENTO/cron.php > /dev/null
more information is on xtento

Using WGET to run a cronjob PHP

I tried to do a cron and run a url every 5 mintues.
I tried to use WGET however I dont want to download the files on the server, all I want is just to run it.
This is what I used (crontab):
*/5 * * * * wget http://www.example.com/cronit.php
Is there any other command to use other than wget to just run the url and not downlaod it?
You could tell wget to not download the contents in a couple of different ways:
wget --spider http://www.example.com/cronit.php
which will just perform a HEAD request but probably do what you want
wget -O /dev/null http://www.example.com/cronit.php
which will save the output to /dev/null (a black hole)
You might want to look at wget's -q switch too which prevents it from creating output
I think that the best option would probably be:
wget -q --spider http://www.example.com/cronit.php
that's unless you have some special logic checking the HTTP method used to request the page
wget -O- http://www.example.com/cronit.php >> /dev/null
This means send the file to stdout, and send stdout to /dev/null
I tried following format, working fine
*/5 * * * * wget --quiet -O /dev/null http://localhost/cron.php
If you want get output only when php fail:
*/5 * * * * php -r 'echo file_get_contents(http://www.example.com/cronit.php);'
Or more secure:
*/5 * * * * php /var/www/example/cronit.php
This way you receive an email from cronjob only when the script fails and not whenever the php is called.
you can just use this code to hit the script using cron job using cpanel:
wget https://www.example.co.uk/unique-code

Cronjob every minute

I have a file in mysite.com/url1/url2/cronjob.php which has to be run every minute. I try every combination, but can't succeed. What should I run in command line? Thank you.
In case you'd set it up in a crontab, this works:
*/1 * * * * /usr/bin/wget -O /dev/null http://example.com/cron.php
Steps your shell
$ crontab -e
* * * * * php -f /path/to/cron.php
~
~
I got confused for the first time where to add all of these and finally found.
Type the following in the linux/ubuntu terminal
crontab -e
select an editor (sometime it asks for the editor) and this to run for every minute
* * * * * /usr/bin/php path/to/cron.php &> /dev/null
The PHP interpreter.
/[path-to-php]/php -f [your-php-script]
Are you looking for help to make an UNIX cronjob?
If so, have you tried to edit /etc/crontab, and add
\1 * * * * user command
where user is either root or your name. Im not exactly sure how to access and URL, but a dirty way could involve downloading the link as a file, e.g. "wget http://url.com/page.php"

Categories