Skip to main content
Solved

Close Terminal Command Delay

  • September 22, 2016
  • 3 replies
  • 19 views

Forum|alt.badge.img+14

Hi All,

We have a script that we locally install on each computer. Does anybody know how I can add a delay so the user has time to type in their password to mount network disks before terminal automatically closes?

Thanks.

Best answer by jack_bishop

Here's one way:

sleep 1800 && osascript -e 'tell application "Terminal" to quit'

The 1800 is seconds. Probably longer than you need, but you get the idea
Is there a reason you are using terminal for password input?

3 replies

Forum|alt.badge.img+9
  • Contributor
  • September 22, 2016

Is this script triggered by an event (startup, login, etc.), running on a schedule, or is it manually executed? If you could provide an example of what the script is doing, it would be helpful.


roiegat
Forum|alt.badge.img+16
  • Valued Contributor
  • September 22, 2016

If your you using a script your could do it in bash using the sleep command. I sometimes use it to ensure the network connection is established before trying to do a network task.


Forum|alt.badge.img+7
  • Contributor
  • Answer
  • September 22, 2016

Here's one way:

sleep 1800 && osascript -e 'tell application "Terminal" to quit'

The 1800 is seconds. Probably longer than you need, but you get the idea
Is there a reason you are using terminal for password input?