Running a Cron job via Scheduled Tasks in Plesk fails: Permission denied

Follow

Comments

7 comments

  • Avatar
    ignacio correia (Edited )

    Hi, I manage to get .PHP files working with the schedule tasks, yet, with .SH files I can't. You example shows a .SH file but the CRON you used is a PHP. That is not correct.

    Can someone help me get this code working:

    * * * * * ! test -e /var/www/vhosts/YOURSITE/httpdocs/maintenance.flag && /bin/bash /var/www/vhosts/YOURSITE/httpdocs/scheduler_cron.sh --mode always
    

    [image delete for security reasons]

    0
    Comment actions Permalink
  • Avatar
    Kuzma Ivanov

    Hi there ignacio correia!

    Thanks for your question.

    Can you please share:

    - a screenshot of the scheduled task settings in Plesk when you try to schedule a shell script

    - the message you get when the task fails to run

    Thanks,

    Kuzma

     

    0
    Comment actions Permalink
  • Avatar
    Buyanbat Ulziikhuu

    Hello,

     

    I have same issue but i cannot fix it. I followed this but no luck, some one help me?

    0
    Comment actions Permalink
  • Avatar
    Julian Bonpland Mignaquy

    Hi Buyanbat Ulziikhuu, after applying the solution are you getting the same error? Which one exactly?

    I recommend opening a support ticket so we can investigate this https://support.plesk.com/hc/en-us/articles/213608509-How-to-submit-a-request-to-Plesk-support-

    0
    Comment actions Permalink
  • Avatar
    Carlos Donado Felices

    Hello, I had a similar problem.

    To run php in the command I did the following:

    1: /opt/plesk/php/7.3/bin/php (here your command or route)
    2: Then I connected by SSH and entered the console.
    3: Activate the cronjob with the following command
     3.1: # systemctl enable crond
     3.2: # systemctl start crond

    So my problem was solved, I hope to help someone with my contribution. A greeting! :)

    0
    Comment actions Permalink
  • Avatar
    Julian Bonpland Mignaquy

    Carlos Donado Felices Hi! thanks for that. But i believe in your case you had a different scenario where crond was disabled. Thanks again for sharing!

    0
    Comment actions Permalink

Please sign in to leave a comment.

Have more questions? Submit a request