I have a lot of sites I manage that use Samba for file sharing with Windows PCs.
When configuring smb.conf, I like to validate my changes and make sure the file is going to work before breaking things as well as keep a backup copy of the old configuration file just in case.
The solution I decided on was quite simple: I created a script to do the above, and threw it in a Makefile so
that I can just
cd /etc/samba; make to test and commit changes.
Save the following as
#!/bin/sh # # Create smb.conf from smb-master.conf testparm -s smb-master.conf > smb.conf.tmp if [ $? -ne 0 ]; then echo "Validation failed." exit 1 fi cp -f smb.conf "smb-`date +%Y%m%d-%H%M%S`.conf" mv smb.conf smb.conf.bk (echo "# File updated by Makefile"; echo "# edit smb-master.conf and run make"; cat smb.conf.tmp ) > smb.conf
/etc/samba/Makefile as follows:
smb.conf: smb-master.conf ./buildconf.sh
Page Copyright © 2014, Michael T. Babcock. All Rights Reserved.
To contact me, send an E-mail to
sawyoursite at this domain.
If you'd really like your mail server reported for spam, send me some junk mail to email@example.com or firstname.lastname@example.org. This site powered by djbdns