Skip to content
Snippets Groups Projects
Verified Commit c6e73226 authored by David Beniamine's avatar David Beniamine
Browse files

Choose the number of maximum connections

parent 946d50fb
No related branches found
No related tags found
No related merge requests found
#!/bin/bash #!/bin/bash
usage(){
echo "Usage $0 NbMaxconnections"
echo "Set the LCS maximum number of samba connection to NbMaxconnections"
}
if [[ ! "`hostname`" =~ "lcs" ]] if [[ ! "`hostname`" =~ "lcs" ]]
then then
echo "This script should be run on the LCS" echo "This script should be run on the LCS"
usage
exit 1 exit 1
fi fi
if [ -z "$1" ]
then
usage
exit 1
fi
DIR=`dirname $0` DIR=`dirname $0`
# Update lcs-smb-config then run it to force max connections to 1 # 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 cp /usr/share/lcs/sbin/lcs-smb-config.new /usr/share/lcs/sbin/lcs-smb-config
/usr/share/lcs/sbin/lcs-smb-config /usr/share/lcs/sbin/lcs-smb-config
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment