A Blog about technology, linux, peer2peer, cool new downloads and software development.

Friday, February 29, 2008

Start hamachi at boot on ubuntu

$ cd /etc/init.d

$ sudo su

$ cat > hamachi

paste the following script :

- - - - - - - - - 8< - - - - - - - - - - 8< - - - - - - - - -

#!/bin/bash
###################################
### Start-up script for Hamachi ###
###################################
USER=[username]
case "$1" in
start)
/sbin/tuncfg

/bin/su - $USER -c "rm -f /home/$USER/.hamachi/.lock"

/bin/su - $USER -c "/usr/bin/hamachi start"
;;
stop)
/bin/su - $USER -c "/usr/bin/hamachi stop"

/bin/su - $USER -c "rm -f /home/$USER/.hamachi/.lock"

;;
restart|force-reload)

/bin/su - $USER -c "/usr/bin/hamachi stop"

/bin/su - $USER -c "rm -f /home/$USER/.hamachi/.lock"

/bin/su - $USER -c "/usr/bin/hamachi start"
;;
*)
exit 1
;;
esac
exit 0

- - - - - - - - - 8< - - - - - - - - - - 8< - - - - - - - - -

$ vim hamachi

change in line 5 USER=to your username

$ chmod a+x hamachi

$ rcconf

check hamachi and select OK


$ chmod -R a+rw /home/[username]/.hamachi/

$ chmod a+rwx /home/[username]/.hamachi/


No comments: