• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

A Guide to setting up Scheduled Tasks

ThePromenader

New Pleskian
Hello,

I've just spent the afternoon fighting to get Plesk executing Scheduled Tasks. I read a lot of 'bits' of different info on how this could be done (for many different installations), but I couldn't find a unique comprehensive guide that covers everything for all Linux distributions.

First off, you're going to have to activate /bin/bash ssh access through Domains -> Manage Hosting (of the domain you want to configure) -> Websites & Domains (more) -> Web Hosting Access. There you're going to go to the 'Access to the server over SSH' dropdown menu and choose '/bin/bash' (which is usually the default Linux shell, btw) to keep Plesk from chrooting you (which it insists on doing in a way all the same, more later).

Secondly, now that you have SSH access, log in through either the Plesk Terminal window (accessible through previous Websites & Domains page, but in "Advanced Options") or your own (accessing with the domain administrator login/password), and enter:

Code:
# /usr/local/psa/bin/server_pref -u -crontab-secure-shell "/bin/bash"

...this will ensure even further that scripts run through the Plesk environment with a '/bin/bash' shell.

Next, and this is important, go to your terminal and get your $HOME directory (
Code:
echo $HOME
) - just to be sure, because this may change depending on your Linux distro. Keep the path it returns in mind: all calls within your scripts, and the script itself, should be above (within) that 'root' folder - Plesk for some reason refuses anything else. Also, your script calls/location should be like: 'httpdocs/scripts/myscript.sh' if your $HOME is the 'mother' folder of 'httpdocs' - putting the entire path to the script, or putting the entire path in a call to any external files within your scripts, won't work either.

I hope this helps someone, cheers.
 
Last edited:
Back
Top