One Script more

·

The computers in my work (around 800 GNU/Linux ofcourse) something doesn't detect the network configuration when te Operative System start, so we need to go to fix that, that's not problem, the problem is betwen 50 and 60 computers everyday lost the configuration and we need to fix it manualy, the problem is when i'm reading or studyng some manual, so here i leave one script to do it automatic, only edited crontab to execute all the day on intervals of one hour.
#!/bin/bash
#================================================
# Author: ll!z0 lliz0.lliz0@gmail.com
# Name: Restart_Net_Configuration.sh
# Date: Sat Jun 16 23:12:37 2007
# Description: Script to restart Network Config
# Use whith crontab
#================================================

#rm /tmp/ping*

a=4 b=0 c=3

ping -c3 127.0.1.1 > /tmp/ping.dat

sizefile=$(ls -s /tmp/ping.dat > /tmp/pingsize.dat  awk '{print$1}' /tmp/pingsize.dat)

if [ "$sizefile" -eq "$b" ]
then
echo "Size of ping.dat: $sizefile restarted net configuration">> /tmp/RND.log
/etc/init.d/network restart
fi

cat /tmp/ping.dat  grep receive > /tmp/package.dat
paqsend=$(cat /tmp/package.dat  awk '{getline; print(substr($4,1,2))}')

if [ "$paqsend" -eq "$b" ]
then
echo `date` " restarted net configuration -$paqsend-" >> /tmp/RND.log
/etc/init.d/network restart
fi

if [ "$paqsend" -eq "$c" ]
then
echo `date` " net configuration is correct -$paqsend-" >> /tmp/RND.log
fi 

0 Comentarios:

About Me

Mi foto
Soy Un Wey Aliviniado, prefiero tener cuates que amigos OGT con los OGT's

Labels