NetworkManager Dispatcher

To keep my data backed up savely I rely on CrashPlan. For the last weeks I had a quite long bug request pending. What I took from it, was the problem CrashPlan had when the network is not yet available when the service is started. Therefore I disabled its automatic startup and wrote a dispatcher script for the NetworkManager to automatically start crashplan, whenever I get a network connection and stop it, when the connection breaks down. Find the script here: 02crashplan.sh

During mmy research I found out, that the dispatcher service was not enabled on my Arch Linux system. That’s important for the scripts to work.

$ sudo systemctl enable NetworkManager-dispatcher

Similarly the service for the modemmanager was disabled, which caused my UMTS card to not work.

$ sudo systemctl enable ModemManager

While working on this, I wrote another dispatcher script, which takes care of connecting to the univeristy vpn (works for all Munich universities, which get their internet services from the lrz) automatically, when I connect to the corresponding network. Find the script here: 01lrzvpn.sh
The idea for this script and its frame is taken from Ubuntuusers.de. Make sure, to save your credentials in the corresponding VPN configuration file and update the name of the VPN in the script to the one you are using.

Multiboot USB Drive

I just created a usb drive containing different linux distributions. I wanted the drive to have the original iso files on it with no need to unpack.

Here is what I did:

sudo mkfs.vfat -n MultibootUSB /dev/sdd1
sudo mount /dev/sdd /mnt/
sudo grub-install --no-floppy --root-directory=/mnt /dev/sdd

All iso files have to put to ‘/mnt/iso’.
My config file ‘/mnt/boot/grub.cfg’ can be downloaded here.

Especially the configuration for Arch Linux was a bit tricky to create.
‘archisolabel’ has to be the label of the image file used.
‘img_dev’ is set to the uuid of the usb device used.

Quite interesting is also the remastering of certain files. I put the neo keymap into /arch/any/usr-share.fs.sfs.

See here: https://wiki.archlinux.org/index.php/Remastering_the_Install_ISO. If anybody wants to have the iso file, just tell me.

For further information check:
http://www.panticz.de/MultiBootUSB
https://wiki.archlinux.de/title/Multiboot_USB_Stick
https://wiki.archlinux.org/index.php/Grub2#Booting_an_ISO_Directly_From_GRUB2
https://bbs.archlinux.org/viewtopic.php?pid=749337
https://bbs.archlinux.org/viewtopic.php?id=78171&p=3

Bash Example Script #2

I have added the following function to my bash example script:

# Run external command and only procced, when exit code is 0
function try {
	$@
	returnValue=$?
	echo "$returnValue"
	if [ $returnValue -ne 0 ]
	then
		log $ERROR "$@ exited with return value \
		$returnValue Script will stop here."
		echo "$@ exited with return value $returnValue. \
		Script will stop here."
		exit $EXIT_FAILURE
	fi
}

The function takes a program as an argument and runs in. If the program returns with a status other then 0, so it fails, then the script will print an error message, log it and and exits. I needed this behaviour in some recent scripts and hope it to be usefull for everybody else.