Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run a curl command using CRON jobs

I want to run this statement:

curl 'http://localhost:8983/solr/dataimport?command=full-import'

every 10 minutes using CRON jobs.

How do I achieve this?

like image 901
Archit Arora Avatar asked Jul 25 '13 06:07

Archit Arora


People also ask

How do I schedule a curl command?

To schedule a curl command to run at 3am daily, you can insert the line: 0 3 * * * curl args... Notice how the minutes and hour correspond to 3am (side note: cron uses 24 hour time format, no am or pm). The asterisks that follow mean every day of month, every month, every day of week.

Can cron run commands?

Cron allows Linux and Unix users to run commands or scripts at a given date and time. You can schedule scripts to be executed periodically. Cron is one of the most useful tool in a Linux or UNIX like operating systems. It is usually used for sysadmin jobs such as backups or cleaning /tmp/ directories and more.

What is the use of * * * * * In cron?

It is a wildcard for every part of the cron schedule expression. So * * * * * means every minute of every hour of every day of every month and every day of the week .


1 Answers

In case of using Cpanel :
Cpanel->Cron Jobs->Put Time Interval(*/10 * * * * )
Add command in the text box:
curl -s "http://localhost:8983/solr/dataimport?command=full-import"
where -s stands for silent (no output)
You are done

like image 91
Hassan Kazem Avatar answered Sep 20 '22 18:09

Hassan Kazem