summaryrefslogtreecommitdiff
path: root/network/hamachi/rc.hamachi
blob: a3398f10514fbb558bd6dca78728ded6f5aa29a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
# Start/stop/restart the hamachi "zero-conf" VPN service
HAMACHI_DIR=/usr/share/hamachi

hamachi_start() {
  # ensure the tun driver is loaded- hamachi fails to start if it is not
  /sbin/modprobe tun
  $HAMACHI_DIR/hamachid
}

hamachi_stop() {
  if [ -e "/var/run/logmein-hamachi/hamachid.pid" ]; then
    kill `cat /var/run/logmein-hamachi/hamachid.pid`
  fi
}

hamachi_restart() {
  hamachi_stop
  sleep 1
  hamachi_start
}

case "$1" in
'start')
  hamachi_start
  ;;
'stop')
  hamachi_stop
  ;;
'restart')
  hamachi_restart
  ;;
*)
  echo "usage $0 start|stop|restart"	
esac