I need to create a cron job where I only have shell access. I know how to do it with cPanel, But this is 1 and 1 on the server so i have to use shell.
I got to that part where I add a new cron job to Krantab, but I'm not sure what I'm doing because the cron job is not going at all at all.
This is what I usually put in cPanel:
0 8 * * 1 wget 'http: //my_www_domain/googlefroogle.php? Feed = fy_uy_tp & amp; Now in my cronet: 0 8 * * 1 / usr / local / bin / php / homepages / XX / key = XXXXX3f7d1 ' XXXXXXX / htdocs / googlefroogle.php? Feed = fy_uy_tp & key = XXXXX3f7d1
What am I missing or doing wrong? BTW, if I manually enter the URL in my browser everything works fine, so I'm sure the script is okay.
As far as I know, you can use wget on the cronge on any server , So you should not have any problems if you keep using it this way.
Now, T is working because you can send a GET parameter to a PHP file like this. PHP handles the command line in a different way. See.
So you have to check that the php file is called from the URL or from the command line (it is easy to see, and), if so, get the parameter using the command line interface Or define (sprintoff ('use:% s & lt; feed & gt; & lt; key'; ', $ argv [0])); } $ Feed = $ argv [1]; $ Key = $ argv [2]; } And {$ feed = isset ($ _GET ['feeds'])? $ _GET ['feed']: zero; $ Key = isset ($ _GET ['key'])? $ _GET ['key']: zero; }
Now you have to call this type of script on your cronjob:
php -f file.php fy_uy_tp XXXXX3f7d1 What this does, is that if the script is running from the command line, it becomes the variable in the form of argument, if not, then check it for the presence of the GET parameter and use them.
Comments
Post a Comment