3

Hey All, wrote this script to confuse my girlfriend when she is using my computer. The only trouble is that if the terminal gets closed the script stops to execute. It currently executes in the background but how can I make it run in the background but not in a terminal?

(sleep 5; say "Hello Girlfriend")&
akira
  • 63,447

5 Answers5

4

Have you tried nohup?

nohup command >/dev/null 2>&1 &
2

I promise that no matter how much she likes you, 5 seconds is too fast an interval. Really.

nohup (and in bash disown) will allow you to detach the process from the initiating terminal.

1

You could schedule it to run at a specific time with at or cron in the background.

0

You can suspend execution by Ctrl-Z and then let it run in the background with bg ( background ).

If you want to bring it forth then fg or %.

AxeZ
  • 21
0

use at or cron as john suggested, and then use wall to send her a message to her terminal.

akira
  • 63,447