Cyberpanel LiteSpeed VPS WordPress Cron Management for QuicCloud CCSS UCCS LQIP and VPI Tasks with consideration for daily and monthly Quotas

TLDR: TLDR not found, Request an update - use the email share button to let us know you want a speakable TLDR added to this article.

PreRequisits

You have external Cron Set up and Running successfully

Problem

CCSS/UCSS/VPI/LQIP/Image queues not processing and you want to consider your FREE daily and monthly Quick Cloud quotas

The Steps

Here’s the super-basic, copy-paste setup. We’ll add one small script on your VPS, test it, then schedule it daily so CCSS/UCSS/VPI/LQIP/Image queues get processed within safe daily limits.

Part A — Prereqs (do once per site)

  1. SSH in as root.
  2. In each site’s wp-config.php, near the top, add:
define('DISABLE_WP_CRON', true);
define('FS_METHOD', 'direct');
  1. You’ve already confirmed these paths when you set up your external cron:
  • PHP: /usr/local/lsws/lsphp83/bin/php
  • WP-CLI: /usr/bin/wp

Daily and Monthly Caps in QuicCloud

Daily caps stop you hitting the daily ceiling. They do not protect you from blowing the monthly pool early. Lets make the script month-aware so it spreads usage across the remaining days.

Strategy

  1. Set each feature’s official limits once:
    • Image Optimisation: 1,000/day, 10,000/month
    • Page Optimisation (CCSS+UCSS+VPI): 90/day, 2,000/month
    • LQIP: 45/day, 1,000/month
  2. Each night, the script calculates a daily budget like:
    • budget_today = min(daily_limit, floor((monthly_remaining) / days_remaining))
    • Add a small buffer so you never spend the last 2 to 3 days dry.
  3. It then splits Page Optimisation’s budget into:
    • CCSS 45%
    • UCSS 35%
    • VPI 20%
      You can tweak those weights.
  4. The script keeps simple counters in /var/lib/lscq/ and resets them automatically on the first run of a new month.

That way you can happily hit the daily limit sometimes, but the script will back off later in the month so you do not drain the monthly pool too fast.

One-time setup

Log into your server via ssh or create the files manually using your file manager or ftp tool

1) Make a tiny state folder

mkdir -p /var/lib/lscq
chmod 755 /var/lib/lscq

2) Save this month-aware helper

nano /usr/local/bin/run-lsc-quotas-monthly.sh

  • or Create /usr/local/bin/run-lsc-quotas-monthly.sh
  • Paste the entire script starting from the very first line #!/usr/bin/env bash into the new file
  • If using nano Save with Ctrl+O, Enter. Exit with Ctrl+X.
#!/usr/bin/env bash
# Month-aware, quota-safe LiteSpeed queue kicker
# Usage: run-lsc-quotas-monthly.sh /abs/path/to/site

set -euo pipefail

SITE_PATH="${1:-}"
[[ -n "$SITE_PATH" && -d "$SITE_PATH" ]] || { echo "Invalid site path"; exit 1; }

PHP_BIN="/usr/local/lsws/lsphp83/bin/php"
WP="/usr/bin/wp"
PHP_OPTS="-d memory_limit=256M -d max_execution_time=300"

# OFFICIAL LIMITS — edit if your plan changes
DAILY_IMG=1000;  MONTH_IMG=10000
DAILY_PO=90;     MONTH_PO=2000          # Page Optimisation total (CCSS+UCSS+VPI combined)
DAILY_LQIP=45;   MONTH_LQIP=1000

# Split PO across CCSS/UCSS/VPI (must total 100)
W_CCSS=45; W_UCSS=35; W_VPI=20

# Derive site name and state paths
SITE_NAME="$(basename "$(dirname "$SITE_PATH")")"
STATE_DIR="/var/lib/lscq"
STATE_FILE="${STATE_DIR}/usage-${SITE_NAME}.json"
LOCK="/tmp/lscq-${SITE_NAME}.lock"
LOG="/var/log/wp-lscq-${SITE_NAME}.log"

