You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

02.AutoBackup_crontab_check.sh 868B

преди 6 години
123456789101112131415161718192021222324252627
  1. #!/bin/bash
  2. Service1=/ED/ED8/Script_ED8/ED8backup-mysql-Auto.sh
  3. WHO=`whoami`
  4. crontab -u $WHO -l
  5. echo
  6. crontab -u $WHO -l | grep "$Service1" > /dev/null 2>&1
  7. if [[ $? == 0 ]]; then
  8. crontab -u $WHO -l | grep "$Service1" | cut -c 1-8 | grep "#"
  9. if [[ $? != 0 ]]; then
  10. echo -e "\033[33mPass. $Service1 is running. \033[0m"
  11. else
  12. echo -e "\033[41;37mFail. $Service1 was appended, but not be set as executing. \033[0m"
  13. echo -e "Please add below info by command \033[32m\"crontab -u $WHO -e\"\033[0m"
  14. echo -e "\033[33m28 1 */2 * * $Service1\033[0m"
  15. fi
  16. else
  17. 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[33m28 1 */2 * * $Service1\033[0m"
  20. fi
  21. echo