Cron with $_GET in Plesk - get

I have to setup a cron in one of the latest versions of Plesk. The url for the cron is:
http://www.example.com/admin/cronmanager.php?route=cron/prods/all&key=1234
Via plesk dashboard, I can set script path and argument. Via folder button next to script path field, I can select the file on the server, so finding the correct path is easy (example.com/admin/cronmanager.php). The $_get variables are the problem. I tried to put them in the script path, but that didn’t work. I tried:
example.com/admin/cronmanager.php?route=cron/prods/all&key=1234
and
example.com/admin/cronmanager.php route=cron/prods/all key=1234
I also tried to put the $_get in the arguments like this:
route=cron/prods/all key=1234
Also didn’t work. Even Google wasn’t able to help me. In DirectAdmin this is no problem. What is the correct way of doing this?

If I've right understand you set cron task 'Run a PHP script' via command line. There is no $_GET/$_POST variables in PHP command line, because there is no HTTP request to script.
Instead you can use 'Fetch a URL' task type and check var_dump($_GET):

Related

How to set cron in cakephp in cpanel on linux server

How do i set the cron command in Cpanel in Linux server i use this it works for me is there any proper way
wget http://www.vloghit.com/crons/send_mail
You should use the full path for wget like /usr/bin/wget instead of just plain wget. Depending on the WHM server configuration the crons might be running as jailed so you might get an error stating that wget command was not found if you do not use the full path to the binary. You are also supposed to receive an email notification from that cron job. Are you geting it? I'm asking because in those email notifications you get also an error message that can help you to understand why the cron was not working.

Setting PATH environmental variables permanently Centos Web Panel Install... Works from SSH, not Webpage

My zip function isn't working when being called from a php script, but works straight from the SSH prompt.
code in the PHP file that returns nothing var_dump( exec('zip -r domains.zip "domains"') );
code in the php file which works as expected var_dump( exec('/usr/bin/zip -r domains.zip "domains"') );
I've added the path to /etc/profile, I've added it to my ~/.bashrc but can't get the web user to be able to use it.
I'm new to this and it's a VPS so I'm not sure where to go from here.
Ensure that permissions are adequate on the files being accessed - you want to ensure that the user accessing them is able to execute them.

Apache 2: calling 'a2ensite' from a bash script in Linux

I am currently writing an admin page for my webserver, to make it easier on myself to create new apache domains from my browser. Everything is pretty much working as I want it to, except for one thing.
To elaborate: I have a cron job on my server running a bash script as root that checks a file containing a list of domain names that I want to be created. If the file contains a domain name, it automatically creates a new virtual host for this domain, edits my hosts file, and restarts the server. This all works perfectly, however what I would like for the script to do, is that it activates the domain that it automatically creates before it restarts the server. I tried doing this using apache 2's a2ensite command, however the script returns an error saying the command is not found.
Is there a way to call this command from a bash script, or is there an alternative to this command that I can call?
Any help would be greatly appreciated.
$ which a2ensite
/usr/sbin/a2ensite
Usually, cron has a quite restrictive $PATH, not including /usr/sbin or /sbin, which are system binaries (for use by root). It's always a good idea to use fully qualified path names. So either call /usr/bin/a2ensite in your script, or define a variable:
A2ENSITE=/usr/sbin/a2ensite
...
${A2ENSITE} new-domain.com

Linux - Subversion - post-commit hook not executing

I am running Arch linux. I have installed Subversion and set it up for use with https everything seems to working fine, with the exception of my hooks.
I have one hook, it is path/to/repo/hooks/post-commit.
It is executable.
I have included a logging statement with: echo "Complete." >> /path/hook.log
When executed as the http user from the command line the script works fine, including the log statement.
When I commit changes I do not see the addition to the log or any of the actions from the rest of the script.
What might I have mis-configured?
Are there any logs to check for this?
Maybe you need to set the proper permission to the /path/hook.log, so as the user that execute the svn-hook, could writte into that file.
But maybe you could give us a litle more information about that hook.

File path for a Cron Job

Hi I want to run a cron job to call a PHP script on my server. I am using Cpanel from my web host and these are the options:
Minute:
Hour:
Day:
Month:
Weekday:
Command:
I am really struggling to point the command to my file I am using this line /home/abbeysof/public_html/adi/cron/daily.php but I am getting this error:
/bin/sh: /home/abbeysof/public_html/adi/cron/daily.php: Permission denied
I asked my web host for help and this is the response:
If you use cpanel to create it, it will fill in the path for you. Typically /home/username/public_html/etc
Can anyone please offer some advice?
Advise 1: use wget command, wget runs the PHP script exactly as if it was called from the web so the PHP environment is exactly the same of when calling the file from the web, it's easier to debug your script then.
wget -O - http://yourdomain.com/adi/cron/daily.php >/dev/null 2>&1
The cron jobs has to be created going into cPanel cron jobs menu. I don't understand if you have this clear by reading your hoster's answer.
And advise 2: change web hosting, try this one they don't leave you alone.
Sorry, I don't know anything about cpanel, but it sounds like:
if you created the file daily.php, then you need to change the permissions on it
if they created the file, then there's a bug in their creation routine.
Good luck!
try this one
/usr/bin/php -q /home/yourCpanelUsername/public_html/filename.php
for some cpanels it might be like this
/usr/local/bin/php -q /home/yourCpanelUsername/public_html/filename.php
Sounds like you need to make /home/abbeysof/public_html/adi/cron/daily.php executable.
The link might help you.
https://www.inmotionhosting.com/support/edu/cpanel/how-to-run-a-cron-job
There is difference if you are using VPS than sharing hosting for giving the command.
You may need to use user-agent & cPanel-Cron along with your url.
curl --user-agent cPanel-Cron http://example.com/cron.php

Resources