Copyright © 2011 x83.net. All rights reserved.
Generate ifcfg-eth1 307-366 configs.
touch ifcfg-eth1:{307..366}
for f in ifcfg-eth1:{307..366}; do cat origfile > “$f”; done
for f in eth1:{307..366}; do echo “DEVICE=$f” >> “ifcfg-$f”; done
for f in {307..366}; do echo “IPADDR=aaa.bbb.ccc.$((f-239))” >> “ifcfg-eth1:$f”; done
origfile contains:
GATEWAY=eee.fff.ggg.hhh
TYPE=Ethernet
BOOTPROTO=none
NETMASK=255.255.255.192
ls | perl -ne ‘$a=$_;chomp $a;$b=”mutt -s \”poza $a\” -a $a <email> < message.txt\n”;print $b;`$b`’
I use this script on a cpanel server..if output of pgrep command is 0 then the $restart command is issued
#!/bin/bash
restart=”/scripts/restartsrv_httpd”
pgrep httpd || $restart
exit 0
If its a VPS then I might add to clear the Semaphore Arrays.
for i in `ipcs -s | grep nobody | awk ‘{print $2}’`; do ipcrm -s $i; done
Then I put this script into Cron to run every 5 minutes.
# MIN HOUR DAYOFMONTH MONTH DAYOFWEEK COMMAND
*/5 * * * * /root/checkhttp.sh