LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > Install/Configuration > Just a question regarding wrapper script and cPanel

Reply
 
Thread Tools Display Modes
  #1  
Old 04-14-2008, 11:44 AM
vivek vivek is offline
Senior Member
 
Join Date: Jan 2008
Posts: 275
Thumbs up Just a question regarding wrapper script and cPanel

Hello

I know because of the recent cPanel change, and the wrapper script, the server load is increasing when a user creates a domain.

I was wondering, what if we delete ( or empty) the file /scripts/restartsrv_http which is the file used by cPanel for restarting apache., and let litespeed to NOT to use the wrapper script just like before.

I think it will not cause any problem, the cPanel will execute the script /script/restartsrv_httpd and if the file is empty then it will not restart the apache ( or litespeed ) . Thus the litespeed can work just as usual, as before, and we can enable "auto load if httpd.conf changes"

I dont know what will be the result, I havent tried it.

Mistwang , what do you think ?


Vivek
Reply With Quote
  #2  
Old 04-14-2008, 12:11 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
I'd rather not doing that, instead, change the restartsrv_httpd to use "lswsctrl restart" is a better solution to me.
Reply With Quote
  #3  
Old 04-14-2008, 09:30 PM
vivek vivek is offline
Senior Member
 
Join Date: Jan 2008
Posts: 275
Quote:
Originally Posted by mistwang View Post
I'd rather not doing that, instead, change the restartsrv_httpd to use "lswsctrl restart" is a better solution to me.
If lsws can restart automatically when htttpd.conf changes, then what is the use of this ?
A forced restart ?
Reply With Quote
  #4  
Old 04-14-2008, 09:34 PM
vivek vivek is offline
Senior Member
 
Join Date: Jan 2008
Posts: 275
Quote:
Originally Posted by vivek View Post
If lsws can restart automatically when htttpd.conf changes, then what is the use of this ?
A forced restart ?
George, I would like to test this on my server and need you help.

I know, if the cPanel updates itself, it may rewrite the restartsrv_httpd file. So I want a script that will run as a cron , and check whether the file is changed or not. and if changed then restore the original file.

I am not so good in bash scripting, can you give me the curresponding code for the below ?

if sizeof(/scritps/restartsrv_httpd > xxxx )
rm -rf /scripts/restartsrv_httpd
cp backup_of_restartsrv_httpd /scripts/restartsrv_httpd
end if

where xxxx is the NEW size of /scripts/restartsrv_httpd after modifying.

Thanks in advance.
Vivek
Reply With Quote
  #5  
Old 04-14-2008, 10:30 PM
vivek vivek is offline
Senior Member
 
Join Date: Jan 2008
Posts: 275
Great News!

I just tried this,

backed up original /scripts/restartsrv_httpd

deleted /scripts/restartsrv_httpd
created new /scripts/restartsrv_httpd with the following code

Code:
#!/bin/bash
service lsws restart
Disabled the WRAPPER option from LSWS Admiin Panel.
and enabled Auto Reload ( Depreciated )

I removed and added a domain and looks like the server load is just okay and lsws is not terminated by cpanel.

Yes, I can see lsws is still running fine without any load problem!

There can be 2 problems with this

1. If the restartsrv_httpd file changes by cpanel
2. If we want to use apache temporary

I am pretty sure these can be eliminated easily. But I am not sure how to do.

Vivek

Last edited by vivek; 04-15-2008 at 09:30 AM..
Reply With Quote
  #6  
Old 04-15-2008, 09:28 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
I think we will change the restartsrv_httpd script to able restart both Apache and lsws by test which web server is running.
for testing LSWS, just use

kill -0 /tmp/lshttpd/lshttpd.pid
if [ $? -eq 0 ]; then
service lsws restart
fi

kill -0 <apache httpd.pid>
if [ $? -eq 0 ]; then

Original cPanel code

fi

lshttpd can monitor the file and recreate it if has been changed just like the httpd file.
Reply With Quote
  #7  
Old 04-15-2008, 09:40 AM
vivek vivek is offline
Senior Member
 
Join Date: Jan 2008
Posts: 275
Quote:
Originally Posted by mistwang View Post
I think we will change the restartsrv_httpd script to able restart both Apache and lsws by test which web server is running.
for testing LSWS, just use

kill -0 /tmp/lshttpd/lshttpd.pid
if [ $? -eq 0 ]; then
service lsws restart
fi

kill -0 <apache httpd.pid>
if [ $? -eq 0 ]; then

Original cPanel code

fi

lshttpd can monitor the file and recreate it if has been changed just like the httpd file.

Just a question, Is there any problem if I write this shell code in perl file?
sorry if this question is wrong. I am not sure about this

I see that the restartsrv_httpd is starting with
#!/usr/bin/perl

Or should I duplicate this file like this

mv restartsrv_httpd restartsrv_httpd1

nano restartsrv_httpd

then add these lines

Code:
kill -0 /tmp/lshttpd/lshttpd.pid
if [ $? -eq 0 ]; then
   service lsws restart
fi

kill -0 <apache httpd.pid>
if [ $? -eq 0 ]; then

/scripts/restartsrv_httpd1
fi
Reply With Quote
  #8  
Old 04-15-2008, 09:52 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
You can rewrite the script in Perl. no problem.
Call the original script should work fine was well. I prefer this as the wrapper script does not need to be updated even when cPanel script updated.
Reply With Quote
  #9  
Old 04-15-2008, 09:55 AM
vivek vivek is offline
Senior Member
 
Join Date: Jan 2008
Posts: 275
ok thank you,
I will try it.

I just contacted cpanel for fixing another problem related to some log programs like webalizer and I think they may update cpanel installation. So, I will try it after fixing the log problem.

Vivek
Reply With Quote
  #10  
Old 04-15-2008, 11:28 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
I think it is a better solution than the httpd wrapper. we are going to implement this.

Next thing need to be done to make cPanel user easier to some how to patch easyapache to build PHP binary with LiteSpeed SAPI automatically whenever user rebuild Apache mod_php.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 10:05 AM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.