Skip to content

Commit

Permalink
Update serverchand
Browse files Browse the repository at this point in the history
  • Loading branch information
zzsj0928 authored Sep 18, 2020
1 parent e993a81 commit 75cdd6a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions root/usr/bin/serverchand/serverchand
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ function send(){
local cpuload=`getcpu`
local ramload=`free -m|sed -n '2p'|awk '{print""($3/$2)*100"%"}'`
local systemstatustime=`cat /proc/uptime|awk -F. '{run_days=$1 / 86400;run_hour=($1 % 86400)/3600;run_minute=($1 % 3600)/60;run_second=$1 % 60;printf("运行时间:%d天%d时%d分%d秒",run_days,run_hour,run_minute,run_second)}'`;unset run_days run_hour run_minute run_second
local send_content="${send_content}${markdown_splitline}#### <font color=#76CCFF>系统运行状态</font>"
local send_content="${send_content}${markdown_splitline}#### **<font color=#76CCFF>系统运行状态</font>**"
local send_content="${send_content}${markdown_linefeed}${markdown_tab}平均负载:${systemload}"
local send_content="${send_content}${markdown_linefeed}${markdown_tab}CPU占用:${cpuload}25"
local send_content="${send_content}${markdown_linefeed}${markdown_tab}内存占用:${ramload}25"
Expand All @@ -760,7 +760,7 @@ function send(){

if [ ! -z "$router_wan" ] && [ "$router_wan" -eq "1" ]; then
local send_wanIP=`getip wanipv4`;local send_hostIP=`getip hostipv4`
local send_content="${send_content}${markdown_splitline}#### <font color=#76CCFF>WAN 口信息</font>${markdown_linefeed}${markdown_tab}接口ip:${send_wanIP}"
local send_content="${send_content}${markdown_splitline}#### **<font color=#76CCFF>WAN 口信息</font>**${markdown_linefeed}${markdown_tab}接口ip:${send_wanIP}"
local send_content="${send_content}${markdown_linefeed}${markdown_tab}外网ip:${send_hostIP}"
if [ ! -z "$serverchand_ipv6" ] && [ "$serverchand_ipv6" -ne "0" ]; then
local send_wanIPv6=`getip wanipv6`;local send_hostIPv6=`getip hostipv6`
Expand All @@ -776,7 +776,7 @@ function send(){
wait

local IPLIST=`cat ${dir}ipAddress 2>/dev/null|awk '{print $1}'`
[ -z "$IPLIST" ] && local send_content="${send_content}${markdown_splitline}#### <font color=#76CCFF>当前无在线设备</font>" || local send_content="${send_content}${markdown_splitline}#### <font color=#76CCFF>在线设备</font>"
[ -z "$IPLIST" ] && local send_content="${send_content}${markdown_splitline}#### **<font color=#FF6666>当前无在线设备</font>**" || local send_content="${send_content}${markdown_splitline}#### **<font color=#76CCFF>在线设备</font>**"
for ip in $IPLIST; do
local ip_total=`usage get ${ip}`;[ ! -z "$ip_total" ] && local ip_total="总计流量:${ip_total} "
local time_up=`cat ${dir}ipAddress|grep -w ${ip}|awk '{print $4}'|grep -v "^$"|sort -u`
Expand All @@ -791,7 +791,7 @@ function send(){
fi
[ ! -z "$device_name" ] && local send_title="$device_name${send_title}"
local send_title=`echo "$send_title"|sed $'s/\ / /g'|sed $'s/\"/%22/g'|sed $'s/\#/%23/g'|sed $'s/\&/%26/g'|sed $'s/\,/%2C/g'|sed $'s/\//%2F/g'|sed $'s/\:/%3A/g'|sed $'s/\;/%3B/g'|sed $'s/\=/%3D/g'|sed $'s/\@/%40/g'`
[ -z "$send_content" ] && local send_content="${markdown_splitline}#### 我遇到了一个难题${markdown_linefeed}${markdown_tab}定时发送选项错误,你没有选择需要发送的项目,该怎么办呢${markdown_splitline}"
[ -z "$send_content" ] && local send_content="${markdown_splitline}#### <font color=#FF6666>我遇到了一个难题</font>${markdown_linefeed}${markdown_tab}定时发送选项错误,你没有选择需要发送的项目,该怎么办呢${markdown_splitline}"
local nowtime=`date "+%Y-%m-%d %H:%M:%S"`
serverchand_send="curl -s \"https://oapi.dingtalk.com/robot/send?access_token=${sckey}\" -H 'Content-Type: application/json' -d '{\"msgtype\": \"markdown\",\"markdown\": {\"title\":\"${send_title}\",\"text\":\"${nowtime}${markdown_linefeed}${send_content}\"}}'"
[ "$send_disturb" -eq "0" ] && [ -z "$send_tg" ] && eval $serverchand_send >/dev/null 2>&1
Expand Down

0 comments on commit 75cdd6a

Please sign in to comment.