首页 > 系统相关 >crontab执行shell脚本

crontab执行shell脚本

时间:2022-11-01 13:35:59浏览次数:38  
标签:脚本 shell res caller crontab fs 11035221997 id subject

 

#!/bin/bash
source /etc/profile #需要导入环境变量,否则非原生命令执行不成功

Sendmail(){
smtp='mail.yx.com'
account='[email protected]'
password='123'
to='[email protected]'
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

标签:脚本,shell,res,caller,crontab,fs,11035221997,id,subject
From: https://blog.51cto.com/u_11508007/5813383

相关文章

  • shell数组
    一,数组方法一数组名=(value0value1value2…)array1=(1020304050)方法二数组名=([0]=value[1]=value[2]=value…)array2=([0]=10[1]=20[2]=30[3]=40[......
  • Jsch远程执行shell脚本命令
    分享知识传递快乐JSch是JavaSecureChannel的缩写。JSch是一个SSH2的纯Java实现。它允许你连接到一个SSH服务器,并且可以使用端口转发,X11转发,文件传输等,当然你也可以集成......
  • Shell实现FTP上传文件,并保存执行日志
    分享知识 传递快乐 这篇文章是 ​​Linux实现FTP上传下载​​ 的续篇文章,关于FTP具体语法使用,请参考《​​Linux实现FTP上传下载​​》。FTP上传文件并保存执行日志#!/......
  • Shell函数(函数定义、函数变量、函数调用、函数传参、函数返回值、获取函数返回值)
    分享知识传递快乐 1、函数定义linuxshell可以用户定义函数,然后在shell脚本中可以随便调用。Shell函数定义的语法格式如下:[function]funname[()]{函数体[retu......
  • Shell实现FTP下载文件,并保存执行日志
    分享知识 传递快乐 这篇文章是 ​​Linux实现FTP上传下载​​ 的续篇文章,关于FTP具体语法使用,请参考《​​Linux实现FTP上传下载​​》。FTP下载文件并保存执行日志#!/......
  • shell函数
    shell函数一,函数的定义(两种方式)1.function函数名{command}//这是一种规范写法2.函数名(){//最常用因为最简洁command}函数定义完之后并不会自动......
  • 经分反馈文件脚本old
    1#!/bin/bash23#NO.14MONTH=`date+%Y%m`#当前月份5MONTHDAY=`date+%Y%m%d`#当天6DATEONE=`date-d"1dayago"+"%Y%m%d"`#当前一天前一天7N......
  • 跳转主机脚本
    1#!/bin/bash2echo'========================================================================================'3echo'注:非以下4个IP外(输入000查看其他IP),......
  • unity3d:编辑器脚本,替换选中物体的材质
    usingSystem.Collections;usingSystem.Collections.Generic;usingUnityEngine;usingUnityEditor;publicclassChangeMat:MonoBehaviour{[MenuItem("Tools/Chang......
  • shell循环,函数
    ###########################函数function语法:函数名(){returnm}函数名=========如:#!/bin/basholdboy(){echo'iamoldboy'}oldboy ####################......