Wednesday, July 8, 2009

When to NOT recommend Linux desktop solutions!

My mom always told me: "..Andrew, there's a time and a place for everything..". Usually she said this when I was doing something that I definitely was NOT supposed to be doing!...like playing soccer in the kitchen with the dog while she was trying to make dinner...

I think that we can all agree that Linux is great, right? Well, there are always going to be situations where Linux is simply not the answer. For example: My parents had a workstation that had gone belly-up and were in need of a replacement. Great! Linux to the rescue!

...or so I thought...

The problem was, my dad ONLY knows Windows XP. The ONLY thing he knows how to do is double-click on Internet Exploder, select his drf.com (horse racing site) and look at the track entries for that day, then watch the race via streaming video.

Simple enough task no? Well, I went about installing the latest stable version of Ubuntu and everything was going fine. The problem was: It was different. Not really the usage of the O/S or the browser...but the 'little things'. Icons were different. Programs had different names. The windows looked different. It was, as he put it, just "weird" and he didn't "know it".

After 5 minutes he gave up. I was devastated.

Immediately I dove into technical manuals and man pages thinking that I could find the solution in there, as I often do...The problem was, there WAS no technical answer.

The answer was simply: "Linux was not the answer"

This story reminded me of some other things to take into consideration BEFORE recommending a Linux-based desktop solution:

  • Can you provide the additional support the client will need?
  • Are there business procedures written specifically for the operating system?
  • Are they open-minded?
  • Is the $$$ savings on licensing enough to justify losses in time when learning new technologies?
  • Do they even have time to learn a new O/S? How much time will it take to retrain?
  • Is the nature of their business DEPENDENT on their computing platform?

Obviously this is only scratching the surface and there are myriads of things to consider when investing in newer, better technologies such as Linux. Hopefully this will get everyone thinking the next time a client "...needs a new desktop...quick!".

Script - kill all users except root via 'skill'

Eventually you'll get to the point where you need a script that just kicks all the users off except the 'root' account (provided you're logged in as root or su).

This script:

checks to see that the user running the script is 'root'
does a 'w' listing (shows who's currently logged on) and an inverted grep '-v' to find the users
kills off the user accounts with 'skill'

(Enter other account exceptions into the bold text)

----------------------------------------------------------
#!/bin/bash
# logoffeveryone.sh
# Written by Andrew Elliott, 9-APR-2009
#

USER_LOG=/root/loggedonusers.txt
ROOT_UID=0

if [ "$UID" -ne "$ROOT_UID" ]
then
echo "Must be root to run this script!"
exit
fi

cd /root

echo "-----------------------------" > $CHAGE_LOG

w | cut -f 1 -d " " | grep -v 'root' | grep -v 'anyotheruser' | while read TEMP1
do
echo "Logging off user: $TEMP1"
skill -KILL -u $TEMP1
done

exit 0
----------------------------------------------------------

Script - Remove files older than 1 day from /root

A quick bash script that I wrote that does the following:

Checks to see if the user is root (good to do with all your scripts if you 'sudo')
finds all files older than 1 day (-ctime +1)
deletes the files
sends an email to 'root' with a small report of the deleted files

(the numb -3 is to calculate the number of files deleted - there are 3 header lines in the report)
(the statement in bold allows you to specify file formats to delete...*.csv in my case...)

------------------------------------------
#!/bin/bash
# rmroottemp.sh
# Written by Andrew Elliott, 20-feb-2009
#

RM_LOG=/root/rmroottemplog.txt
ROOT_UID=0

if [ "$UID" -ne "$ROOT_UID" ]
then
echo "Must be root to run this script!"
exit
fi

cd /root

echo "-----------------------------" > $RM_LOG
echo "Report for files removed from /root" >> $RM_LOG
echo "-----------------------------" >> $RM_LOG

find /root -ctime +1 -maxdepth 1 | grep 'searchtermhere' | while read TEMP1
do
echo "$TEMP1" >> $RM_LOG
rm -rf $TEMP1
done

NUMB=`cat $RM_LOG | wc | cut -c1-8 | sed 's/^[ ]*//'`
NUMB=$(($NUMB - 3))
/bin/mail -s "Root temp file cleanup $NUMB files deleted" root < $RM_LOG
rm -rf $RM_LOG
exit 0
------------------------------------------