Search code examples
shellunixpiping

How can I pipe command output to a pause command, which defers execution for a given length of time?


Is it possible to do something like this in unix?

monit restart | pause 120 | monit status

I just happen to be monitoring monit which restarts and then i find myself repeatedly outputting the status until I see the change I am looking for in the status. This won't happen until exactly 2 minutes later.

So I just wondered if there was a way to defer a unix command to happen after some time period. Anything built in would be better, but if writing some utility script is the only way, then that's cool too.

Thanks!


Solution

  • monit restart && sleep 120 && monit status