How to script at job creation?
Colin Watson
cjwatson at ubuntu.com
Fri Dec 11 12:09:23 UTC 2020
On Fri, Dec 11, 2020 at 08:12:54AM +0100, Bo Berglund wrote:
> I must be missing something important because I cannot get this to
> work from within a script...
> This is what I have now and it just refuses to *run* the echo command
> inside the terminal.
>
> #!/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
Something like the following approach makes the quoting much easier to
follow. I recommend it instead of using "eval" or similar approaches.
#! /bin/bash
NEXTDAY="$(date --date=tomorrow +%Y-%m-%d)"
at 00:58 tomorrow <<EOF
timeout --signal=2 65m getmsnbcstream ${NEXTDAY}_inp19.mp4
EOF
--
Colin Watson (he/him) [cjwatson at ubuntu.com]
More information about the ubuntu-users
mailing list