csto 任务

/etc/udev/00_1.rules

KERNEL=="sd*[0-9]",SUBSYSTEM=="usb",ATTR{removable}=="1",ACTION=="add",PROGRAM="/bin/bash /home/justzhl/test.sh %k"

/home/justzhl/test.sh

 

#!/bin/bash
MYDIR=/tmpdisk
RESULT=$MYDIR/result.txt
mkdir -p $MYDIR
mount /dev/$1 $MYDIR -o rw
touch $RESULT
echo "--------------system name --------------------">$RESULT
echo $HOSTNAME >> $RESULT
echo --------------network config------------------->>$RESULT 
/usr/sbin/ifconfig >> $RESULT
echo --------------dns config --------------------->>$RESULT 
while read -r line
do
    echo $line >> $RESULT
done < /etc/resolv.conf
echo --------------route information ------------->>$RESULT
/usr/sbin/route >> $RESULT
echo --------------performance------------------->>$RESULT 
/usr/bin/top -n 1 -bc >> $RESULT
/usr/bin/ps -u >> $RESULT
#umount $RESULT 
#rm -R $MYDIR

  

 

 

 

转载于:https://www.cnblogs.com/imhurley/archive/2013/02/25/2931975.html

你可能感兴趣的:(csto 任务)