#!/bin/sh # mm 23-sep-12 (thanks drewy) # Modified 15Jul2016 ALS. # Use the META 3rd-party module to run this script at startup, # to modify the generated-from-database smb.conf # and modify the ocnfiguration without actually poking values into that database. # Set TZ variable so samba handles time internally correctly. echo 'Setting TZ . . . ' export TZ=America/Los_Angeles # Wait for samba server (smbd) to load. echo 'Waiting for smbd to load . . . ' while ! ps | grep -v grep | grep smbd > /dev/null do sleep 5 echo '. ' done # Save a copy of the current auto-generated smb.conf . cp -f /raid0/sys/smb.conf /raid0/sys/smb.conf.auto-generated # Overwrite the auto-generated smb.conf with our modified version. echo 'Copying smb.conf.ALS to /raid0/sys/smb.conf . . . ' cp -f /raid0/sys/smb.conf.ALS /raid0/sys/smb.conf cp -f /raid0/sys/smb.conf.ALS /tmpfs/tmp/smb.conf # Restart samba without rebuilding smb.conf echo 'Restarting Samba server smbd, nmbd, winbindd ' # kill -15 $(ps | grep '[s]mbd' | awk '{print $2}') # kill -15 $(ps | grep '[n]mbd' | awk '{print $2}') # kill -15 $(ps | grep '[w]inbindd' | awk '{print $2}') /img/bin/rc/rc.samba restart 1 echo 'Finished restarting smbd, nmbd, winbindd.'