

I assume that you are able to successfully install Hamachi as a user basis. If not, you can find out from the README instruction when you download the installation script.
An updated Hamachi start-up script for Ubuntu Hardy Heron is now available. Click on the link above.
- Create the start-up script for hamachi, as shown below. Remember to change the user name "keith" (line 5) to your system user name in Ubuntu (or your Linux distribution).
#!/bin/bash
###################################
### Start-up script for Hamachi ###
###################################
USER=keith
case "$1" in
start)
/sbin/tuncfg
/bin/su - $USER -c "hamachi start"
;;
stop)
/bin/su - $USER -c "hamachi stop"
;;
restart|force-reload)
/bin/su - $USER -c "hamachi start"
/bin/su - $USER -c "hamachi stop"
;;
*)
exit 1
;;
esacexit 0
- Make the script executable:
chmod +x hamachi
- Move the script to /etc/init.d/ directory:
sudo mv hamachi /etc/init.d
- Finally, link the script to the appropriate run-level for booting up the system:
sudo ln -s /etc/init.d/hamachi /etc/rc2.d/S99hamachi
sudo ln -s /etc/init.d/hamachi /etc/rc2.d/K99hamachi
According to Marcus, 2 is the default level for Debian and Ubuntu. In most other distribution, it is 5.
- Finally, reboot your system and Hamachi will be automatically loaded and connected to the server.
Hamachi is one of the simplest way to link different networks across the Internet into one single Intranet. Many people make use of this for gaming and some other purposes.
It is definitely very helpful if you are located far away from your server, and that someone could simply help you restart your server without needing to give administrative privilege to login to the server. Hamachi will be automatically loaded.




I've tried your script and
Submitted by Guest (not verified) on Tue, 2007-11-06 18:46.
- reply
I've tried your script and found out, that without setting HOME to your home directory and "export HOME" so that it can find ~/.hamachi it doesn't work.
HOME is by default in Ubuntu
Submitted by keith on Wed, 2007-11-07 00:49.
- reply
Hi there,
Thanks for the great feedback. It's true that you need to set the HOME variable. However, since this article is targeted specifically at Ubuntu Feisty Fawn, hence the operating system has already automatically set the HOME variable directly to the HOME directory.
There is no need to "export HOME", unless you are using Linux OS apart from Ubuntu.
Cheers!
restart
Submitted by Al Caliskan (not verified) on Wed, 2008-01-23 15:58.
- reply
Don't you have to do this to restart the hamachi service:
restart|force-reload)
/bin/su - $USER -c "hamachi stop"
/bin/su - $USER -c "hamachi start"
;;
instead of doing this:
restart|force-reload)
/bin/su - $USER -c "hamachi start"
/bin/su - $USER -c "hamachi stop"
;;
If you restart a service, it makes sense to stop it first and then start it.
Shutdown Script
Submitted by keith on Wed, 2008-01-23 16:13.
- reply
It makes perfect sense to do a proper shut down. I guess it does not really matter; but it is worthwhile to explore a shut-down script for Hamachi.
Easier way to set up links in Ubuntu
Submitted by Guest (not verified) on Tue, 2008-01-29 20:01.
- reply
To automatically assign the runlevel links to the correct rc.* folders just run:
sudo update-rc.d hamachi defaultsWill build links this way:
Adding system startup for /etc/init.d/hamachi ...
/etc/rc0.d/K20hamachi -> ../init.d/hamachi
/etc/rc1.d/K20hamachi -> ../init.d/hamachi
/etc/rc6.d/K20hamachi -> ../init.d/hamachi
/etc/rc2.d/S20hamachi -> ../init.d/hamachi
/etc/rc3.d/S20hamachi -> ../init.d/hamachi
/etc/rc4.d/S20hamachi -> ../init.d/hamachi
/etc/rc5.d/S20hamachi -> ../init.d/hamachi
It works great with ubuntu
Submitted by Guest (not verified) on Thu, 2008-11-13 15:46.
- reply
It works great with ubuntu 8.10
other idea
Submitted by Guest (not verified) on Fri, 2009-02-27 22:38.
- reply
using the script above i made this changes to work on my personal laptop using hamachi ver 0.9.9.9-20 i hope this work for ppl looking for a general configuration ;) good luck and godspeed
#!/bin/bash
###################################
### Start-up script for Hamachi ###
###################################
case "$1" in
'start')
echo "Iniciando Hamachi"
/sbin/tuncfg
/usr/bin/hamachi -c /root/.hamachi start
;;
'stop')
echo "Deteniendo Hamachi"
/usr/bin/hamachi -c /root/.hamachi stop
;;
'restart'|'force-reload')
echo "Reiniciando Hamachi"
/usr/bin/hamachi -c /root/.hamachi stop
/usr/bin/hamachi -c /root/.hamachi start
;;
*)
exit 1
;;
esac
exit 0
Post new comment