Glooh
Glooh

Reputation: 521

Why is my cron task working in command line, but not in PLESK?

I want to setup a cronjob that worked perfectly under PLESK 9 on another dedicated server, but can't get it to work in my new dedicated server under PLESK 10. I just can't figure out why.

Some info: I have PHP running as Apache module and:

whereis php says: php: usr/bin/php

And

usr/bin/php -q /var/pathtocronjob

works perfectly in command line. However, when I set this up in PLESK in a "Scheduled task" it just says

-: /usr/bin/php: No such file or directory

I've searched for anything that could help me out, but just can't find any help. Anyone knows why this isn't working and of course... How to fix this?

Upvotes: 3

Views: 7970

Answers (3)

Michael Larsen
Michael Larsen

Reputation: 31

Please make sure to include the first slash /.

You should replace:

usr/bin/php -q /var/pathtocronjob

with

/usr/bin/php -q /var/pathtocronjob

Upvotes: 3

madmus
madmus

Reputation: 21

You won't be able to access lower levels than the hosting/user is asigned on Plesk. This is to prevent user going outside there var/www/vhosts/domein.tld folders. This is a safety built in so user cant mess up the server with exploit commands, but just stay in their own sandbox.

Use the short 'php' instead of 'usr/bin/php'

For example magento reindexing command

    0 */3 * * * php -q httpdocs/shell/indexer.php reindexall

ps: a lot of the usual ssh commands wont work either in the crontab command field!

Upvotes: 2

Michael Zarubin
Michael Zarubin

Reputation: 386

May be some kind of chrooted shell for cron tasks? Look at Admin guide

Upvotes: 2

Related Questions