2

I have debian linux. I've created from user crontab -e this text:

0 * * * * python /home/user/CronLogic.py
15 * * * * python /home/user/CronLogic.py
30 * * * * python /home/user/CronLogic.py
45 * * * * python /home/user/CronLogic.py
*/1 * * * * date > /tmp/TEST

Last string runs fine but running python script fails with:

/bin/sh: 1: /usr/bin/rcssserver: not found

The code is:

#!/usr/bin/python
cmd ='/usr/bin/rcssserver'
err = open('CronLogicERRORS', 'a')
server = subprocess.Popen(cmdRes, shell=True, stderr=err)

And the error appears in CronLogicERRORS file. What could be wrong here? Without cron script runs fine.

asked Jul 4, 2012 at 14:05
2
  • Python variable is cmd but cmdRes passed to subprocess. Might be worth avoiding shell in subprocess? Commented Jul 4, 2012 at 15:01
  • Well, judging by the given example, Python is not really needed at all. Maybe the OP doesn't show the whole Python script. Commented Jul 4, 2012 at 15:44

1 Answer 1

4
cmd ='/usr/bin/rcssserver'
# ^^^ Too many s's

Now, about your cron usage:

Instead of having the same line 4 times, make it one line of 0,15,30,45, or even better */15. And your */1 is redundant, just plain * is better.

answered Jul 4, 2012 at 14:25
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the tip. I wrote that this script runs ok withour cron ;) Name of binary is accurate.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.