PDA

View Full Version : trouble with "at" utility


maxleifermann
14th April 2012, 02:32 AM
Hi,

I am having some trouble with the "at" utility. I am using Fedora 12 running in VMWare Player.

I created a file at /home/bagside/Downloads/espeak-alarm.sh containing this:

#!/bin/bash
espeak "hello"
echo "hello"

I changed the permissions to read, write, execute:

chmod 777 espeak-alarm.sh

then I tried to use the "at" command:

at -f /home/bagside/Downloads/espeak-alarm.sh 18:27 today

the time was 18:26:38: when I entered the at command:
date
Fri Apr 13 18:26:38 PDT 2012

but nothing happened at 18:27, neither a sound or the echoed "hello".

the script espeak-alarm works when executed from the shell and the word "hello" is spoken.

I have tried many permutations of the at command, using different time formats, also I have read the man pages and searched on Google for an answer, but to no avail! Please help if you can see what I am doing wrong, thank you in advance!

-- Max

bob
14th April 2012, 03:12 AM
Moved to EOL

jpollard
14th April 2012, 03:23 AM

The environment of the commands executing in the "at" job is not the same as the environment of a user login at the console. The espeak should have generated an error message as it does not have access to the audio.

It should also happen if you opened a ssh session to your system and tried to run it from a remote host.

maxleifermann
14th April 2012, 03:36 AM
Thank you for your reply, but I don't understand why the "echo 'hello'" part of the espeak-alarm.sh script did not execute?

marko
14th April 2012, 03:38 AM
You can check the environment of the 'at' job by doing your 'at' command

at -f /home/bagside/Downloads/espeak-alarm.sh 22:40 today

then do this to get the listing of queued at jobs:

1) get the job number via "at -l", it's the integer at the far left

at -l
5 Fri Apr 13 22:40:00 2012 a bagside

2) use that job number you got from step 1 to see the at job itself with the -c flag:

at -c 5


This should show the entire at job, look at the PATH and other details of the job to make sure they look correct

maxleifermann
14th April 2012, 05:37 AM
Thanks Marco! I did as you suggested and looked at the PATH variable, it said USERNAME was "bagside" not root (which I was logged in as). So I changed user in my shell to "bagside" and ran the "at" command with the "espeak-alarm.sh" as the command to execute again-- and it worked! Thank you for your help! :)

--Max