[linux] Using CRON jobs to visit url?

I have a web application that has to perform a repeated tasks, Sending messages and alerts, I, already, use a script page do those tasks when it loaded in the browser i.e http://example.com/tasks.php and I included it by the mean of iframe in every page of my web application.

Now I want to change this to use CRON jobs because the first approach may leads to jam performance, So How could I make a CRON job that visits http://example.com/tasks.php. However, I don't want this CRON job creating output files such as day.*!

I host the application on shared hosting service that permits CRON jobs via cPanel.

This question is related to linux web-applications web cpanel cron-task

The answer is


Here is simple example. you can use it like

wget -q -O - http://example.com/backup >/dev/null 2>&1

and in start you can add your option like (*****). Its up to your system requirements either you want to run it every minute or hours etc.


* * * * * wget --quiet https://example.com/file --output-document=/dev/null

I find --quiet clearer than -q, and --output-document=/dev/null clearer than -O - > /dev/null


U can try this :-


    wget -q -O - http://www.example.com/ >/dev/null 2>&1


You can also use the local commandline php-cli:

* * * * * php /local/root/path/to/tasks.php > /dev/null

It is faster and decrease load for your webserver.


You can use this command:

links https://www.honeymovies.com

You can use curl as is in this thread

For the lazy:

*/5 * * * * curl --request GET 'http://exemple.com/path/check.php?param1=1'

This will be executed every 5 minutes.


You don't need the redirection, use only

* * * * * wget -qO /dev/null http://yoursite.com/tasks.php

i use this commands

wget -q -O /dev/null "http://example.com/some/cron/job.php" > /dev/null 2>&1

Cron task:

* * * * * wget -q -O /dev/null "http://example.com/some/cron/job.php" > /dev/null 2>&1

you can use this for url with parameters:

lynx -dump "http://vps-managed.com/tasks.php?code=23456"

lynx is available on all systems by default.


Examples related to linux

grep's at sign caught as whitespace How to prevent Google Colab from disconnecting? "E: Unable to locate package python-pip" on Ubuntu 18.04 How to upgrade Python version to 3.7? Install Qt on Ubuntu Get first line of a shell command's output Cannot connect to the Docker daemon at unix:/var/run/docker.sock. Is the docker daemon running? Run bash command on jenkins pipeline How to uninstall an older PHP version from centOS7 How to update-alternatives to Python 3 without breaking apt?

Examples related to web-applications

Spring - No EntityManager with actual transaction available for current thread - cannot reliably process 'persist' call How do I choose the URL for my Spring Boot webapp? Difference between MEAN.js and MEAN.io External VS2013 build error "error MSB4019: The imported project <path> was not found" How to unpackage and repackage a WAR file IntelliJ, can't start simple web application: Unable to ping server at localhost:1099 Using form input to access camera and immediately upload photos using web app Pass user defined environment variable to tomcat ASP.NET: HTTP Error 500.19 – Internal Server Error 0x8007000d Best practices when running Node.js with port 80 (Ubuntu / Linode)

Examples related to web

Cannot open local file - Chrome: Not allowed to load local resource How do I detect if a user is already logged in Firebase? HTML button opening link in new tab What does "app.run(host='0.0.0.0') " mean in Flask Web link to specific whatsapp contact App not setup: This app is still in development mode How to delete/remove nodes on Firebase Cannot read property 'push' of undefined when combining arrays HTML: Image won't display? JWT (JSON Web Token) library for Java

Examples related to cpanel

Run CRON job everyday at specific time #1227 - Access denied; you need (at least one of) the SUPER privilege(s) for this operation #1273 - Unknown collation: 'utf8mb4_unicode_ci' cPanel onchange file input change img src and change image color How to set a cron job to run every 3 hours How to access the php.ini from my CPanel? How to increase Maximum Upload size in cPanel? Using CRON jobs to visit url? How to create tar.gz archive file in Windows? Run a PHP file in a cron job using CPanel

Examples related to cron-task

How to run a cronjob every X minutes? Scheduling Python Script to run every hour accurately Using CRON jobs to visit url? Restarting cron after changing crontab file?