crontab执行shell脚本
#!/bin/bash source /etc/profile #需要导入环境变量,否则非原生命令执行不成功 Sendmail(){ smtp='mail.yx.com' account='he@yx.com' password='123' to='liu@yx.com' subject=$1 content=$2 sendemail -f $account -t $to -s $smtp -u $subject -o message-charset=utf8 -xu $account -xp $password -m $content -o tls=no } res=`fs_cli -x "originate {absolute_codec_string=^^:PCMA,bridge_early_media=true,origination_caller_id_number=1007,origination_uuid=11035221997,origination_caller_id_number=11035221997,effective_caller_id_number=11035221997, effective_caller_id_name=11035221997}user/1007 11_Mogu_551113812266322" 2>&1` echo "`date`, Mogu, $res" >>/usr/local/fs/scripts/fs.log 2>&1 if [ ${res: 0: 3} != '+OK' ];then #echo $res subject='Dial failed from Mogu' Sendmail "$subject" "${res: 1: 10000}" fi
crontab -l 内容:
2 8 * * * /bin/bash /usr/local/fs/scripts/mon_dial_mogu.sh
4 8 * * * /bin/bash /usr/local/fs/scripts/mon_dial_beishang.sh
分类:
Linux
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
2016-10-28 Zabbix监控Windows事件日志
2014-10-28 查看系统和PowerShell版本
2014-10-28 批处理中的变量
2013-10-28 创建快捷方式,修改注册表
2013-10-28 常用组策略