Another backup post

So I had a thought of redoing my backup scripts, as my existing script file was becoming huge, complicated and difficult to follow.

It was a good way for me to learn Bash scripting however. The idea was to vastly simplify the whole process. I began by thinking the best way, and decided to use each machine to independently backup to a network drive, rather than having a single machine doing the grunt work running a script.

So each computer on the network had the drive mounted, and the script file placed into the main users crontab. I could of used the root crontab to copy the whole /home/ directory of course, but each machine only has one real user so I opted for that.

The file that runs from crontab is very simple

source /mnt/dlink_nfs/backup-script/var-dec
rsync -va --delete-after --delete-excluded --exclude-from=$FOLDER_NFS/backup-script/exclude.lst /home/$USER $FOLDER_NFS/backup-test/$DIRNAME

And that’s it. Just uses rsync to copy the contents to the network drive . The referenced source file is just shared variable declarations.

Now, that’s not quite enough for me to be happy with a backup system, so I use a raspberry pi, to run a second set of scripts from its crontab. Those files are responsible for uploading to Amazon S3, and also copying to a secondary NAS.


#!/bin/bash

source /mnt/dlink_nfs/backup-script/var-dec
echo "Script Started: $(date)" >> uploads3.log

if pidof -x "$script_name" -o $$ >/dev/null;then
   echo "An another instance of this script is already running"
echo "Script Already running, exiting" >>  uploads3.log
echo "-----------------------"
   exit 1
fi

if [[ $1 == 'clean' ]]
	then
		echo "clean command passed" >> uploads3.log
		rsync -vruO --delete-after $FOLDER_NFS/backup-test /mnt/samba/
		echo "Clean compleated $(date)"	
		exit 1
else
	if mountpoint -q /mnt/samba
		then
echo "Samba share mounted, started RSYNC" >> uploads3.log
		rsync -vruO $FOLDER_NFS/backup-test /mnt/samba/
	fi

	cd $FOLDER_NFS/backup-test/
echo "Starting S3 uploads" >> /home/pi/uploads3.log
	shopt -s dotglob
	shopt -s nullglob
	array=(*/)
	echo runing s3

	for dir in "${array[@]}"
	 do 
		echo "Currently Running S3 on $dir" >> /home/pi/uploads3.log
		dir=${dir%/}
	        timeout 30m s3cmd $s3_cmd $dir $s3_bucket
		echo "Compleated uploading $dir" >> /home/pi/uploads3.log

	 done
echo "Finished Script: $(date)" >> /home/pi/uploads3.log
echo "--------------------" >> /home/pi/uploads3.log
fi

And that file basically, ensures the script isn’t already running, copies the backup to another NAS, then iterates through each directory uploading to S3. I use timeout to limit each upload to 30mins to prevent overruns. Once the initial upload has completed, this limit can be removed.

You can view the most up to date git repository at my github site https://github.com/mikethompson/new-backup

Headset service

Headsets are one of the things that people seem to have problems with, so during this maintenance of my headset, I’ll work through the steps needed to break down, clean and rebuild a headset.

The headset on this bike uses two sealed bearings in an integrated, other bikes use caged bearings.

So, the first thing todo is remove the front wheel. Once that’s out the way, remove the brake, and secure it to the frame of the bike. Doing this will let you completely remove the full fork, and make it easier to clean the steerer tube, and fork crown.

Now comes the interesting bits.

Start by removing the top cap, there’s a lot of parts to a headset, so make sure you have somewhere to put them all down. Try to lay out the parts in the order you remove them.

There maybe a small spacer under the top cap.

Slacken off the stem pinch bolts, and gently remove the stem and handlebar assembly, and secure it on the bike frame.

Remove all the spacers from under the stem.

But while your doing that, ensure your supporting the fork, as there is a possibility it might drop out the frame.

Now, if the forks won’t move down, support the fork underneath, and slap the top of the exposed steerer tube, and it should move down. Now push it back up, and the weather cover, and the spacer should be able to be removed. the whole fork should now slide out.

Check the fork to see if the bearings came out with the fork, or if the stayed in the frame.

Now, remove the bearings, from both the top, and bottom, taking note of which way they came out, and which one was top and bottom.

Now, get a rag, and clean up.

  • Clean the top bearing seat
  • Clean the bottom bearing seat.
  • If sealed bearings, wipe off the old grease and dirt, but don’t use degreaser. Spin each bearing in your fingers feeling for any play or grittiness. Replace if any problems
  • Clean off the fork steerer tube, and crown race.
  • Leave all parts to dry out.

When your ready, it’s time to reassemble.

Start off with a liberal amount of grease to each bearing race, top and bottom, and the crown race. Use a good quality grease, the grease both lubricates the races, and protects the bearings from dirt and water. The headset gets absolutely soaked by the front wheel, so a good waterproof grease is the best option.

Now, slide the first bearing onto the steerer tube in the right orientation, and seat it into the grease. I like to take the grease that presses out and smear it over the bearing. Now, taking the fork, slide it back into the frame, making sure the bearing seats correctly.

