#!/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 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[33m#// Create backup file every 2 days at 01:08\033[0m" echo -e "\033[33m8 1 */2 * * $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[33m#// Create backup file every 2 days at 01:08\033[0m" echo -e "\033[33m8 1 */2 * * $Service1\033[0m" fi echo 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[33m#// Create backup file every first day of month at 01:06" echo -e "\033[33m6 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[33m#// Create backup file every first day of month at 01:06" echo -e "\033[33m6 1 1 * * $Service2\033[0m" fi echo 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[33m#// Create backup file every first day of month at 01:00" echo -e "\033[33m0 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[33m#// Create backup file every first day of month at 01:00" echo -e "\033[33m0 1 1 * * $Service3\033[0m" fi echo 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[33m#// Create backup file every Monday 06:00" 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[33m#// Create backup file every Monday 06:00" echo -e "\033[33m0 6 * * 1 $Service4\033[0m" fi echo echo