# Init state if missing or month rolled
MONTH_NOW="$(date +%Y-%m)"
if [[ ! -f "$STATE_FILE" ]] || ! grep -q "\"month\":\"$MONTH_NOW\"" "$STATE_FILE" 2>/dev/null; then
  cat >"$STATE_FILE" <<EOF
{"month":"$MONTH_NOW","img":0,"po":0,"lqip":0}
EOF
fi

# Read current usage
IMG_USED=$(php -r "\$j=json_decode(file_get_contents('$STATE_FILE'),true); echo \$j['img'];")
PO_USED=$(php -r  "\$j=json_decode(file_get_contents('$STATE_FILE'),true); echo \$j['po'];")
LQIP_USED=$(php -r "\$j=json_decode(file_get_contents('$STATE_FILE'),true); echo \$j['lqip'];")

# Days remaining including today
DAY=$(date +%d)
DAYS_IN_MONTH=$(cal | awk 'NF {D=$NF} END{print D}')
DAYS_LEFT=$((DAYS_IN_MONTH - DAY + 1))

# Budget calculators with buffer (keep 2 days in hand)
buffer_days=2
safe_days=$(( DAYS_LEFT > buffer_days ? DAYS_LEFT - buffer_days : 1 ))

calc_budget () {
  local daily="$1" monthly="$2" used="$3"
  local remaining=$(( monthly - used ))
  if (( remaining <= 0 )); then echo 0; return; fi
  local per_day=$(( remaining / safe_days ))
  # At least 1 if we still have monthly left
  if (( per_day < 1 )); then per_day=1; fi
  # Never exceed daily cap
  if (( per_day > daily )); then per_day=$daily; fi
  echo $per_day
}

BUDGET_IMG=$(calc_budget "$DAILY_IMG" "$MONTH_IMG" "$IMG_USED")
BUDGET_PO=$(calc_budget "$DAILY_PO"  "$MONTH_PO"  "$PO_USED")
BUDGET_LQIP=$(calc_budget "$DAILY_LQIP" "$MONTH_LQIP" "$LQIP_USED")

# Split PO across tasks
CAP_CCSS=$(( BUDGET_PO * W_CCSS / 100 ))
CAP_UCSS=$(( BUDGET_PO * W_UCSS / 100 ))
CAP_VPI=$((  BUDGET_PO * W_VPI  / 100 ))
# Ensure at least 1 where there is any PO budget
if (( BUDGET_PO > 0 )); then
  (( CAP_CCSS<1 )) && CAP_CCSS=1
  (( CAP_UCSS<1 )) && CAP_UCSS=1
  (( CAP_VPI<1  )) && CAP_VPI=1
fi

# IMG caps apply to both req and pull, split roughly in half
CAP_IMG_REQ=$(( BUDGET_IMG / 2 ))
CAP_IMG_PULL=$(( BUDGET_IMG - CAP_IMG_REQ ))

# Lock to prevent overlap
exec 9>"$LOCK"
if ! flock -n 9; then exit 0; fi

run_n () {
  local n="$1" hook="$2" count=0
  while (( count < n )); do
    if ! "$PHP_BIN" $PHP_OPTS "$WP" --path="$SITE_PATH" --allow-root cron event run "$hook" --quiet ; then
      break
    fi
    ((count++))
    sleep 2
  done
  echo "$(date -Is) $hook processed $count items" >> "$LOG"
  echo "$count"
}

