159797fd59d33c98579dbc18b7ed6c88515cdfe0
[openwrt/svn-archive/archive.git] / net / samba / files / samba.init
1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2006 OpenWrt.org
3 START=60
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 config_cb() {
11 local cfg="$CONFIG_SECTION"
12 local cfgtype
13 config_get cfgtype "$cfg" TYPE
14
15 case "$cfgtype" in
16 timezone)
17 config_get posixtz $cfg posixtz
18 config_get zoneinfo $cfg zoneinfo
19 echo "$posixtz" > /etc/TZ
20 ;;
21 esac
22 }
23
24
25 start() {
26 [ -f $DEFAULT ] && . $DEFAULT
27 config_load timezone&
28 mkdir -p $RUN_D
29 nmbd -D $NMBD_OPTIONS
30 smbd -D $SMBD_OPTIONS
31 }
32 stop() {
33 [ -f $SMBD_PID_F ] && kill $(cat $SMBD_PID_F)
34 [ -f $NMBD_PID_F ] && kill $(cat $NMBD_PID_F)
35 }
36