How to create commands for firing via a CRON task

0

I do not have access to CPanel Linux and was asked to send the command script to the responsible person. I also do not have much knowledge on cron jobs and would like to know how I can create one so that a billing shot is sent daily to users. I thought about using it that way, but I do not know if it's correct:

0   0   *   *   *   
curl -s -o /dev/null http://site.com.br/disparar-cobranca/index.php

Could you help me so I can send the correct command? The server is from Locaweb and the PHP version is 5.2.17.

    
asked by anonymous 03.01.2019 / 23:58

1 answer

2

The title of the question does not suggest the same as the content of the question.

In my interpretation you need to "test" your script to see if it is functional. So let's go!

Yes, the script is FUNCTIONAL . But there's a small question [zinha].

When you call curl with parameter -s , it does not generate output.

When you call curl with parameter -o , it stores the output in such a file.

So, to fix your script (in spite of being functional), just call curl with parameter -s and request path:

curl -s http://site.com.br/disparar-cobranca/index.php

Another thing: If you're requesting this from a company, it obviously has access to the shell server. So it would be more appropriate to call your script directly with PHP . It would be enough to know the PHP path on the server, which would end up being the one who will install your cronjob . Usually stays in /usr/local/bin/php . Hence his cronjob would look like this:

0 0 * * * /usr/local/bin/php /caminho/do/site/no/servidor/index.php

PS: /caminho/do/site/no/servidor/index.php should be changed according to the path of your site, as already stated. Usually stays in /var/www/html .

If your cronjob objective is to run this PHP script every day at 0:00 AM (midnight) , it will work fine.

    
04.01.2019 / 01:04