{
  echo "========== $(date -Is) start $SITE_NAME ($SITE_PATH) =========="
  echo "Budgets: PO=$BUDGET_PO (CCSS=$CAP_CCSS, UCSS=$CAP_UCSS, VPI=$CAP_VPI)  LQIP=$BUDGET_LQIP  IMG=$BUDGET_IMG (req=$CAP_IMG_REQ pull=$CAP_IMG_PULL)"

  # Nudge stale metadata a touch
  "$PHP_BIN" $PHP_OPTS "$WP" --path="$SITE_PATH" --allow-root eval "do_action('litespeed_clean_by_kind','ccss');" || true
  "$PHP_BIN" $PHP_OPTS "$WP" --path="$SITE_PATH" --allow-root eval "do_action('litespeed_clean_by_kind','ucss');" || true

  # Run within caps
  DID_CCSS=$(run_n "$CAP_CCSS"   litespeed_task_ccss)
  DID_UCSS=$(run_n "$CAP_UCSS"   litespeed_task_ucss)
  DID_VPI=$(run_n "$CAP_VPI"     litespeed_task_vpi)
  DID_LQIP=$(run_n "$BUDGET_LQIP" litespeed_task_lqip)
  DID_IMG1=$(run_n "$CAP_IMG_REQ"  litespeed_task_imgoptm_req)
  DID_IMG2=$(run_n "$CAP_IMG_PULL" litespeed_task_imgoptm_pull)
  run_n 3 litespeed_task_crawler >/dev/null

  # Update state
  NEW_PO=$(( PO_USED + DID_CCSS + DID_UCSS + DID_VPI ))
  NEW_LQIP=$(( LQIP_USED + DID_LQIP ))
  NEW_IMG=$(( IMG_USED + DID_IMG1 + DID_IMG2 ))
  php -r '
    $f = $argv[1];
    $m = $argv[2]; $img=$argv[3]; $po=$argv[4]; $lqip=$argv[5];
    file_put_contents($f, json_encode(["month"=>$m,"img"=>(int)$img,"po"=>(int)$po,"lqip"=>(int)$lqip], JSON_UNESCAPED_SLASHES));
  ' "$STATE_FILE" "$MONTH_NOW" "$NEW_IMG" "$NEW_PO" "$NEW_LQIP"

  # Final sweep
  "$PHP_BIN" $PHP_OPTS "$WP" --path="$SITE_PATH" --allow-root cron event run --due-now --quiet || true

  echo "Usage now: IMG=$NEW_IMG/$MONTH_IMG  PO=$NEW_PO/$MONTH_PO  LQIP=$NEW_LQIP/$MONTH_LQIP"
  echo "========== $(date -Is) end $SITE_NAME =========="
} >> "$LOG" 2>&1

Make it executable:

chmod +x /usr/local/bin/run-lsc-quotas-monthly.sh

3) Test one site

/usr/local/bin/run-lsc-quotas-monthly.sh /home/brighterwebsites.com.au/public_html
tail -n 80 /var/log/wp-lscq-brighterwebsites.com.au.log
cat /var/lib/lscq/usage-brighterwebsites.com.au.json

It may take a little while to run, but You should see budgets printed and usage counters updating.

4) Schedule daily, staggered, if you have multiple sites running on the same vps

# Daily month-aware LiteSpeed maintenance
7 3 * * *  /usr/local/bin/run-lsc-quotas-monthly.sh /home/brighterwebsites.com.au/public_html
17 3 * * * /usr/local/bin/run-lsc-quotas-monthly.sh /home/pawsforsupport.com.au/public_html
27 3 * * * /usr/local/bin/run-lsc-quotas-monthly.sh /home/oneteamqld.com.au/public_html
Cron job scheduler interface screenshot.

Add with crontab -e, or use the CyberPanel GUI and paste each command into the Command box at those times.

Run a first pass now

SSH as root and run:

/usr/local/bin/run-lsc-quotas-monthly.sh /home/brighterwebsites.com.au/public_html
/usr/local/bin/run-lsc-quotas-monthly.sh /home/pawsforsupport.com.au/public_html
/usr/local/bin/run-lsc-quotas-monthly.sh /home/oneteamqld.com.au/public_html

Totally normal for the first run to feel slow.

Why it’s taking a while

  • The script may try up to these counts in one pass: CCSS 45% + UCSS 35% + VPI 20% of Page Optimisation, plus LQIP, plus Image Optim req + pull.
  • With the default weights that can be ~700 iterations. There is a built-in 2-second pause per iteration.
  • Worst case: 700 × 2 seconds is about 23 minutes, per site, and QUIC.cloud work itself can add time.

Make sure it’s actually progressing

Run these in another SSH window:

# Watch progress log live
tail -f /var/log/wp-lscq-brighterwebsites.com.au.log


