求linux脚本,就是服务器自动检测网络,每个一段时间自动检测,丢包严重或断网,就自动重启服务器,求高手

求linux脚本,就是服务器自动检测网络,每个一段时间自动检测,丢包严重或断网,就自动重启服务器,求高手,第1张

因为服务器自身网络丢包和断网

1.数据交互过大

2.一段时间网口down掉

其实只要

/etc/init.d/network restart

并不需要重启。

在/etc/rc.d/rc.local最下面加一句话

network.sh &

把下面脚本放到/usr/bin/目录

并且给她加权限

chmod +x /usr/bin/network.sh

network.sh脚本:

#!/bin/sh

#echo "请输入你的网关地址"

#read sgateway

sgateway="192.168.3.187"

echo "连接的的网关是$sgateway"

delay=5000

echo "设置最大延迟不超过$delay毫秒"

nexttime=18

echo "每隔$nexttime秒进行一次检查"

echo "########################################"

while :

do

network=`ping -c 1 $sgateway | awk 'NR==2 {print $7}' | sed "s/=/ /g" | awk '{print $2}'`

expr ${network} + 0 1>/dev/null 2>&1

if [ $? -eq 0 ]then

/etc/init.d/network restart

else

value_n=`echo $network | sed "s/\.//g"`

if [ "$value_n" -lt "$delay" ]

then

echo "检查结果为"

echo "网络通畅"

echo "网络延迟为$network秒"

echo "########################"

else

/etc/init.d/network restart

fi

fi

sleep $nexttime

done

不给分不给力啊

这个脚本是经常用来测试服务器性能尤其是Ubunut16.04的,在购买vps之后可以用来测试一下性能

对服务器信息、CDN加速节点的Speedtest测速、各大洲节点的Speedtest测速、IO测试进行全面测试.

只对服务器信息、CDN加速节点的Speedtest测速、IO测试进行测试.

这是我用的脚本,可以过你说的脚本检测,也就是WWCL.

打开CS目录,找到cstrike文件夹,里面有个confic.cfg把一下输入,关闭点是,OK

unbindall

bind "TAB" "+showscores"

bind "ENTER" "+attack"

bind "ESCAPE" "cancelselect"

bind "SPACE" "+jump"

bind "'" "+moveup"

bind "," "buyammo1"

bind "." "buyammo2"

bind "/" "+movedown"

bind "0" "slot10"

bind "1" "slot1"

bind "2" "slot2"

bind "3" "slot3"

bind "4" "slot4"

bind "5" "slot5"

bind "6" "slot6"

bind "7" "slot7"

bind "8" "slot8"

bind "9" "slot9"

bind "" "+mlook"

bind "=" "podbotmenu"

bind "[" "invprev"

bind "]" "invnext"

bind "`" "toggleconsole"

bind "a" "+moveleft"

bind "b" "buy"

bind "c" "radio3"

bind "d" "+moveright"

bind "e" "+use"

bind "f" "impulse 100"

bind "g" "drop"

bind "h" "+commandmenu"

bind "i" "showbriefing"

bind "j" "cheer"

bind "k" "+voicerecord"

bind "m" "chooseteam"

bind "n" "nightvision"

bind "o" "buyequip"

bind "q" "lastinv"

bind "r" "+reload"

bind "s" "+back"

bind "t" "impulse 201"

bind "u" "messagemode2"

bind "v" "+duck"

bind "w" "+forward"

bind "x" "radio2"

bind "y" "messagemode"

bind "z" "radio1"

bind "~" "toggleconsole"

bind "UPARROW" "+forward"

bind "DOWNARROW" "+back"

bind "LEFTARROW" "+left"

bind "RIGHTARROW" "+right"

bind "ALT" "hegren"

bind "CTRL" "+duck"

bind "SHIFT" "+speed"

bind "F3" "adjust_crosshair"

bind "F4" "exec net.cfg"

bind "F5" "snapshot"

bind "F6" "save quick"

bind "F7" "load quick"

