Setup a cronjob for a php file

Hi there, I want to setup cronjob using curl

as example

curl --silent > /home/cyberpanel/public_html/output.txt

I have tested that command directly via terminal and its working
but somehow I set it on cronjob and it did not work

is it need to use using different command to use in cronjob?

Oh anyway, I install cyberpanel on VPS Ubuntu 20.04
Thank you in advance

Welcome @am1ncmd Happy you are here

You are trying to setup a cronjob for a php file. Psst that should be the title.


php /home/ >> /home/

To use a different PHP version:

/usr/local/lsws/lsphp81/bin/php /home/ >> /home/

For quiet mode:

php -q /home/ >> /home/

The reason why I use CURL instead of PHP is the source is using different website

I already tried using the PHP command but the output.txt is still not showing on the directory

Also, thank you for suggesting the tittle

Does the world have access rights to that php file?

I own that website, just using different hosting and also a different panel

cyber panel installed on VPS, and the other one is using the default panel from the hosting itself

Am asking can you access via curl on your pc

Yes, of course, It can be access it from anywhere on any devices

Try the system wide cron nano /etc/crontab add this line at the end to run every minute so that we confirm if it ran:

* *    * * *   root /usr/bin/wget -O - >> /home/

why wget its just my preference.

Alright, this one is working using curl. Thank you so much

But I still have a question: why is not working with the default cronjob from the cyber panel?

All cronjobs are here /var/spool/cron/crontabs you can always view your conrjobs by running crontab -l I believe the trick was running as root OR it failed during creation in cyberpanel. Can you check your logs for any errors

This topic was automatically closed 3 hours after the last reply. New replies are no longer allowed.