neat little perl trick

you ever have a shitload of files in a directory that needed one thing (the same in all) changed ?? here is this cool little perl trick to change that one object in all the files without having to edit them all by hand perl -pi.bak -e ‘s/foo/bar/i’ *.extention by running this with the -p … Read More

ramdisk script for nagios

to prevent the hard drive on the nagios server from thrashing around like a drunken idiot while running nagios, i set the status.dat file to reside in a ramdisk since that file gets read and written everytime that either a service,passive or host check goes through. i put this little script in start up so … Read More

cheap script to pass data through gnuplot

im putting this script up not because it does something useful, but because i needed somewhere to store it. if it actually helps you then i apologize. #!/bin/bash # script for gnuplot to combine multiple pieces of data into on graph # in png format case $1 in ‘load_avg’) if [ $# -lt 3 ]; … Read More

simple nagios script to check disk usage in solaris

i know that there already is a command in nagios to check file system usage, but it gives you the percentage in the wrong format (it says there is 21% free when i am used to it saying that 79% is being used) this will give you the format in basic df per device usage … Read More

simple nagios script for exp match in solaris

we just needed something on the fly to monitor /var/adm/messages for certain output in nagios. this does the trick rather nicely and its not that big of a script either. tested with nagios versions 2.3 – 2.5 #!/bin/bash TMPFILE=/tmp/tmpfile.$$ #GREP=/usr/bin/egrep egrep “(ALERT|EMERG|ERR|WARN|NOTICE|panic|halt)” /var/adm/messages > $TMPFILE egrep “\\(sd[0-9]+\\):” /var/adm/messages >> $TMPFILE egrep “su:.*su\ root.*failed” /var/adm/messages >> … Read More

bonding script revised – still working on it though

#!/bin/bash # # script runs simple bonding services for eth1 to bond0 and also does reversion back to just eth1 # tested and created in fedora core 4 # PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin export PATH case $1 in ‘bond0’) # recopy bond0 files back to network scripts cp –reply yes /etc/sysconfig/network-scripts/bak/ifcfg-bond0-eth1 /etc/sysconfig/network-scripts/ifcfg-eth1 cp –reply yes /etc/sysconfig/network-scripts/bak/ifcfg-bond0 /etc/sysconfig/network-scripts/ cp … Read More

script to mount smb drives over a network

#!/bin/bash case $1 in ‘start’) mount -t smbfs -o fmask=777,dmask=777,username=xxx,password=xxx //ip addy/folder /mount location ;; ‘stop’) umount /mount location ;; *) echo “usage: $0 <start|stop>” esac usage: ./script start|stop — this script also works well when using hamachi in linux – just have to change ip addy to the system (hamachi) assigned ip address of … Read More

uptime script for linux (suse 9.2)

first script – puts uptime and w to file #!/bin/bash rm dmesg_linux.txt # removes existing dmesg file uptime > dmesg_linux.txt # uptime piped to dmesg w > dmesg_linux.txt # w piped to dmesg chron set to once per hour – maybe every half hour or 15 minutes second script – places dmesg_linux.txt on server every … Read More