And, this is where having everything to hand really helps. As your holding the fork in place, slide in the top bearing, and the bearing spacer. I like to smear a little grease on the top of the bearing, just to give it a little more protection. Add the weather cap, spacers and put the stem back on the steerer tube. Rethread the top cap, along with any spacers needed, don’t tighten it, just enough to hold the whole system to get her.

Now take a moment, and clean up any grease that’s squeezed out. Reattach the brake, Put the front wheel back in and finally center up the brakes.

It’s time to tension the whole assembly. Take the bike out of the work stand, nip down the top cap just a touch. Apply the front brake and rock the bike forward and back. What your feeling for, is play in the headset. So any knocking you feel, tighten the top cap by a very small amount. Keep on repeating until you can’t feel any play, or feel any knocking. Check that the whole system can be rotated, with no binding.

If a video, is easier to follow for this, I’ll let the excellent GCN explain it in this video.

Once your happy with the tension, center your stem, and tighten your stem bolts, double check your bars are still straight, and go ride your newly greased bike!

I will update this with pictures the next time I do a full headset service.

TwitterBot

I’d thought about writing a script for a Twitter bot. So the only thing I could think of is to push PiHole stats from my PiHole server.

In order to create a Twitter bot, you have to register as a developer but that’s easy enough. Next up is to find a interface that’s scripted in bash, as I didn’t fancy trying python, and I found the excellent Twurl Package.

Here’s a link to my repo where I’ve stored the code: https://github.com/mikethompson/PiHoleStats

I’ll update this, add a step by step and the repo when I have more time.

Brakes and cleaning

After a few rides, especially after a series of wet rides, your wheel brake surface will be covered in a black gunge, it’s a good idea to do some maintenance on them after.

In order to keep your rims working well, and wear down, clean off the surface of the brake track with hot soapy water. Then, get a cloth and some isopropyl alcohol, and wipe them down. You’ll be amazed at how much more gunk comes off.

Now, with the wheels off the bike, give the brake pads a look. Look for any embedded metal fragments, and pick them out with a sharp pick. Wipe them down with the alcohol, and if they look glazed, or smooth just take a file or sandpaper and rub them down. Also, while your here it’s a good chance to check just how worn they are.

Brake the speed.

A recent post I responded to recently, prompted this entry. That post was a simple brake sticking enquiry.

For the love of whichever deity you choose, do not, and I repeat, do not, disassemble a break calliper. The spring tension that gets released when you dismantle it, will send various washers and springs flying all over your garage. If you manage to find all the parts again, you’ll have issues with keyed washers, roller bearings and springs when reassembling.

So, my process of fixing a sticky calliper is quite easy. I’ll assume you’ve already tried the calliper without the cable attached. Most of the time, it will be down to old worn cables and cable housing. Note that I’m doing a dual pivot calliper here, no single pivot, cantilever or disc brakes. I might however cover those in another post sometime in the future.

What you’ll need

  • 5mm Allen key (for the majority of nutless brakes)
  • Rags
  • GT85 or similar cleaning spray
  • Good quality thick chain oil
  • Toothbrush or stiff brush

So, first off, remove the calliper from the bike to work on it. Remove the brake blocks and store them away from where you working, as you don’t want to contaminate them.

Now squeeze together the arms, and look down the middle from the side, most brake designs will have a roller between the arms, and a pivot on both arms. Your objective is to get all the gunk and general nasties out of the pivots and rollers.

Add the red straw to your spray can, and go to town spraying it into the roller, work the arms. Do the same with the pivots. Wipe it down wit the rags, and scrub it with the toothbrush.

Repeat until the calliper operates a fair bit smoother. When satisfied the brake is working well again, set it aside to dry off.

Now, with clean hands, get hold of the brake blocks, have a look and see if you can see any embedded metal fragments in the block. Use a pick to pick out anything in there. If they are an older block, you may get notice they look a little shiny and glazed. Simply run a file over the top to remove that surface. Reattach the brake blocks to the calliper, making sure you have the left and right blocks on the correct sides. Drip a small amount of lube into the roller and all pivots wiping off any excess on the calliper.

Clean out the brake bolt recess in the frame, clean the hollow bolt and Reattach the calliper to the bike, realign your pads to the rim, and tighten up. You can apply a drip of loctite to the thread if you need, ive never need it and just greased the thread which has been enough.

Jobs done, go and ride and enjoy your enhanced breaking power.

Range..

So, in Europe the power of a radio transmitter used in drones is limited to 18dbm, well below the ability of the controller’s 25dbm.

This equates to a massive cut in the range of the spark, about 500 meters is the limit before the video signal gives up and the drone returns. But fear not, there is something you can do to get the full range.

