Ok so I made one more semi useful script for a resource control hack, again I make no claims of actual usability or benefit, as of posting this it seems to be working well on my #friendica instance;
#!/bin/bash
# These are the Bouncer's Rules
MAX_KIDS=3 # Only 3 people in the kitchen at once
MAX_HEAT=2 # Only 2% energy allowed
CHECK_TIME=5 # Wait 5 seconds before checking again
while true
do
# 1. Count how many 'lsphp' workers are busy with your site
CURRENT_KIDS=$(pgrep -f "lsphp.*YOUR_INSTANCE_ROOT" | wc -l)
# 2. If there are more than 3...
if [ "$CURRENT_KIDS" -gt "$MAX_KIDS" ]; then
echo "Bouncer: Too many kids! Making the extras wait in the hallway."
# This finds the newest workers and tells them to 'STOP' (Pause)
# They stay in line, but they don't use any CPU while paused.
pgrep -f "lsphp.*YOUR_INSTANCE_ROOT" | tail -n +$((MAX_KIDS+1)) | xargs kill -STOP
# Wait for things to cool down
sleep $CHECK_TIME
# Tell them they can 'CONT' (Continue) one by one
pgrep -f "lsphp.*YOUR_INSTANCE_ROOT" | xargs kill -CONT
fi
# Take a small breath so the Bouncer doesn't get tired
sleep 1
done
README
🚪 The LSPHP Bouncer
Resource Throttle & Process Queue for Shared Hosting
The LSPHP Bouncer is a lightweight Bash watchdog designed for users on LiteSpeed-based hosting. It prevents your account from hitting "Resource Limit Reached" errors (508 errors) by pausing excess PHP processes (lsphp) instead of letting them crash the site or trigger a provider-level kill.
⚠️ Maintenance Notice
This project is provided "as-is" for educational and personal use.
It will not be maintained or updated.
No support or bug fixes will be provided.
Use at your own risk..
🧐 How It Works
LiteSpeed servers often spawn many lsphp workers to handle incoming traffic. If too many start at once, your host might lock your account for exceeding CPU or process limits.
The Headcount: Every second, the Bouncer counts how many PHP workers are active for your specific site.
The Velvet Rope: If the count exceeds your MAX_KIDS limit, the Bouncer sends a SIGSTOP signal to the extra processes. This pauses them—they stay in the queue but stop consuming CPU cycles.
The Entry: After a short cooldown (CHECK_TIME), the Bouncer sends a SIGCONT signal, letting those processes finish their work one by one.
🛠 Configuration
Open the script and adjust these "House Rules" to match your hosting plan:
MAX_KIDS: The maximum number of PHP processes you are allowed (e.g., 3).
CHECK_TIME: How many seconds to pause the "extras" before letting them work again.
Process Filter: The script looks for "lsphp.*your.domain". Ensure the string matches what shows up in your process monitor (usually top or htop).
🚀 Setup & Execution
1. Make it Executable
Bash
chmod +x bouncer.sh
2. Run the Bouncer
To keep the Bouncer running even after you log out of SSH:
Bash
nohup ./bouncer.sh > /dev/null 2>&1 &
📈 Why use this?
Avoids 508 Errors: Instead of the server showing a "Limit Reached" page, the site just feels a tiny bit slower while the Bouncer staggers the load.
CPU Friendly: Paused processes (kill -STOP) consume zero CPU, helping you stay under the "Energy" or "Heat" limits of your host.
Specific Targeting: Using pgrep -f, it only targets your specific site's workers, leaving other processes alone.
⚖️ License (MIT)
Copyright (c) 2026 pasjrwoctx👽 (Philip A. Swiderski Jr.)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@Friendica Support @Friendica Developers @Friendica Admins
You can encourage my continued useless ideas, and by doing so your helping to feed, house and clothe a #disabled man living in #poverty, $5-10-15 It All Helps, via #cashapp at $woctxphotog or via #paypal at https://www.paypal.com/donate?campaign_id=5BN5MB5BVQL22
#!/bin/bash
# These are the Bouncer's Rules
MAX_KIDS=3 # Only 3 people in the kitchen at once
MAX_HEAT=2 # Only 2% energy allowed
CHECK_TIME=5 # Wait 5 seconds before checking again
while true
do
# 1. Count how many 'lsphp' workers are busy with your site
CURRENT_KIDS=$(pgrep -f "lsphp.*YOUR_INSTANCE_ROOT" | wc -l)
# 2. If there are more than 3...
if [ "$CURRENT_KIDS" -gt "$MAX_KIDS" ]; then
echo "Bouncer: Too many kids! Making the extras wait in the hallway."
# This finds the newest workers and tells them to 'STOP' (Pause)
# They stay in line, but they don't use any CPU while paused.
pgrep -f "lsphp.*YOUR_INSTANCE_ROOT" | tail -n +$((MAX_KIDS+1)) | xargs kill -STOP
# Wait for things to cool down
sleep $CHECK_TIME
# Tell them they can 'CONT' (Continue) one by one
pgrep -f "lsphp.*YOUR_INSTANCE_ROOT" | xargs kill -CONT
fi
# Take a small breath so the Bouncer doesn't get tired
sleep 1
done
README
🚪 The LSPHP Bouncer
Resource Throttle & Process Queue for Shared Hosting
The LSPHP Bouncer is a lightweight Bash watchdog designed for users on LiteSpeed-based hosting. It prevents your account from hitting "Resource Limit Reached" errors (508 errors) by pausing excess PHP processes (lsphp) instead of letting them crash the site or trigger a provider-level kill.
⚠️ Maintenance Notice
This project is provided "as-is" for educational and personal use.
It will not be maintained or updated.
No support or bug fixes will be provided.
Use at your own risk..
🧐 How It Works
LiteSpeed servers often spawn many lsphp workers to handle incoming traffic. If too many start at once, your host might lock your account for exceeding CPU or process limits.
The Headcount: Every second, the Bouncer counts how many PHP workers are active for your specific site.
The Velvet Rope: If the count exceeds your MAX_KIDS limit, the Bouncer sends a SIGSTOP signal to the extra processes. This pauses them—they stay in the queue but stop consuming CPU cycles.
The Entry: After a short cooldown (CHECK_TIME), the Bouncer sends a SIGCONT signal, letting those processes finish their work one by one.
🛠 Configuration
Open the script and adjust these "House Rules" to match your hosting plan:
MAX_KIDS: The maximum number of PHP processes you are allowed (e.g., 3).
CHECK_TIME: How many seconds to pause the "extras" before letting them work again.
Process Filter: The script looks for "lsphp.*your.domain". Ensure the string matches what shows up in your process monitor (usually top or htop).
🚀 Setup & Execution
1. Make it Executable
Bash
chmod +x bouncer.sh
2. Run the Bouncer
To keep the Bouncer running even after you log out of SSH:
Bash
nohup ./bouncer.sh > /dev/null 2>&1 &
📈 Why use this?
Avoids 508 Errors: Instead of the server showing a "Limit Reached" page, the site just feels a tiny bit slower while the Bouncer staggers the load.
CPU Friendly: Paused processes (kill -STOP) consume zero CPU, helping you stay under the "Energy" or "Heat" limits of your host.
Specific Targeting: Using pgrep -f, it only targets your specific site's workers, leaving other processes alone.
⚖️ License (MIT)
Copyright (c) 2026 pasjrwoctx👽 (Philip A. Swiderski Jr.)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@Friendica Support @Friendica Developers @Friendica Admins
You can encourage my continued useless ideas, and by doing so your helping to feed, house and clothe a #disabled man living in #poverty, $5-10-15 It All Helps, via #cashapp at $woctxphotog or via #paypal at https://www.paypal.com/donate?campaign_id=5BN5MB5BVQL22