port lots of init scripts over to rc.common (more to come)
[packages.git] / net / samba / files / samba.init
index c3c600a..a30dfcf 100644 (file)
@@ -1,4 +1,5 @@
-#!/bin/sh
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006 OpenWrt.org
 
 DEFAULT=/etc/default/samba
 RUN_D=/var/run/samba
@@ -6,19 +7,13 @@ NMBD_PID_F=$RUN_D/nmbd.pid
 SMBD_PID_F=$RUN_D/smbd.pid
 [ -f $DEFAULT ] && . $DEFAULT
 
-case $1 in
- start)
-  mkdir -p $RUN_D
-  nmbd -D $NMBD_OPTIONS
-  smbd -D $SMBD_OPTIONS
-  ;;
- stop)
-  [ -f $SMBD_PID_F ] && kill $(cat $SMBD_PID_F)
-  [ -f $NMBD_PID_F ] && kill $(cat $NMBD_PID_F)
-  ;;
- *)
-  echo "usage: $0 (start|stop)"
-  exit 1
-esac
+start() {
+       mkdir -p $RUN_D
+       nmbd -D $NMBD_OPTIONS
+       smbd -D $SMBD_OPTIONS
+}
+stop() {
+       [ -f $SMBD_PID_F ] && kill $(cat $SMBD_PID_F)
+       [ -f $NMBD_PID_F ] && kill $(cat $NMBD_PID_F)
+}
 
-exit $?