carlmfischer.com tech archives

Here are some scripts and howtos I found useful for my home server and webserver, as well as various other machines that I have.

Misc Scripts

  • A perl script on getting uptime stats on a FreeBSD box. Use this in your mrtg.cfg file, for use with MRTG.
  • Another perl script for getting the CPU utilization from the ./uptime command. It gets the 5 minute average of uptime.
  • A script for Linux boxes, for gathering uptime in days and hours.
  • I have a DAT72 tape backup drive on my main server, running Linux. I use this tar script for backing up data to that drive. I log what is being backed up to the /var/log/tape_backup directory, and the script tars the log files as well.
  • Use this script for restoring data from that drive.
  • This script is used to backup the entire server, it tars everything into one file, while excluding items found here. This was originally used on my Smoothwall firewall, and ported to my Linux Server. I placed the script in my /tmp folder, created a /tmp/backup folder, the run the script (/tmp/server_backup.sh). When completed, move the .tgz file to a safe location for backup/reference.
  • I use this script to copy some of my config files to a tmp directory, then copy the contents of the man_backup directory for easy backup. I set crontab to run this nightly, then I winscp into the linux box and grab the directory. This seems to work well for both my FreeBSD boxes and Linux boxes.

iSCSI Target

I setup an iSCSI disk for my Geovision CCTV System, and here is the process I took to get it working.

BGInfo

I just completed a BGInfo script using vbscript and batch files to obtain the IP, DNS and DHCP settings for my laptops using wireless and wired connections. The script elimiates blank lines or null values with the respecitve IP, DNS and DHCP settings.

FreeBSD Gmirror

One of my hard drives failed on my decommissioned FreeBSD file server, and I had to rebuild it with the gmirror utilities. I have two ata hard drives set at ad0 and ad1. The ad0 drive failed, so I replaced it with another 160gb ata hd. One problem I ran into was the bios had both hard drives active, and the system would not boot since disk0 (ad0) was a fresh, unformatted disk. I disabled the disk0 (ad0) in the bios, let the system boot off of ad1, and then issued the following command after the boot process:
gmirror insert gm0 ad0 where gm0 is the name of my gmirror.
After about an hour of rebuilding, the process was complete, and I rebooted the machine, and all is well (for now).

Here is the entire process I did to rebuild the hard drive.

OpenManage

I installed the Openmanage 5.0 monitoring on my Dell Poweredge 1600sc running CentOS 5.2. The openmanage application gave me the required snmp's so I now can monitor temperatures and fan rpms with mrtg. I can also access the Openmanage app via a web interface for viewing fan rpms, performance of the raid disks, and such. Here is some additional information on my setup of Openmanage and CentOS.

PhpSysInfo

I added the phpsysinfo module to display info about this webserver. I had to do a couple of modifications to apache config files in order for it to recognize the php files.

HDDTemp

I am a big fan of hddtemp and used it to gather hard drive temps on my old webserver running Fedora and ATA disks. I then bought a Dell Poweredge 800 with SATA disks to replace my old webserver, installed FreeBSD, but hddtemp did not work with FreeBSD, and until recently smartd tools was not able to read data from SATA disks. After searching around for a good while, I finally came across a script that enables me to 'grep' the temperature from the output of smartctl. Here is the script I use, and I have it for both my disks (ad4 and ad6) and use it to get mrtg graphs.

WebDav

I configured my webserver with the WebDav extension (for Foxmarks bookmark synchronization). There are some pretty good instructions on setting up the WebDav on FreeBSD by searching around.