septimamus

Estimable
Aug 20, 2014
2
0
4,510
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.)
 

septimamus

Estimable
Aug 20, 2014
2
0
4,510


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.
 
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!)
Code:
#!/bin/bash
echo "Enter time to wait (in minutes) before shutting down:"
read minutes
shutdown $minutes