Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

02.AutoBackup_crontab_check.sh 4.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #!/bin/bash
  2. Service1=/ED/ED8/Script_ED8/ED8backup-mysql-Auto.sh
  3. Service2=/ED/ED8/Script_ED8/ED8backup-Script_ED8-Auto.sh
  4. Service3=/ED/ED8/Script_ED8/ED8backup-Source_Files-Auto.sh
  5. Service4=/ED/ED8/Script_ED8/ED8Remote_backup.sh
  6. Service5=/ED/ED8/Script_ED8/ED8backup-attachment-Auto.sh
  7. Service6=/ED/ED8/Script_ED8/ED8backup-attachment-rsync-Auto.sh
  8. WHO=`whoami`
  9. crontab -u $WHO -l; echo
  10. crontab -u $WHO -l | grep "$Service1" > /dev/null 2>&1
  11. if [[ $? == 0 ]]; then crontab -u $WHO -l | grep "$Service1" | cut -c 1-8 | grep "#"
  12. if [[ $? != 0 ]]; then echo -e "\033[33mPass. $Service1 was set active. \033[0m"
  13. else echo -e "\033[45;37mWarning! $Service1 was appended, but not be set as executing. \033[0m"
  14. echo -e "Please add below info by command \033[32m\"crontab -u $WHO -e\"\033[0m"
  15. echo -e "\033[33m8 1 * * * $Service1\033[0m"
  16. fi
  17. else echo -e "\033[41;37mFail. $Service1 was not be set as executing. \033[0m"
  18. echo -e "Please add below info by command \033[32m\"crontab -u $WHO -e\"\033[0m"
  19. echo -e "\033[33m8 1 * * * $Service1\033[0m"
  20. fi
  21. crontab -u $WHO -l | grep "$Service2" > /dev/null 2>&1
  22. if [[ $? == 0 ]]; then crontab -u $WHO -l | grep "$Service2" | cut -c 1-8 | grep "#"
  23. if [[ $? != 0 ]]; then echo -e "\033[33mPass. $Service2 was set active. \033[0m"
  24. else echo -e "\033[45;37mWarning! $Service2 was appended, but not be set as executing. \033[0m"
  25. echo -e "Please add below info by command \033[32m\"crontab -u $WHO -e\"\033[0m"
  26. echo -e "\033[33m0 1 1 * * $Service2\033[0m"
  27. fi
  28. else echo -e "\033[41;37mFail. $Service2 was not be set as executing. \033[0m"
  29. echo -e "Please add below info by command \033[32m\"crontab -u $WHO -e\"\033[0m"
  30. echo -e "\033[33m0 1 1 * * $Service2\033[0m"
  31. fi
  32. crontab -u $WHO -l | grep "$Service3" > /dev/null 2>&1
  33. if [[ $? == 0 ]]; then crontab -u $WHO -l | grep "$Service3" | cut -c 1-8 | grep "#"
  34. if [[ $? != 0 ]]; then echo -e "\033[33mPass. $Service3 was set active. \033[0m"
  35. else echo -e "\033[45;37mWarning! $Service3 was appended, but not be set as executing. \033[0m"
  36. echo -e "Please add below info by command \033[32m\"crontab -u $WHO -e\"\033[0m"
  37. echo -e "\033[33m2 1 1 * * $Service3\033[0m"
  38. fi
  39. else echo -e "\033[41;37mFail. $Service3 was not be set as executing. \033[0m"
  40. echo -e "Please add below info by command \033[32m\"crontab -u $WHO -e\"\033[0m"
  41. echo -e "\033[33m2 1 1 * * $Service3\033[0m"
  42. fi
  43. crontab -u $WHO -l | grep "$Service4" > /dev/null 2>&1
  44. if [[ $? == 0 ]]; then crontab -u $WHO -l | grep "$Service4" | cut -c 1-8 | grep "#" > /dev/null 2>&1
  45. if [[ $? != 0 ]]; then echo -e "\033[33mPass. $Service4 was set active. \033[0m"
  46. else echo -e "\033[45;37mWarning! $Service4 was appended, but not be set as executing. \033[0m"
  47. echo -e "Please add below info by command \033[32m\"crontab -u $WHO -e\"\033[0m"
  48. echo -e "\033[33m0 6 * * 1 $Service4\033[0m"
  49. fi
  50. else echo -e "\033[41;37mFail. $Service4 was not be set as executing. \033[0m"
  51. echo -e "Please add below info by command \033[32m\"crontab -u $WHO -e\"\033[0m"
  52. echo -e "\033[33m0 6 * * 1 $Service4\033[0m"
  53. fi
  54. crontab -u $WHO -l | grep "$Service5" > /dev/null 2>&1
  55. if [[ $? == 0 ]]; then crontab -u $WHO -l | grep "$Service5" | cut -c 1-8 | grep "#" > /dev/null 2>&1
  56. if [[ $? != 0 ]]; then echo -e "\033[33mPass. $Service5 was set active. \033[0m"
  57. else echo -e "\033[45;37mWarning! $Service5 was appended, but not be set as executing. \033[0m"
  58. echo -e "Please add below info by command \033[32m\"crontab -u $WHO -e\"\033[0m"
  59. echo -e "\033[33m0 6 1 * * $Service5\033[0m"
  60. fi
  61. else echo -e "\033[41;37mFail. $Service5 was not be set as executing. \033[0m"
  62. echo -e "Please add below info by command \033[32m\"crontab -u $WHO -e\"\033[0m"
  63. echo -e "\033[33m0 6 1 * * $Service5\033[0m"
  64. fi
  65. crontab -u $WHO -l | grep "$Service6" > /dev/null 2>&1
  66. if [[ $? == 0 ]]; then crontab -u $WHO -l | grep "$Service6" | cut -c 1-8 | grep "#" > /dev/null 2>&1
  67. if [[ $? != 0 ]]; then echo -e "\033[33mPass. $Service6 was set active. \033[0m"
  68. else echo -e "\033[45;37mWarning! $Service6 was appended, but not be set as executing. \033[0m"
  69. echo -e "Please add below info by command \033[32m\"crontab -u $WHO -e\"\033[0m"
  70. echo -e "\033[33m30 1 * * * $Service6\033[0m"
  71. fi
  72. else echo -e "\033[41;37mFail. $Service6 was not be set as executing. \033[0m"
  73. echo -e "Please add below info by command \033[32m\"crontab -u $WHO -e\"\033[0m"
  74. echo -e "\033[33m30 1 * * * $Service6\033[0m"
  75. fi;
  76. echo