You are not logged in.

#1 2021-12-10 11:01:40

tethys
Member
Registered: 2019-08-13
Posts: 51

[SOLVED] How to echo or print output with "at"

Hello community,

I know that this has something to do with subshells but I could not solve it with a quick search.

$ echo hello
hello

But when I give:

$ echo "echo hello" | at 11:54
warning: commands will be executed using /bin/sh
job 15 at Fri Dec 10 11:54:00 2021

there is no output in the terminal after the job is executed.

I actually want to execute a python script that produces output using the same method. But I suppose that what works for echo will work for pyhton scripts.

Last edited by tethys (2021-12-10 13:13:53)

Offline

#2 2021-12-10 12:00:16

ayekat
Member
Registered: 2011-01-17
Posts: 1,486
Website

Re: [SOLVED] How to echo or print output with "at"

at(1p) wrote:

The at-job shall be executed in a separate invocation of the shell, running in a separate process group with no controlling terminal, except that the environment variables, current working directory, file creation mask, and other implementation-defined execution-time attributes in effect when the at utility is executed shall be retained and used when the at-job is executed.

[…]

OPTIONS

  • -m Send mail to the invoking user after the at-job has run, announcing its completion. Standard output and standard error produced by the at-job shall be mailed to the user as well, unless redirected elsewhere. Mail shall be sent even if the job produces no output.

    If -m is not used, the job's standard output and standard error shall be provided to the user by means of mail, unless they are redirected elsewhere; if there is no such
    output to provide, the implementation need not notify the user of the job's completion.

I have never used at myself, but I guess unless you specify where the output should go, it won't show up anywhere.


{,META,RE}PKGBUILDSpacman-hacks (includes makemetapkg and remakepkg) │ dotfiles

Offline

#3 2021-12-10 13:13:35

tethys
Member
Registered: 2019-08-13
Posts: 51

Re: [SOLVED] How to echo or print output with "at"

The at-job shall be executed in a separate invocation of the shell, running in a separate process group with no controlling terminal ...

Thank you ayekat for your answer, I missed that. I guess that solves the question asked in this thread. I will try to implement the function I need in the python script itself.

Offline

#4 2021-12-10 14:29:25

seth
Member
Registered: 2012-09-03
Posts: 26,570

Re: [SOLVED] How to echo or print output with "at"

echo "echo snafu > $TTY" | at now + 1 minute

Offline

#5 2021-12-10 14:40:46

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 26,197
Website

Re: [SOLVED] How to echo or print output with "at"

I take it the above was meant as a placeholder, right?  To actually implement it:

echo "echo snafu > $(tty)" | at ...

"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#6 2021-12-10 14:48:19

seth
Member
Registered: 2012-09-03
Posts: 26,570

Re: [SOLVED] How to echo or print output with "at"

"zshism" tongue

Offline

#7 2021-12-10 19:35:35

tethys
Member
Registered: 2019-08-13
Posts: 51

Re: [SOLVED] How to echo or print output with "at"

Thank you for all your answers. I finally learned something about tty.

Offline

Board footer

Powered by FluxBB