3

I'm trying to use at command in the following,

at 19:32 04/02/2015 < /usr/bin/python /home/myscript.py

But I get the error

syntax error. Last token seen: /
Garbled time

I'd like to run the script directly from shell without having to placing the python command in a .sh script and using at -f python.sh

1 Answer 1

2

Two problems;

  • The at date format is funny (not quite Yoda funny but still).

  • You are trying to use file redirection on something which isn't a file.

Try this instead;

at 19:32 Apr 2 <<':'
  /usr/bin/python /home/myscript.py
:

If I am reading the at timespec correctly, the year field is only two digits. It's still dd/mm/yy not American wacky mm/dd/yy.

at 19:32 02/04/15 <<<'/usr/bin/python /home/myscript.py'

Here strings are Bash only; yet another alternative is

echo '/usr/bin/python /home/myscript.py' | at 19:32 02/04/15
Sign up to request clarification or add additional context in comments.

4 Comments

Everything right, except the timespec works on the "American wacky mm/dd/yy" :)
Hmm, looks like that is locale-dependent, actually. I was looking at an ancient BSD man page.
Ah, echoing any script/command does'nt seem to work here, does it work on your end? echo "any_command" | at 19:32 02/04/15
Huh? at doesn't care (and indeed cannot know) how the shell connects its standard input before it runs. A pipe is just as fine as a here document or (in Bash) a here string.

Your Answer

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.