CyberPanel Community

Setup a cronjob for php file

18 replies
IS
Ishant Sharma #3

* * * * * root /usr/bin/wget -O - https://website.com/export-txt.php >> /home/mydomain.com/public_html/output.txt

I can’t understand what does it mean?
plz help me @josephgodwinke

jo
josephgodwinke #4

crontab-syntax

/usr/bin/wget -O - will retrieve content from your url, get as a file and print the result on STDOUT which we save to a sink /home/mydomain.com/public_html/output.txt

IS
Ishant Sharma #5

output.txt is automatically build

jo
josephgodwinke #6

You can create it. This file can be any name you prefer. Well some developers do not put sinks for their cronjobs but it the ideal way to catch errors and exceptions

IS
Ishant Sharma #7

but in case of cron on the other cpanel you can only use your php file not other file

IS
Ishant Sharma #12

i have to add after the * * * * * root /usr/bin/wget -O - https://website.com/export-txt.php >> /home/mydomain.com/public_html/output.txt

=> website.com is my website domain and export-txt.php is my php file
home/mydomain.com/public_html/output.txt => mydomain.com is also my domain

jo
josephgodwinke #13

Do you see the expected results ?

IS
Ishant Sharma #14

-bash: /home/project1.leofox.net/public_html/output.txt: Permission denied
i got this

jo
josephgodwinke #15

Did you create that output.txt file on documentroot via file manager ?

jo
josephgodwinke #19

As you see the file has permissions rw–r–r change them to 777 and try again

Sign in to reply