diff --git a/deploy.sh b/deploy.sh index af0372aa5f978525ffe56edb1e7b1f721e5a7205..a525cc630b0c4f77f1f71988db5845b47da357c7 100755 --- a/deploy.sh +++ b/deploy.sh @@ -1,11 +1,29 @@ #!/bin/bash +usage(){ + echo "Usage $0 NbMaxconnections" + echo "Set the LCS maximum number of samba connection to NbMaxconnections" +} + if [[ ! "`hostname`" =~ "lcs" ]] then echo "This script should be run on the LCS" + usage exit 1 fi + +if [ -z "$1" ] +then + usage + exit 1 +fi + DIR=`dirname $0` # Update lcs-smb-config then run it to force max connections to 1 -awk 'BEGIN{PRINT=1;FOUND=0} /^[";]*$/{if(IN){IN=0;if(FOUND==0){print "\tmax connections = 1";FOUND=1}}} /^\[homes\]/{IN=1} /max connections/{if(IN){FOUND=1;PRINT=0; print "\tmax connections = 1"}} {if(PRINT){print $0};PRINT=1}' /usr/share/lcs/sbin/lcs-smb-config > /usr/share/lcs/sbin/lcs-smb-config.new +set -x +awk "BEGIN{PRINT=1;FOUND=0} \ + /^[\";]*$/{if(IN){IN=0;if(FOUND==0){print \"\tmax connections = $1\";FOUND=1}}} \ + /^\[homes\]/{IN=1} /max connections/{if(IN){FOUND=1;PRINT=0; print \"\tmax connections = $1\"}} \ + {if(PRINT){print \$0};PRINT=1}" \ + /usr/share/lcs/sbin/lcs-smb-config > /usr/share/lcs/sbin/lcs-smb-config.new cp /usr/share/lcs/sbin/lcs-smb-config.new /usr/share/lcs/sbin/lcs-smb-config /usr/share/lcs/sbin/lcs-smb-config