#!/bin/bash Service1=/ED/ED8/Script_ED8/ED8backup-mysql-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 is running. \033[0m" else echo -e "\033[41;37mFail. $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[33m28 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[33m28 1 */2 * * $Service1\033[0m" fi echo