- Plesk 12.5 for Linux
- Plesk Onyx for Linux
- Plesk Onyx for Windows
- Plesk 12.0 for Windows
How to execute PHP/Perl/ASP.NET scripts from scheduled tasks?
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:
CONFIG_TEXT: /usr/bin/perl /var/www/vhosts/domain.test/cgi-bin/crontasks/cron.pl
CONFIG_TEXT: Path to executable file: "C:\Program Files (x86)\Plesk\Additional\Perl\bin\perl.exe"
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.
CONFIG_TEXT: /usr/bin/wget -qq -O /dev/null http://domain.test/script.php
CONFIG_TEXT: /usr/bin/curl -sL http://domain.test/script.php >/dev/null
it is possible to make an HTTP request through PowerShell:
CONFIG_TEXT: Path to executable file: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Arguments: -c "(new-object system.net.webclient).downloadstring('http://domain.tld/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.