Snowmageddon 2016

So most of the east coast is currently buried up to its nether-bits in snow in case you haven’t been keeping up with things.  I figured this would be an ideal time to slap my newly purchased GoPro up in the window and let it take time-lapse pictures of the snowfall as it started to come down yesterday.  Unfortunately I found out after I had filled up the 32gb memory card that it was only able to take pictures at half second intervals so I didn’t get anywhere near the amount of data I wanted to create a cool looking timelapse of the snowfall, however I did mange to cover the first maybe hour or two of it and process it to a video for the enjoyment of the masses.

Strange copy behavior?

So a friend hit me up today to let me know he had updated a sqlite database that we use in a project and I could go ahead and copy it over to my home directory to update things with.  Login to the box, sudo to root and cop the file with full paths and something bizarre happened, the file which he had ownership of changed over to my user level account.  Immediately he suggested that it might be the -a flag in an alias, however my alias was simply set to use -i so I deleted the file from my home directory and tried the copy again.  As far as I can tell this shouldn’t actually be happening because I didn’t specify the -a flag and the user moving the file is root, so if anything root should have ownership of the file once it hits the directory.  I doubt this is any kind of nefarious or exploitable situation but it does seem strange because I remember forgetting to chown files in the past after moving them as root and things not working until I went back and corrected the ownership of the files

Troubleshooting Script

I have been planning to try to convince a friend to take up Linux in place of her aging Windows 8.1 system since its been officially put out to pasture by Microsoft so I started thinking about supporting said system since my friend is not exactly a Linux guru.  This of course lead me to think about a very handy script I use at work that does a whole bunch of things like check database settings, look for necessary running processes and look at system loads of our software to determine if there are any easy fixes before getting into logs and headaches.  Naturally I cannot share this script because its work related (and I didn’t write it either) but it made me decide to make a version of my own that I can show off.  Currently the script resembles a rather ugly gnome of some type in that it is short and VERY ugly but I figured I would toss it out so I can test a few other things like my nifty social share buttons that are about as basic as you can get without setting foot inside a HS Chemistry classroom.


# things to check
# internal ip, external ip, dns server, connectivity to google
# filesystem usage, current system load, memory usage

> log.log
date >> log.log
IP=`ip addr | grep -P -o '\d{1,3}.\d{1,3}\.\d{1,3}\.\d{1,3}\/24'`
EXT_IP=`curl -s | grep -o -P '\d{1,3}.\d{1,3}\.\d{1,3}\.\d{1,3}'`
DNS_1=`grep -P -o '\d{1,3}.\d{1,3}\.\d{1,3}\.\d{1,3}' /etc/resolv.conf`

echo "Internal IP:" $IP >> log.log
echo "External IP:" $EXT_IP >> log.log
echo "DNS Server 1:" $DNS_1 >> log.log

MEM_USAGE=`free -m`
echo -e "\nMemory Information\n" >> log.log
echo -e "$MEM_USAGE" >> log.log 

DISK_USAGE=`df -h`
echo -e "\nDisk Usage\n" >> log.log
echo -e "$DISK_USAGE" >> log.log

TOP_SNAPSHOT=`top -n 1 -b`
echo -e "\nTop Processes\n" >> log.log
echo -e "$TOP_SNAPSHOT" >> log.log

echo -e "\nUptime\n" >> log.log
echo -e "$UPTIME_SNAPSHOT" >> log.log

# now lets try some active tests
echo -e "\nPing Test\n" >> log.log
if eval "ping -q -c 1> /dev/null"
	echo -e "Ping Test: Successful!" >> log.log	
	echo -e "Ping Test: Failed!" >> log.log	


The long term goal for this script is to make it collect a whole load of system data, run some basic checks like pinging Google, and probably a few other things like making sure vital things like crontab haven’t been somehow deleted.  Probably will also make it verify that my ssh key is still active within the system so that if I have to I can remote into said system and might consider some sort of reverse ssh invocation as well if I really want to get fancy with the script.  If it saves me even 10 minutes when trying to fix the system that I haven’t even setup yet then my past hour or so messing with it and remembering all the things I’ve forgotten about scripting in the past few months was well worth it, plus it gets me back to actually posting something here for a change.