bind "F10" "quit prompt"

bind "INS" "+klook"

bind "PGDN" "+lookdown"

bind "PGUP" "+lookup"

bind "END" "centerview"

bind "KP_HOME" "b413"

bind "KP_UPARROW" "b424"

bind "KP_PGUP" "awp"

bind "KP_LEFTARROW" "mp5"

bind "KP_5" "p90"

bind "KP_RIGHTARROW" "ump45"

bind "KP_END" "usp"

bind "KP_DOWNARROW" "deagle"

bind "KP_PGDN" "p228"

bind "KP_ENTER" "hegren"

bind "KP_INS" "helm"

bind "KP_DEL" "vest"

bind "KP_SLASH" "nvgs"

bind "KP_MINUS" "defuser"

bind "KP_PLUS" "fb"

bind "CAPSLOCK" "+voicerecord"

bind "MWHEELDOWN" "+jump"

bind "MWHEELUP" "impulse 201"

bind "MOUSE1" "+attack"

bind "MOUSE2" "+attack2"

bind "PAUSE" "pause"

voice_scale "1.000000"

voice_enable "1"

voice_forcemicrecord "1.000000"

console "1.0"

fps_max "101"

fps_modem "0"

crosshair "1.000000"

gamma "3.000000"

brightness "1.000000"

con_color "255 120 255"

net_graph "3"

net_scale "5"

net_graphpos "2"

sv_voiceenable "1"

sv_aim "0.000000"

hpk_maxsize "0"

viewsize "120.000000"

ati_subdiv "2"

ati_npatch "1"

r_bmodelhighfrac "5"

mp_decals "300.000000"

gl_dither "1"

gl_polyoffset "0.1"

gl_overbright "0"

gl_flipmatrix "0"

gl_monolights "0"

s_rolloff "1"

s_doppler "0"

s_distance "60"

s_automin_distance "2"

s_automax_distance "30"

s_min_distance "5"

s_max_distance "1000"

s_leafnum "0"

s_refgain "0.4"

s_refdelay "4"

s_polykeep "1000000000"

s_polysize "10000000"

s_numpolys "200"

s_bloat "2"

s_verbwet "0.25"

s_a3d "0.000000"

s_eax "0.000000"

volume "1.000000"

suitvolume "1.000000"

hisound "0.000000"

bgmvolume "0.000000"

MP3Volume "1.000000"

_snd_mixahead "0.1"

name "YangFan"

team ""

model "gordon"

skin ""

topcolor "30"

bottomcolor "6"

rate "25000.000000"

cl_updaterate "80"

cl_lw "1"

cl_lc "1"

cl_dlmax "128"

cl_himodels "0.000000"

cl_idealpitchscale "0.8"

cl_timeout "35"

cl_cmdbackup "2"

cl_download_ingame "1"

cl_allowdownload "1"

cl_allowupload "1"

cl_cmdrate "80"

lookstrafe "0.000000"

lookspring "0.000000"

cl_forwardspeed "400"

cl_backspeed "400"

cl_vsmoothing "0.05"

m_pitch "0.022"

m_yaw "0.022"

m_forward "1"

m_side "0.8"

m_filter "0.000000"

sensitivity "1.800000"

joystick "0.000000"

hud_takesshots "1"

fastsprites "0"

cl_corpsestay "1.000000"

_cl_autowepswitch "1"

hud_capturemouse "1"

hud_draw "1"

cl_righthand "1"

cl_minmodels "1"

cl_dynamiccrosshair "0"

hud_fastswitch "1"

hud_centerid "1"

voice_modenable "1"

hud_classautokill "1"

setinfo "_ah" "0"

setinfo "_vgui_menus" "1"

setinfo "dm" "0"

+mlook

+jlook


欢迎分享,转载请注明来源:夏雨云

原文地址:https://www.xiayuyun.com/zonghe/623904.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-07-16
下一篇2023-07-16

发表评论

登录后才能评论

评论列表(0条)

    保存