Router reboot wrapper script

This is a memory sink article. I found this nice python script which reboots a B525 router and wanted to write a wrapper script around it. #!/bin/bash # refs:, RUNDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" MAX_ATTEMPTS=10 ATTEMPT=0 TIMEOUT=60 LOCK_FILE=$RUNDIR/lock LOCAL= if [ -f $LOCK_FILE ]; then echo "Already running, exiting" exit -1 fi function finish { rm $RUNDIR/lock } trap finish EXIT touch $RUNDIR/lock while (( $ATTEMPT < $MAX_ATTEMPTS )) do DATE=$(date +%Y%d%m-%H%M%S) echo -e "GET http://$REMOTE HTTP/1....

August 24, 2019 · len


After spending loosing time in vain trying to convert kml files containing the gx:Track format to gpx files for my gps and finally writing my own tool for doing that I realized I have done quite a lot of small scripts for gps data manipulation and decided to push them on github. I started with 2 and as I will clean the others I will push them also. # []( A set of python scripts to manipulate GPS data...

May 31, 2014 · len

CD backup

Since my last laptop with a working CD drive is dying this a simple script which does the following ops once the CD is inserted and auto-mounter: finds the mount point copies the files ejects the CD <pre lang="bash">cd "$(cat /proc/mounts | grep iso9660 | cut -d' ' -f2 | sed -e 's#\\040# #g')" && cp * /media/backup/data/ && cd && eject /dev/sr0

March 7, 2014 · len

Archive all files modified in the last 24h

find . -mtime 1 -type f -print0 | tar -czvf $SYNC_DIR/$BFILE -T - --null

October 1, 2013 · len

Checking badblocks with smartmontools

… and some other observations. Warning: use at your own risk! I used to keep some of my photo backups on an external Seagate 500G drive which I also use for travel. Today however as I tried to access it I noticed some problems so I quickly ran: smartctl -t long /dev/sdb #followed by smartctl -l selftest #the result Extended offline Completed: <strong>read failure</strong> 90% 109 <strong>414996448</strong> I started using this useful guide to correct the problems by repeatedly running smartctl, calculating the offset, finding the file with debugfs, forcing reallocation with dd and so on....

January 2, 2013 · len