Just a question regarding wrapper script and cPanel

vivek

Well-Known Member
#1
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
 

vivek

Well-Known Member
#4
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
 

vivek

Well-Known Member
#5
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:

mistwang

LiteSpeed Staff
#6
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.
 

vivek

Well-Known Member
#7
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
 

mistwang

LiteSpeed Staff
#8
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.
 

vivek

Well-Known Member
#9
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
 

mistwang

LiteSpeed Staff
#10
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.
 
Top