Sign in with
Sign up | Sign in
Your question

Batch script restart timer

Tags:
  • commands
  • script
  • Computers
  • Apps
  • reboot
  • DOS Batch
Last response: in Apps General Discussion
Share
August 20, 2014 3:54:30 AM

i've been searching for days now, can't find it anywhere. Im looking for a way to reboot the computer using a batch script but with a timer which is set by the user. so if the user wants to reboot the computer in 5 minutes, the script should do that.

(sorry for the poor english.)

More about : batch script restart timer

August 20, 2014 4:14:02 AM

Do you mean five minutes from now, every five minutes, or five minutes after boot?

If you read the man page for shutdown, you'll see that you need to specify a time as part of the command.

Run 'shutdown 5' for five minutes from now.
m
0
l
August 20, 2014 4:21:55 AM

Someone Somewhere said:
Do you mean five minutes from now, every five minutes, or five minutes after boot?

If you read the man page for shutdown, you'll see that you need to specify a time as part of the command.

Run 'shutdown 5' for five minutes from now.


The 5 minutes is just for example. It's really just what the user wants. So if the user want to reboot in 6 minutes he typs "6" and the command should pick that up and reboot in 6 minutes. or 8 or 20 or two hours. It's just really about the imput of the user.
m
0
l
August 20, 2014 5:43:58 AM

Ah. I don't remember how to enter data into bash; I don't code for others much so tend to just use command line arguments.

A quick Google shows something along the lines of this: (UNTESTED!)
  1. #!/bin/bash
  2. echo "Enter time to wait (in minutes) before shutting down:"
  3. read minutes
  4. shutdown $minutes
m
0
l
!