It basically involves fooling the DJI Go app to think your in a country that uses the FCC rules instead of the CE rules. To do it, follow these steps.

  • Ensure the drone and RC are both off
  • Turn aeroplane mode on your phone or tablet to On, and make sure to fully quit the DJI Go app
  • Install a fake GPS app and enable it.
  • Set your location somewhere in America or Canada.
  • Turn on the RC and drone and allow them to.connect.
  • Connect to the aircraft’s WiFi signal
  • Once the app starts up, it’ll ask you if you want to change the WiFi settings. Select ok.
  • Wait for the drones/RC’s network to come back online, and power everything off
  • Quit the app and the fake GPS provider, restart the drone/RC and app
  • When asked again to alter the WiFi settings, hit cancel

And that’s it. Each time you launch the app.from here, it’ll ask you to change the settings, always cancel the dialog.

To confirm your in FCC mode, goto the wireless page in the app, and look if there is a channel 12/13, if not your in FCC mode. Range in this mode will get you in excess of 1000 meters, as opposed to the 500 in the CE mode.

Happy flights!

Wheel Service

Having to replace my wheel bearings in my Fulcrum Quattro wheels, I thought I’d just take a quick post on the process.

Front wheel

The front wheel, is of course the easiest of the pair todo.

  1. Remove end caps. These just pull out, but can be an absolute arse to pull out.
  2. Remove the tension collar, and the small metal washer that sits under it
  3. Pull out the axle from the wheel.

Now, check the wheel spin, and look at the bearings. Check the space behind, and confirm you have room to drive it out.

Place the wheel hub on a block of wood, and drift out the bearing from its seat. Do the same for the other side.

Give the bearing seat a good clean out with a degreaser rag.

Now, to reseat the bearings, I use a Rapid Racer bearing set. The two bearings used in the hubs are 6903 sized. So mount up the bearings in your press, grease them up, and gently drive them home until they stop. Don’t force them, just drive until they stop.

Clean off the axle, apply grease to the races and a small amount smeared over the rest of the axle and reassemble. Don’t forget the small metal washer under the locking ring.

Adjust the locking ring just enough to insure the axle dos’nt move side to side. Don’t over tighten.

Push the end caps back on (you can give the o rings on these a light grease coat, just to make them easier to remove in future)

And your done.

Rear Wheel.

On the rear wheel, it’s normally the left bearing that goes bad, as the right is well protected by the freehub, but its always a good idea to replace them all at the same time.

You’ll need a few extra tools for this wheel.

  • 5mm Allen key
  • 17mm spanner
  • C-clip pliers.
  • 6803 bearing press.
  • Chain whip
  • Lock ring tool
  • Grease gun.

Start off by removing the cassette, and give the whole freehub a good wipe down. This is a dirty hub, so clean all the wheel as you have access to it.

Insert the 5mm Allen key into the non drive side, and the 17mm spanner onto the drive side.

The left hand end cap is standard thread, but damn tight. Once that caps off, remove the locking collar, and again mind the small metal washer.

Pull the full freehub and axel out of the wheel. The pawls should be quite secure on the freehub, but just be careful they don’t fall.

Now, using the worktop, insert the 5mm Allan key and use it against the worktop to stop the freehub moving as you apply torque from the 17mm spanner to remove the freehub nut. Remove the nut and the spacer behind it.

The axle should now pull out of the freehub.

Replace the hub shell bearings in the rear wheel the same as the front. These again, are size 6903 sized.

The fun start with the bearings in the freehub. 🙂

Make sure you have a rag nearby to clean up with, as this is messy.

First drift out the outer most bearing, you’ll need to push the metal sleeve to one side to get access for the drift. Once out, remove the metal sleeve and clean out the freehub shell of the horrible milky white grease. Look inside the freehub, and you’ll see the inner bearing, it is however secured by a c clip on the inner. So, remove that c clip with your pliers and you’ll be able to drive that bearing out of it’s initial race. Now ensure the bearing hasn’t flipped over in the hub and carefully drive it past the outer race too.

Give the whole shell and pawls a really good clean with degreaser, and leave to dry. While that’s drying off, clean your work station and other parts that are greasy.

Now that’s all clean and dry, get your bearing press ready. The freehub takes bearings that are 6803, so mount one up in the bearing and pregrease. Drive the first bearing down past the first bearing seat, and continue down until it is seated just under the groove the c clip sits in.

Add a little more grease to the bearing top, and insert the clip back into its seat and ensure its seated.

Now, grease it all up, add loads of grease into the freehub shell. Just add it in, don’t skimp.

Reinsert the metal spacer, and line up the outer bearing on your press. Two turns on the press, remove it and check the bearing, if it’s not quite flush, give it a quarter turn and check again.

Inject grease into the pawl seats. Some people don’t like grease in the pawls due to a belief it clogs up the pawls and causes them not to seat correctly. All I can say, is that I’ve never had and issue. But feel free to leave them with a light coat, or a heavy(ish) oil.

Reassemble the axle and end cap on the non drive side, place the freehub back onto the axle and secure it using the metal spacer and nut.

Test spin the wheel. It will feel a little draggy initially while the bearings wear in, and the grease distributes. If the hub is too loud, remove the freehub, and add some grease to the toothed ring. It’ll quieten down for a whole at least.

Make sure the end cap and freehub nut are tight, and clean up. Your done..