| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- #!/bin/bash
- Service1=/ED/ED8/Script_ED8/ED8backup-mysql-Auto.sh
- Service2=/ED/ED8/Script_ED8/ED8backup-Script_ED8-Auto.sh
- Service3=/ED/ED8/Script_ED8/ED8backup-Source_Files-Auto.sh
- Service4=/ED/ED8/Script_ED8/ED8Remote_backup.sh
- Service5=/ED/ED8/Script_ED8/ED8backup-attachment-Auto.sh
- Service6=/ED/ED8/Script_ED8/ED8backup-attachment-rsync-Auto.sh
- WHO=`whoami`
-
- crontab -u $WHO -l; echo
- crontab -u $WHO -l | grep "$Service1" > /dev/null 2>&1
- if [[ $? == 0 ]]; then crontab -u $WHO -l | grep "$Service1" | cut -c 1-8 | grep "#"
- if [[ $? != 0 ]]; then echo -e "\033[33mPass. $Service1 was set active. \033[0m"
- else echo -e "\033[45;37mWarning! $Service1 was appended, but not be set as executing. \033[0m"
- echo -e "Please add below info by command \033[32m\"crontab -u $WHO -e\"\033[0m"
- echo -e "\033[33m8 1 * * * $Service1\033[0m"
- fi
- else echo -e "\033[41;37mFail. $Service1 was not be set as executing. \033[0m"
- echo -e "Please add below info by command \033[32m\"crontab -u $WHO -e\"\033[0m"
- echo -e "\033[33m8 1 * * * $Service1\033[0m"
- fi
-
- crontab -u $WHO -l | grep "$Service2" > /dev/null 2>&1
- if [[ $? == 0 ]]; then crontab -u $WHO -l | grep "$Service2" | cut -c 1-8 | grep "#"
- if [[ $? != 0 ]]; then echo -e "\033[33mPass. $Service2 was set active. \033[0m"
- else echo -e "\033[45;37mWarning! $Service2 was appended, but not be set as executing. \033[0m"
- echo -e "Please add below info by command \033[32m\"crontab -u $WHO -e\"\033[0m"
- echo -e "\033[33m0 1 1 * * $Service2\033[0m"
- fi
- else echo -e "\033[41;37mFail. $Service2 was not be set as executing. \033[0m"
- echo -e "Please add below info by command \033[32m\"crontab -u $WHO -e\"\033[0m"
- echo -e "\033[33m0 1 1 * * $Service2\033[0m"
- fi
-
- crontab -u $WHO -l | grep "$Service3" > /dev/null 2>&1
- if [[ $? == 0 ]]; then crontab -u $WHO -l | grep "$Service3" | cut -c 1-8 | grep "#"
- if [[ $? != 0 ]]; then echo -e "\033[33mPass. $Service3 was set active. \033[0m"
- else echo -e "\033[45;37mWarning! $Service3 was appended, but not be set as executing. \033[0m"
- echo -e "Please add below info by command \033[32m\"crontab -u $WHO -e\"\033[0m"
- echo -e "\033[33m2 1 1 * * $Service3\033[0m"
- fi
- else echo -e "\033[41;37mFail. $Service3 was not be set as executing. \033[0m"
- echo -e "Please add below info by command \033[32m\"crontab -u $WHO -e\"\033[0m"
- echo -e "\033[33m2 1 1 * * $Service3\033[0m"
- fi
-
- crontab -u $WHO -l | grep "$Service4" > /dev/null 2>&1
- if [[ $? == 0 ]]; then crontab -u $WHO -l | grep "$Service4" | cut -c 1-8 | grep "#" > /dev/null 2>&1
- if [[ $? != 0 ]]; then echo -e "\033[33mPass. $Service4 was set active. \033[0m"
- else echo -e "\033[45;37mWarning! $Service4 was appended, but not be set as executing. \033[0m"
- echo -e "Please add below info by command \033[32m\"crontab -u $WHO -e\"\033[0m"
- echo -e "\033[33m0 6 * * 1 $Service4\033[0m"
- fi
- else echo -e "\033[41;37mFail. $Service4 was not be set as executing. \033[0m"
- echo -e "Please add below info by command \033[32m\"crontab -u $WHO -e\"\033[0m"
- echo -e "\033[33m0 6 * * 1 $Service4\033[0m"
- fi
-
- crontab -u $WHO -l | grep "$Service5" > /dev/null 2>&1
- if [[ $? == 0 ]]; then crontab -u $WHO -l | grep "$Service5" | cut -c 1-8 | grep "#" > /dev/null 2>&1
- if [[ $? != 0 ]]; then echo -e "\033[33mPass. $Service5 was set active. \033[0m"
- else echo -e "\033[45;37mWarning! $Service5 was appended, but not be set as executing. \033[0m"
- echo -e "Please add below info by command \033[32m\"crontab -u $WHO -e\"\033[0m"
- echo -e "\033[33m0 6 1 * * $Service5\033[0m"
- fi
- else echo -e "\033[41;37mFail. $Service5 was not be set as executing. \033[0m"
- echo -e "Please add below info by command \033[32m\"crontab -u $WHO -e\"\033[0m"
- echo -e "\033[33m0 6 1 * * $Service5\033[0m"
- fi
-
- crontab -u $WHO -l | grep "$Service6" > /dev/null 2>&1
- if [[ $? == 0 ]]; then crontab -u $WHO -l | grep "$Service6" | cut -c 1-8 | grep "#" > /dev/null 2>&1
- if [[ $? != 0 ]]; then echo -e "\033[33mPass. $Service6 was set active. \033[0m"
- else echo -e "\033[45;37mWarning! $Service6 was appended, but not be set as executing. \033[0m"
- echo -e "Please add below info by command \033[32m\"crontab -u $WHO -e\"\033[0m"
- echo -e "\033[33m30 1 * * * $Service6\033[0m"
- fi
- else echo -e "\033[41;37mFail. $Service6 was not be set as executing. \033[0m"
- echo -e "Please add below info by command \033[32m\"crontab -u $WHO -e\"\033[0m"
- echo -e "\033[33m30 1 * * * $Service6\033[0m"
- fi;
-
- echo
|