Hamachi Startup – Script

May 7, 2008 – 2:09 am

Hacked this out because I got tired of rebooting my box and hamachi not coming up. So here is my hamachi startup script for Linux.

#!/bin/bash
#
# Hamachi Startup script for the Hamachi VPN Client
#
# chkconfig: 234 85 15
# description: Hamachi is a VPN Client by Log-Me-In
#
# processname: hamachi

# Source function library.
. /etc/rc.d/init.d/functions

# Will need to change the user’s name for who to run Hamchi as
user=”<INSERT_USER_NAME>”

start() {
echo “Starting Hamachi for user . . .$user”
/sbin/tuncfg
su $user -c ‘/usr/bin/hamachi start’
#su $user -c ‘/usr/bin/hamachi get-nicks’
su $user -c ‘/usr/bin/hamachi list’
}

stop() {
su $user -c ‘/usr/bin/hamachi stop’
}

# See how we were called.
case “$1″ in
start)
start
;;
stop)
stop
;;
start|stop)
;;
*)
echo $”Usage: hamachi {start|stop}”
exit 1
esac

exit $RETVAL

That is all.

Post a Comment