How do I call my PHP/Perl/ASP.NET/other script from a scheduled task?
Run script with appropriate program
If the script can be executed with an interpreter (e.g., PHP or Perl) and does not require parameters defined in an HTTP request, create a new scheduled task that calls the script interpreter with the path to the script as an option:
Path to executable file :
"C:\\Program Files (x86)\\Parallels\\Plesk\\Additional\\Perl\\bin\\perl.exe" Arguments:
Make HTTP request to call the script
Another way to call the script is to create a task that will perform an HTTP request to the required script:
/usr/bin/wget -qq -O /dev/null http://domain.test/script.php
/usr/bin/curl -sL http://domain.test/script.php >/dev/null
On Windows, it is possible to make an HTTP request through PowerShell:
Path to executable file:
-c "(new-object system.net.webclient).downloadstring('http://domain.test/script.aspx')"
- Paths to utilities should be absolute, i.e.,
/usr/bin/wgetinstead of just
- If a domain is set up to allow shell access via a chrooted shell (on Linux), then the commands defined in cronjobs will be looked up inside the chrooted environment set up in the virtual host directory. Such an environment contains a minimal set of utilities and language interpreters (Perl/PHP), but network utilities (curl/wget) are not included. As such, the command will fail to run. To avoid this, you may set up the server to execute scheduled tasks for all users in the global server scope using the instructions provided in this KB article: \#213921825
For more information on how to schedule tasks, read the chapter Scheduling Tasks in the Plesk Administrator's Guide .