Linux – Set up a linux shell script cron job on Plesk 9.5.4

cronlinuxshell-scripting

Operating system Linux 2.6.18-028stab089.1
Parallels Plesk Panel version 9.5.4

Set up a test cron job in Settings>Scheduled Tasks>user "root">
* * * * * /var/www/cron/webcrontest.sh >/dev/null 2>&1
The script contains this:

#!/bin/sh
echo "test" >>/var/www/cron/webcrontest.log

However, nothing gets output in that file.
How could I find out what's the problem? I have no access to the e-mail that the cron jobs could be sent to (not my host, trying to set up a cron job for a client because he doesn't listen when I say it's the sysadmins job).

Best Answer

You are discarding any diagnostic information you might have by sending stdout & stderr to /dev/null (>/dev/null 2>&1).

Try redirecting the output to a file and seeing what it contains

* * * * * /var/www/cron/webcrontest.sh &>/tmp/webcrontest.out

Which will write stdout and stderr to /tmp/webcrontest.out.

Edit: From the comments, you have DOS line endings, use dos2unix to remove the ^M line endings

dos2unix /var/www/cron/webcrontest.sh