Archive for October 2012

CB Install

Got my CB installed in my 2007 Dodge 2500 just in time for a week long road trip. The Dodge has a manual transmission (G56) which adds alot of challenges like where to mount the CB. The wife thought the CB should be removable which I thought was a great idea but also added to the challenge. I decided to go with a smaller CB to widen my mount options. I picked the Midland 1001LWX because of its size and because it also has weather. I ended up mounting it next to the passenger seat and console with Read more [...]

Vacuum Firefox, Thunderbird and Eclipse Squlite script

Wrote this little bash script after I learned about squlite vacuum. #!/bin/bash #Best to stop the apps before but just incase if [ $(pgrep thunderbird >> /dev/null 2>&1)$? = "0" ]; then echo "please stop thunderbird" sleep 10 pkill thunderbird fi if [ $(pgrep firefox >> /dev/null 2>&1)$? = "0" ]; then echo "please stop firefox" sleep 10 pkill firefox fi if [ $(pgrep eclipse >> /dev/null 2>&1)$? = "0" ]; then echo "please stop Read more [...]

Things to make sysadmin work easier

Thought I would put together a list of things time saving tips and best practices that can make Linux system administration easier. The list isnt in any particular order. Just put it down as it came to mind.   Symlinks Think before you use them. If the application has a  configuration directive for a different file location use that. Example don't symlink  /var/lib/mysql/. Use the datadir option in mysql to move it. I think the problem is most admins find out about symlink and think Read more [...]

Sudosh and Rootsh

The reason for sudosh and rootsh is to log all commands ran in the root shell. This keeps the security people off your back and makes security audits go smother. You need to do some sudoers tweaking to make sure root is only used with the rootsh or sudosh wraper. Rootsh is in most the repos and is a more active project but I found sudosh has a better play back.  Rootsh also logs to syslog which I don't think sudosh2 does. Logging to syslog gives you the ability to log remotely which Read more [...]

Firefox and Thunderbird backup script

Simple script I run from cron to backup Firefox and Thunderbird. replace YOURHOMEDIR with your actual home directory or make it a variable. #!/bin/bash TODAY=$(date +%F) YESTERDAY=$(date -d "-1 day" +%F) THUNDDIR="/home/YOURHOMEDIR/.mozilla-thunderbird" THUNTAR="/home/YOURHOMEDIR/.mozilla-thunderbird-$TODAY.tar.gz" OLDTHUNTAR="/home/YOURHOMEDIR/.mozilla-thunderbird-$YESTERDAY.tar.gz" FOXDIR="/home/YOURHOMEDIR/.mozilla" FOXTAR="/home/YOURHOMEDIR/.mozilla-$TODAY.tar.gz" OLDFOXTAR="/home/YOURHOMEDIR/.mozilla-$YESTERDAY.tar.gz" #back Read more [...]

All Grain Brewing

Thought I would do a post on brewing today because most of my previous post have been computer related. All grain brewing is easier than most think and  if you enjoy brewing you should give it a try. It does add some time to the brew day but I hope to do some experimenting this fall with a no chill method. Brew in a bag Method I started all grain brewing with the brew in the bag method. After I had done a partial mash oatmeal stout with a small cooler that I converted to a mash tun Read more [...]

CPU Scaling script

I'm posting this thinking someone might find it useful. At one time I was calling this from cron, setting CPU scaling to performance from 8-5 and setting it to on demand all other times.  I got smarter and now let the kernel take care of itself. #!/bin/bash function morepower { for X in $(grep processor /proc/cpuinfo |awk '{print $3}'); do echo "Processor $X Current: $(cat /sys/devices/system/cpu/cpu$X/cpufreq/scaling_governor)" ; done if [ "$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)" Read more [...]

Update hostblock script

I use this script to update my second host file. See post Second Host file to block internet garbage for more information on this and how to put this script to use. #!/bin/bash if [ $(id -u) != "0" ]; then echo "Must be root to run $0" exit 1 fi HOSTFILE="/etc/hostsblock" OLDDATE=$(grep Updated $HOSTFILE |awk '{print $4}') wget --progress=dot -O $HOSTFILE NEWDATE=$(grep Updated $HOSTFILE |awk '{print $4}') dos2unix $HOSTFILE if Read more [...]

Second Host file to block internet garbage

This is how I add a second host file to my systems to block internet Garbage to localhost so my browser never reaches the garbage sites. As an added bonus, I get DNS caching in the process with dnsmasq. I like to keep /etc/host limited to important things and not to cluttered. I also want to keep the file I use for blocking easy to update. The first thing I do is pull the host file from a site like and put it in /etc as /etc/hostblock and run dos2unix Read more [...]

Rename to all lower script

This script will rename the file name you pass it to all lower case using tr #!/bin/bash # This script renames a file to lowercaseif [ "$1" = "" ]; then echo "Must pass filename." exit fiLOWERNAME="$(echo "$1" | tr '[A-Z]' '[a-z]')"if [ $1 != $LOWERNAME ]; then mv "$1" "$LOWERNAME" ls -Al $LOWERNAME fiYou can run it on multiple files in a directory with something likefor X in $(ls -1); do ./ $X; done Read more [...]