1.有时候运维需求自动生成 Cronab 任务计划,执行对应服务名称进行管理; #!/bin/bash #athor check crontab crontab_add(){ cron_path="$1" cat >/etc/cron.d/$cron_path<<EOF # Run service application */5 * * * * root /chj/app/$cron_path/bin/console start EOF } check_crontab (){ app_name="$1" if [ ! -f /etc/cron.d/$app_name ] then crontab_add "$1" else echo "File already exists" fi } if [ "$1" == "" ] then echo -e "\033[41;37m 没有参数,不能允许程序执行,已经停止 \033[0m" exit 1 else check_crontab "$1" echo -e "\033[32m crontab 已经开始写入 \033[0m" fi
Shell 脚本自动生成Crontab
原创breaklinux 博主文章分类:Shell ©著作权
文章标签 Shell 脚本自动生成Crontab 文章分类 运维
上一篇:日志架构与部署
下一篇:01-日常管理脚本-环境划分;
-
shell脚本编写笔记
shel编程基础知识
linux基础知识 linux 文件名 字符串 -
Shell iOS 脚本编写 shell脚本编写
shell脚本编写步骤及其常用命令和符号
Shell iOS 脚本编写 shell 命令 参数 脚本