[root@host2 ~]# tail -n 20 /var/log/wp-lscq-oneteamqld.com.au.log
tail: cannot open '/var/log/wp-lscq-oneteamqld.com.au.log' for reading: No such file or directory


# See the month counters ticking up
cat /var/lib/lscq/usage-brighterwebsites.com.au.json

You should see lines like:

... litespeed_task_ccss processed 12 items
... litespeed_task_ucss processed 9 items
...

If that’s moving, all good. Just let it finish.

Oh no an error?

Error: Invalid cron event ‘litespeed_task_ucss’ 2025-09-10T23:57:39-04:00 litespeed_task_ucss processed 0 items

You’re fine. That message just means there isn’t a UCSS job scheduled right now on Brighter Websites, so WP-CLI says “Invalid cron event ‘litespeed_task_ucss’”. It’s not a failure. Your log shows CCSS processed 40 items, which is exactly what we wanted.

**This shouldnt happen now, as the script has been patched to skip if missing check (ie if the task has no pending tasks for that particular quota)

Go have a coffee

Then grab the last 20 lines of each log:

tail -n 20 /var/log/wp-lscq-brighterwebsites.com.au.log
tail -n 20 /var/log/wp-lscq-pawsforsupport.com.au.log
tail -n 20 /var/log/wp-lscq-oneteamqld.com.au.log

Paste those into ChatGPT and confirm that the budgets and counters look right.

If you want to check the usage counters too

cat /var/lib/lscq/usage-brighterwebsites.com.au.json
cat /var/lib/lscq/usage-pawsforsupport.com.au.json
cat /var/lib/lscq/usage-oneteamqld.com.au.json

Prompt for ChatGPT:

Paste the output 
QuicCloudCDN has the following Daily and Monthly Quotas confirm that the budgets and counters look right


if OneTeam has no CCSS/UCSS/VPI/LQIP/Image queues, the script will basically do a quick sweep and exit. You should still see a log header though. If there’s no log file at all, it simply hasn’t run for that site yet (via cron or manually), or it couldn’t write to /var/log/.

Tuning notes

  • Want to be more conservative early in the month. Increase buffer_days to 3 or 4.
  • Need to push harder after a content push. Temporarily lower buffer_days to 1 and bump W_CCSS to 50 if CCSS is lagging.
  • If a site is quiet, reduce the weights or daily caps for that site only by cloning this script with site-specific numbers.

This gives you the best of both worlds. You stay comfortably under the daily limits and you pace yourself so you do not exhaust the monthly pool early.

Part G — Quick health checks

  • View today’s log: tail -n 100 /var/log/wp-lscq-brighterwebsites.com.au.log
  • Check the queue widgets in LiteSpeed → Toolbox → Manage. Requests in queue should trend down each day.
  • If you ever see jobs stuck, you can still click “Force cron” safely. The daily script will pick up the rest the next morning.

Optional ideas

  • If Brighter Websites stays on “CDN Bypassed” for ShortPixel, that is fine. The script works locally. If you later turn CDN back on, no changes needed.
  • If you want a weekly safety run as well, add the weekly entries from earlier. It will not exceed quotas because the caps are enforced in the script.

If you hit any errors when you run Part C, paste the last 20 lines of the log and I will pinpoint the exact hook to adjust.

Estimate Time:

Tools

Tags

Want to Share Your Expertise?

We’re always on the lookout for fresh voices and valuable insights to feature on the Brighter Websites blog.
If you’re passionate about web design, SEO, marketing, or small business growth, we’d love to hear from you.
Send your content ideas or guest post pitch to support@brighterwebsites.com.au.

© 2025 Brighter Websites . All rights reserved.

Uh oh, the form hit a snag.

Looks like something didn’t load right.

Give it another go, or flick us a message at support@brighterwebsites.com.au  if it keeps failing. We’ll fix it faster than you can say “cache clear.”

You can phone Vanessa too - she doesn't mind a chat 0412401933

brighter websites logo

Work with me.

Fill out the form below to speak with Vanessa about your website.
subscribed