These jobs are stored in /var/spool/atjobs
If you look at them, they are just shell scripts. AND, they have all the
shell variable defined when the at command was run. So, I would just export
the variables you want to be available when atd runs the script, then run at.
And, you can look at these scripts and see just what sort of commands atd is
actually trying to run.
This works:
export MESSAGE;export RECIPIENT;echo 'echo $MESSAGE | smbclient -M
$RECIPIENT' | at now + 1 minute
I haven't fooled around with the time variable, but that shouldn't be
any
different from the others, hopefully.
Joel
Wed, Jan 23, 2002 at 12:39:44PM -0900, Marc Grober wrote:
> I have a perl script that allows for some CGI messaging.
> I decided to add smb messaging as an option so did a
> system call to pipe the message so:
>
> /usr/bin/echo $MESSAGE | /usr/local/bin/smbclient \
> -M $RECIPIENT | /usr/bin/at -t $TIME
>
> Unfortunately, what happens is that the smbclient action is executed
> immediately (its spawning its own process) and there is a null at job
> created. If I use the here now construct substitution for $MESSAGE
> doesn't take place until the at job is run, and of course at that time
> there is no MESSAGE.......
>
> at -t $TIME <<!
> /usr/bin/echo $MESSAGE | /usr/local/bin/smbclient -M $RECIPIENT
> !
>
> I need to be able to substitue for all variables such as MESSAGE when
> the script is run, but delay running smbclient until scheduled by at.
> I don't want to have a lot of open files to track and even using file$$
> would be impractical as I would still have to somehow track the pid of
> the initial script and then pass that to the at command with a rm....
>
> Any ideas?
>
> I have tried the following:
> system ( "echo '/usr/bin/echo
'\"$MESSAGE\"\|'/usr/local/bin/smbclient
> -M '$RECIPIENT>/tmp/mess$$;at -t $TIME /tmp/mess$$" );
> which works from the command line but not inside the script
> (the $MESSAGE is empty or is just not getting written to the tmp file.....