How do I configure crontab to run URL, Linux ubuntu command

6

I have created 4 methods and want to execute them by accessing the link. I have already tested the methods and they are all working normally, but I have already tried several configurations for crontab -e .

I've tried:

0 * * * * wget http://meusite/rota

0 * * * * curl http://meusite/rota

I've also used the smallest and most capital, and I've already tried using the path of my project, for example:

0 * * * * curl /var/www/projeto/rota

0 * * * * wget /var/www/projeto/rota

Note: I am doing the configuration with root. Another thing, there is a command to check if it is working, and how to configure it to receive an email each time it is run.

  

My command executes a method where it loads the user data, in that   method does not pass any parameter, because it searches all users

I used the debug command to see what's happening:

DEBUG output created by Wget 1.12 on linux-gnu.


--2016-02-11 16:40:01--  http://caminho/cron
Connecting to 162.243.102.127:80... connected.
Created socket 3.
Releasing 0x0000000000b80c90 (new refcount 0).
Deleting unused 0x0000000000b80c90.

---request begin---
GET /blksocial/cron/follow HTTP/1.0
User-Agent: Wget/1.12 (linux-gnu)
Accept: */*
Host: 162.243.102.127
Connection: Keep-Alive

---request end---
HTTP request sent, awaiting response...
---response begin---
HTTP/1.0 500 Internal Server Error
Date: Thu, 11 Feb 2016 18:40:03 GMT
Server: Apache/2.4.7 (Ubuntu)
X-Powered-By: PHP/5.5.9-1ubuntu4.14
Cache-Control: no-cache, private
Connection: close
Content-Type: text/html

---response end---
500 Internal Server Error
Closed fd 3
2016-02-11 16:40:01 ERROR 500: Internal Server Error
    
asked by anonymous 11.02.2016 / 03:54

2 answers

1

Just one note, you should run the dead-end curl or progress, channeling to / dev / null like this: Example running every 5 minutes.

 */5 * * * * curl -s http://meusite/rota > /dev/null

 */5 * * * * wget http://meusite/rota

Note: The alias must exist to execute the command without the complete path. Ex: / usr / bin / curl

This site can also help you in the matter of time: link

:)

    
12.07.2018 / 18:25
0

Vitor, use the following command:

0 * * * * /usr/bin/curl http://meusite/rota

You said in your question that you used Curl, but I saw that you just put the command, so I think it would be the case to include the Curl Path.

    
11.02.2016 / 13:57