0

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).

jurchiks
  • 103
  • 3

2 Answers2

0

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 
user9517
  • 115,471
  • 20
  • 215
  • 297
  • Ok, I got this: `/bin/sh: /var/www/cron/webcrontest.sh: /bin/sh^M: bad interpreter: No such file or directory` What can I do about it? Edit: changed to /bin/bash, will see if it helps any. Edit2: /bin/bash - same thing. – jurchiks Aug 11 '11 at 14:04
  • Use a linux editor to edit the file. You'll probably see ^M at the end of each line, remove them. Is this a file that you edited on windows and uploaded ? – user9517 Aug 11 '11 at 14:07
  • Just edited it with Notepad++, changed EOL and it works now. I'll test it with some more stuff. – jurchiks Aug 11 '11 at 14:11
  • Yeah, that works too. lots of solutions when you know what the problem is ;) – user9517 Aug 11 '11 at 14:16
-1
dos2unix /var/www/cron/webcrontest.sh
quanta
  • 51,413
  • 19
  • 159
  • 217