ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
This is to run on a specific time every day (test-script : sleep for 2 minutes).
What it gives me is this:
1) It doesn't run
2) I get a mail from the crontab with the following in it:
Subject:
Code:
Cron <me@server> /usr/bin/php /home/me/sleep.php `/bin/date -d"7 days ago" +
Body:
Code:
/bin/sh: -c: line 0: unexpected EOF while looking for matching ``'
/bin/sh: -c: line 1: syntax error: unexpected end of file
Searching on Google I couldn't find anything... Also when I run it as "/bin/sh -c /usr/bin/php /home/steven/sleep.php `/bin/date -d"7 days ago" +"%Y-%m-%d"`" it runs without a problem...
So why is crontab behaving this way? And how can I solve it?
So why is crontab behaving this way?
Maybe it adheres more to "true" Bourne (sh) Shell quoting than /bin/sh.
On most GNU/Linux /bin/sh is link to /bin/bash, the Bourne Again SHell.
And how can I solve it?
Move cron line to a script, execute script from crontab?
Thanks unSpawn. I could do that, but the reason I don't want to do that is because then I have for each php-script an additional shell script... Which is kinda like "bad" in my eyes
Now I get the error "Could not open input file: /home/steven/sleep.php" (which is quite normal as I already deleted the file)... But also the subject is completely correct now!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.