User Tools

Site Tools


linux:bash_reboot_machine
#!/bin/bash
 
#
# Color definition
#
red='\033[0;31m' ; bred='\033[1;31m' ; green='\033[0;92m' ; blue='\033[0;36m' ; bold='\033[1m' ; normal='\033[0m'
#
# Function reboot
#
rebootserver () {
wait_time=10
echo -ne "${blue}"
temp_cnt=${wait_time}
while [[ ${temp_cnt} -gt 0 ]];
do
    printf "\rRebooting in %2d second(s) - hit ctrl+c to cancel ..." ${temp_cnt}
    sleep 1
    ((temp_cnt--))
done
reboot
}
#
# Execute function reboot
#
rebootserver
linux/bash_reboot_machine.txt · Last modified: 12/01/2024 15:01 by Allan