1

I use Ubutu server 16 .04 and I desire to echo something in the foreground, 2 days ahead, with sleep in the background.

I assume the code I need is similar to the one below (which does both actions in background):

(sleep 2d; echo "Surprise!") &

The problem

The problem is actually comprised of the problems:

  1. I have no idea how to make sleep in the background but its adjacent echo in the foreground.

  2. Even if number 1 is possible, If I'll keep my computer opened, this will appear on my (basic shell's) stdout, after 2 days, but what if in between execution and stdout rendering, I rebooted my system, or had a power cut... If I'm not wrong, these will delete the sleep and the echo from memory and I couldn't enjoy the bounty of their combination.

The question

Is there a way to make an echoed statement appear in my basic shell's stdout (the console I start with after init) even if there was a reboot/power cut, in between?

In other words, I just want to make myself a reminder "Do this, do that" after 2 days, regardless of reboot or any booting of my system.

0

Use at to schedule the job, and wall to broadcast the message to all logged in users:

$ echo 'echo some message |wall' | at "now +5 min"
warning: commands will be executed using /bin/sh
job 6 at Tue Dec  5 00:52:00 2017

[five minutes later]

Broadcast message from i...@...a (somewhere) (Tue Dec  5 00:52:00 2017):

some message

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.