reboot.sh 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/bin/bash
  2. #Script Auto Reboot Vps
  3. #Creted By OKKAY KAYYO
  4. RED='\e[1;31m'
  5. GREEN='\e[0;32m'
  6. BLUE='\e[0;34m'
  7. NC='\e[0m'
  8. # Auto Reboot
  9. Green_font_prefix="\033[32m" && Red_font_prefix="\033[31m" && Green_background_prefix="\033[42;37m" && Red_background_prefix="\033[41;37m" && Font_color_suffix="\033[0m"
  10. Info="${Green_font_prefix}[ON]${Font_color_suffix}"
  11. Error="${Red_font_prefix}[OFF]${Font_color_suffix}"
  12. cek=$(cat /home/autoreboot)
  13. function start () {
  14. echo "0 0 * * * root /usr/bin/reboot" > /etc/cron.d/reboot
  15. echo "start" > /home/autoreboot
  16. echo "Done"
  17. }
  18. function start () {
  19. echo "0 0 * * * root /usr/bin/reboot" > /etc/cron.d/reboot
  20. echo "start" > /home/autoreboot
  21. echo "Done"
  22. }
  23. function stop () {
  24. rm /etc/cron.d/reboot
  25. sleep 0.5
  26. echo > /home/autoreboot
  27. echo "Done"
  28. }
  29. #Status Auto Reboot
  30. if [[ "$cek" = "start" ]]; then
  31. sts="${Info}"
  32. else
  33. sts="${Error}"
  34. fi
  35. clear
  36. # Echo Shell
  37. echo -e "${GREEN}========================================================= ${NC}"
  38. figlet Auto Reboot | lolcat
  39. echo -e "${GREEN}========================================================= ${NC}"
  40. echo -e "Status $sts"
  41. echo -e " 1. Start Auto Reboot"
  42. echo -e " 2. Stop Auto Reboot"
  43. echo -e ""
  44. echo -e "Press CTRL+C to return"
  45. read -rp "Please Enter The Correct Number : " -e num
  46. if [[ "$num" = "1" ]]; then
  47. start
  48. elif [[ "$num" = "2" ]]; then
  49. stop
  50. else
  51. echo "You Entered The Wrong Number"
  52. fi