Find Jobs
Hire Freelancers

Correct my script that "kill Apache and all sub-processes" if server load is over 7 for the 1 minute...

$10-30 CAD

Completed
Posted over 2 years ago

$10-30 CAD

Paid on delivery
I'm looking for help to correct the following script that does the following if the server is under a DDOS attack and the server's 1 minute load is over 7... - kill Apache and all subprocesses - wait 30 seconds - restart Apache ...I currently have the following script... ---------------------------- #!/bin/bash load=$(w | grep load | awk '{print $10}' | cut -d , -f1 | cut -d . -f1) load2=7 if [[ $load -ge $load2 ]]; then echo "$load" systemctl restart httpd for pid in $(ps -ef | grep httpd | awk '{print $2}'); do kill -9 $pid;done sleep 30; systemctl restart httpd else echo "normal all ok" fi ---------------------------- ...however, when the above script does execute, it kills Apache and all subprocesses as it should; however, after waiting 30 seconds, Apache does not restart and returns the errors mentioned below when I try to restart Apache manually at the command prompt. The only way I can get Apache restarted again is by using WHM and selecting "Home » Restart Services » HTTP Server (Apache)" ============================================ [root@primary2 ~]# /scripts/restartsrv_httpd Waiting for “httpd” to start ……info [restartsrv_httpd] systemd failed to start the service “httpd” (The “/usr/bin/systemctl restart [login to view URL] --no-ask-password” command (process 7538) reported error number 1 when it ended.): Job for [login to view URL] failed because the control process exited with error code. See "systemctl status [login to view URL]" and "journalctl -xe" for details. …Waiting for httpd,litespeed,lscgid to shutdown ... not running. info [restartsrv_httpd] systemd failed to start the service “httpd” (The “/usr/bin/systemctl restart [login to view URL] --no-ask-password” command (process 7583) reported error number 1 when it ended.): Job for [login to view URL] failed because the control process exited with error code. See "systemctl status [login to view URL]" and "journalctl -xe" for details. …info [restartsrv_httpd] The service 'httpd' failed to restart at least three times. The system will now rebuild the [login to view URL] file. info [restartsrv_httpd] systemd failed to start the service “httpd” (The “/usr/bin/systemctl restart [login to view URL] --no-ask-password” command (process 7941) reported error number 1 when it ended.): Job for [login to view URL] failed because the control process exited with error code. See "systemctl status [login to view URL]" and "journalctl -xe" for details. …failed. Cpanel::Exception::Services::StartError Service Status undefined status from Cpanel::ServiceManager::Services::Httpd Service Error (XID a8y8dp) The “httpd” service failed to start. Startup Log Jan 04 01:52:00 [login to view URL] systemd[1]: Starting Apache web server managed by cPanel EasyApache... Jan 04 01:52:02 [login to view URL] restartsrv_httpd[7944]: [Tue Jan 04 01:52:02.382417 2022] [core:emerg] [pid 8017] (28)No space left on device: AH00023: Couldn't create the mpm-accept mutex Jan 04 01:52:02 [login to view URL] restartsrv_httpd[7944]: (28)No space left on device: could not create accept mutex Jan 04 01:52:02 [login to view URL] restartsrv_httpd[7944]: AH00015: Unable to open logs Jan 04 01:52:02 [login to view URL] systemd[1]: [login to view URL]: control process exited, code=exited status=1 Jan 04 01:52:02 [login to view URL] systemd[1]: Failed to start Apache web server managed by cPanel EasyApache. Jan 04 01:52:02 [login to view URL] systemd[1]: Unit [login to view URL] entered failed state. Jan 04 01:52:02 [login to view URL] systemd[1]: [login to view URL] failed. httpd has failed. Contact your system administrator if the service does not automagically recover. ============================================
Project ID: 32541256

About the project

11 proposals
Remote project
Active 2 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
Awarded to:
User Avatar
$0 CAD in 1 day
4.9 (28 reviews)
3.8
3.8
11 freelancers are bidding on average $23 CAD for this job
User Avatar
Greetings! I can correct your script. Thank you!
$30 CAD in 1 day
5.0 (81 reviews)
5.5
5.5
User Avatar
Hello. Do you still require help with the script and Apache service? I'm available immediately to sort this out for you. Please see my profile for references. Thank you.
$25 CAD in 1 day
5.0 (18 reviews)
4.1
4.1
User Avatar
Hi, I have more than 7+ years of experience as a Linux System Admin. I can help you right away! Ping me for more discussion. Thank you.
$25 CAD in 1 day
5.0 (8 reviews)
2.8
2.8
User Avatar
Hi, I have 8 years of experience as System Administrator. I would like to offer my services for this task. I can help you with the script. Lets chat if interested. Thanks
$20 CAD in 1 day
5.0 (9 reviews)
3.0
3.0
User Avatar
Hello, Hope you are doing well. I have 6 years of experience in the Linux system administration with website hosting and migration and bash script. It was easy task for me. I certified from AWS and cpanel. We can discuss more in the chat. Thanks
$20 CAD in 1 day
5.0 (3 reviews)
1.8
1.8
User Avatar
Hi, I can create a new or modify this script for you for the purpose you mentioned. Let's connect to start working on it asap
$24 CAD in 1 day
4.4 (6 reviews)
2.1
2.1
User Avatar
I can fix this problem - i need only ssh access to server.
$20 CAD in 1 day
5.0 (2 reviews)
1.5
1.5
User Avatar
Hi there! I'm Mario and I'm based in Argentina. I just read your post and found a 'no space left on device' error there. Are you sure you don't have any problems with disk space in your system? In any case, feel free to contact me if you need help. Have a nice day!
$20 CAD in 1 day
5.0 (1 review)
0.6
0.6
User Avatar
I can help you to fix the script
$20 CAD in 7 days
0.0 (0 reviews)
0.0
0.0

About the client

Flag of CANADA
Surrey, Canada
5.0
6
Payment method verified
Member since Jan 17, 2016

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.