START/STOP values must be specified in the init script
[packages.git] / net / samba / files / samba.init
1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2006 OpenWrt.org
3 START=50
4
5 DEFAULT=/etc/default/samba
6 RUN_D=/var/run/samba
7 NMBD_PID_F=$RUN_D/nmbd.pid
8 SMBD_PID_F=$RUN_D/smbd.pid
9
10 . /etc/functions.sh
11
12 config_cb() {
13         local cfg="$CONFIG_SECTION"
14         local cfgtype
15         config_get cfgtype "$cfg" TYPE
16
17         case "$cfgtype" in
18                 timezone)
19                         config_get posixtz      $cfg posixtz
20                         config_get zoneinfo     $cfg zoneinfo
21                         echo "$posixtz" > /etc/TZ
22                 ;;
23         esac
24 }
25
26
27 start() {
28         [ -f $DEFAULT ] && . $DEFAULT
29         config_load timezone&
30         mkdir -p $RUN_D
31         nmbd -D $NMBD_OPTIONS
32         smbd -D $SMBD_OPTIONS
33 }
34 stop() {
35         [ -f $SMBD_PID_F ] && kill $(cat $SMBD_PID_F)
36         [ -f $NMBD_PID_F ] && kill $(cat $NMBD_PID_F)
37 }
38