imported virtual server - cron problem

I’ve imported a virtual server yesterday, and all seems well except for one thing. The cron jobs related to the domain are/were all there in webmin, and at least one of them doesn’t work:

the cronjob is to open a dynamic page, read it and save it as an (static) .html page (overwriting the old one). In this case, it does this once an hour. The cron job is run by user ‘root’ and is active.

If I run the command in a browser (perl script) than it does the trick. I deleted the ‘old’ page (the one it has to write over) so it couldn’t have a problem with the old file but still the cronjob doesn’t succeed.

When I click the ‘run now’ button it doesn’t work either, so I got rid of the " > /dev/null 2>&1" behind the command.

When I clicked ‘run now’ again it says this:

Output from command /home/klanten/allesoversterrenkunde.nl/user/htdocs/cgi-bin/scripts/cacher.pl?homefolders=yes ..

/bin/sh: /home/klanten/allesoversterrenkunde.nl/user/htdocs/cgi-bin/scripts/cacher.pl?homefolders=yes: not found

I don’t know what the bin/sh is doing there but find it strange it says ‘not found’ as it’s certainly there.

If I do the same with another cron job (same domain) all goes well, output:

Output from command /home/klanten/allesoversterrenkunde.nl/user/htdocs/cgi-bin/scripts/fotovandedag.pl ..

Content-type: text/html

titel:
plaatje:

I really don’t get it.

Someone here?

Howdy,

Just to be super-sure, can you run this:

ls -l /home/klanten/allesoversterrenkunde.nl/user/htdocs/cgi-bin/scripts/cacher.pl

Also, can you attach the crontab file for the user in question (which looks like “klanten”)?

For that, you can look in /var/spool/cron/crontabs/, it should be a file named “klanten”.

Lastly, can you include the first 5 lines or so of the above script (assuming that doesn’t have any passwords in it)?

Thanks!

-Eric

ls -l /home/klanten/allesoversterrenkunde.nl/user/htdocs/cgi-bin/scripts/cacher.pl

=

root@server2:/# ls -l /home/klanten/allesoversterrenkunde.nl/user/htdocs/cgi-bin/scripts/cacher.pl
-rwxr-xr-x 1 govert matrixdomain 4660 2009-08-12 09:13 /home/klanten/allesoversterrenkunde.nl/user/htdocs/cgi-bin/scripts/cacher.pl
root@server2:/#

only one crontab file, called ‘root’, and the part with the command in it is (last line):

AOS

*/5 * * * * /home/klanten/allesoversterrenkunde.nl/user/htdocs/cgi-bin/scripts/homepagekopieerder-NEW.pl > /dev/null 2>&1
*/15 * * * * /home/klanten/allesoversterrenkunde.nl/user/htdocs/cgi-bin/scripts/filecopy-aardebolletje.pl > /dev/null 2>&1
10 0,2,4,6,8,10,12,14,16,18,20,22 * * * /home/klanten/allesoversterrenkunde.nl/user/htdocs/cgi-bin/scripts/fotovandedag.pl
15 0,1,2,6,7 * * * /home/klanten/allesoversterrenkunde.nl/user/htdocs/cgi-bin/scripts/utrecht-kopieerder.pl > /dev/null 2>&1
20 * * * * /home/klanten/allesoversterrenkunde.nl/user/htdocs/cgi-bin/scripts/cacher.pl?homefolders=yes > /dev/null 2>&1

The script it calls is atached.

Hmm, okay.

I’m wondering about some of the characters being passed in as parameters – they may be interpreted by bash as being “special”.

What happens if you change the last line to read:

20 * * * * ‘/home/klanten/allesoversterrenkunde.nl/user/htdocs/cgi-bin/scripts/cacher.pl?homefolders=yes’ > /dev/null 2>&1

What I did is put ticks (apostrophes) around the command.

-Eric

thanks for the suggestion. Just tried it to no avail. Would have been good obviously…

I tried first with single quote, then with double " but still nothing

i saved the script as another scrip ans stripped functions that weren’t needed for this typical thing so i wouldn’t need the extra arguments:

          • /home/klanten/allesoversterrenkunde.nl/user/htdocs/cgi-bin/scripts/cacherhomepages.pl > /dev/null 2>&1

(every minute for testing)

works fine like this.

Not as beautiful this solution obviously, but hey, for now it serves its purpose…

Thanks people!