Advertisement
Guest User

portaLogica

a guest
Mar 21st, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.85 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Script to configure logical port for apache logs
  4.  
  5. #variable used to identify if server is using EasyApache 4 or not
  6. file=/etc/cpanel/ea4/is_ea4
  7.  
  8. #function to apply configuration in servers using EasyApache 3
  9. ea3(){
  10.     sed -i.bak 's/%h/[%h]:%{remote}p/g' /var/cpanel/conf/apache/main
  11. }
  12.  
  13. #function to apply configuration in servers using EasyApache 4
  14. ea4(){
  15.     echo 'LogFormat "[%h]:%{remote}p %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined' >> /etc/apache2/conf.d/MarcoCivil.conf
  16. }
  17.  
  18. #backing up httpd.conf file
  19. bak(){
  20.     cp /etc/apache2/conf/httpd.conf /etc/apache2/conf/httpd.conf.bak
  21. }
  22.  
  23. #Main function
  24. main(){
  25.     bak
  26.  
  27.     if [ -e $file ]; then
  28.         ea4
  29.     else
  30.         ea3
  31.     fi
  32.  
  33.     #Rebuilding apache configurations and restarting service to apply modifications
  34.     /scripts/rebuildhttpdconf
  35.     /scripts/restartsrv_apache
  36. }
  37.  
  38. main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement