Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function preforkeditor {
- httpedit=$1
- read -e -p "What is our new Start Servers? " -i 8 ifmodfork_StartServers
- read -e -p "What is our new Min Spare Server? " -i 5 ifmodfork_MinSpareServer
- read -e -p "What is our new Max Spare Server? " -i 20 ifmodfork_MaxSpareServers
- read -e -p "What is our new Server Limit? " -i 256 ifmodfork_ServerLimit
- read -e -p "What is our new Max Clients? " -i 256 ifmodfork_MaxClients
- read -e -p "What is our new Max Request Per Child? " -i 4000 ifmodfork_MaxRequestsPerChild
- sed -n '/<IfModule prefork*/,/</IfModule>/p' $httpdedit
- }
- sed -i "/^<IfModule prefork*/,/^IfModule>/{
- /StartServers/ s/${startserver} */9/
- /MinSpareServer/ s/${MinSpareServers} */3/
- /MaxSpareServers/ s/${MaxSpareServers} */21/
- /ServerLimit/ s/${ServerLimit} */300/
- /MaxClients/ s/${MaxClients} */300/
- /MaxRequestsPerChild/ s/${MaxRequestsPerChild} */5000/
- }" httpd.test
- <IfModule prefork.c>
- StartServers 8
- MinSpareServers 5
- MaxSpareServers 20
- ServerLimit 256
- MaxClients 256
- MaxRequestsPerChild 4000
- </IfModule>
- sed "/^<IfModule prefork*/,/^</IfModule>/ {
- /StartServers/ s/[0-9][0-9]*/9/
- /MinSpareServer/ s/[0-9][0-9]*/3/
- /MaxSpareServers/ s/[0-9][0-9]*/21/
- /ServerLimit/ s/[0-9][0-9]*/300/
- /MaxClients/ s/[0-9][0-9]*/300/
- /MaxRequestsPerChild/ s/[0-9][0-9]*/5000/
- }" httpd.test
- /StartServers/ s/[0-9][0-9]*/$ifmodfork_StartServers/
- /<IfModule prefork.c>/,/</IfModule>/ {
- s/(StartServerss+)[0-9]+/1 11/
- s/(MinSpareServerss+)[0-9]+/1 12312321/
- }
- sed -f Foo.sed Input.txt
- sed -i -f Foo.sed Input.txt
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement