How to script at job creation?
Bo Berglund
bo.berglund at gmail.com
Fri Dec 11 10:10:36 UTC 2020
On Fri, 11 Dec 2020 19:19:34 +1100, Karl Auer <kauer at biplane.com.au>
wrote:
>On Fri, 2020-12-11 at 08:12 +0100, Bo Berglund wrote:
>> #!/bin/bash
>> NEXTDAY=`date --date="tomorrow" +%Y-%m-%d`
>> CMDTIM1="echo \"timeout --signal=2 65m getmsnbcstream ${NEXTDAY}_"
>> #Now create the at jobs
>> CMDAT="${CMDTIM1}inp19.mp4\" | at 00:58 tomorrow"
>> $CMDAT
>> exit
>
>You are hiding shell control from the current shell. To fix, just put
>"eval" at the start of the second-last line:
>
>eval $CMDAT
Thanks!
This is what solved the problem.
Seems similar to the Windows exec command.
>
>There is no need to build commands like that unless you do actually
>want to echo them. Here is an alternative (untested!):
The only way I found by searching the net in order to have a 1-line
command to set an at task was to use the echo trick and pipe the
output into at as shown.
Since I have 16 such at tasks to create I wanted to write a script for
it.
And then I got into the echo problem...
What I showed here was of course only the first call...
>echo $ATINPUT | $AT
I guess you forgot the eval keyword here... :)
>Also, there is no need to explicitly exit a shell script unless you
>want to set a specific return value. The script will exit with the
>return value of the most recently executed command.
My exit was here in order to stop the script after the first command
when testing.
I do not have an exit otherwise.
Thanks again!
--
Bo Berglund
Developer in Sweden
More information about the ubuntu-users
mailing list