Monday, September 12, 2011

Ubuntu automatic shutdown script

Hi, this entry will pass a script that has a menu with functions such as turning off the computer at a time or in a given period or reboot.
I always use it. So I share with you.
Nothing else should create a. Sh and assign permissions to run simply by typing in the terminal the following command chmod a+x <fichero>.sh

sudo su!/bin/sh
echo ” ****Welcome to automatic shutdown script****”
echo “”
echo “”
echo ” MENU”
echo ” 1.-Shutdown PC NOW”
echo ” 2.-Reboot PC NOW”
echo ” 3.-Shutdown PC at a set time
echo ” 4.-Shutdown PC in a given period
echo ” 5.-Exit”
echo “”

echo -p “Select an option: ”; read OPTION
case $OPTION in
1) sudo halt;;
2) sudo reboot;;
3) echo -n ” Enter the time off:
read hour
sudo shutdown -h $hour;;
4)echo -n ” Enter the number of minutes, after which the PC is turned off:
read minutes
sudo shutdown -h $minutes;;
5) exit;;
exit 1;;
exit 0

No comments:

Post a Comment