Skip to content

Keeping a Tweak Settings change log — and why grep on cpanel.config is not enough

Tweak Settings drift across a fleet is invisible without a change log. A short pattern for tracking what changed, when, and why — using git instead of a notebook.

Three months after taking over a server, you wonder why the bandwidth-overage email isn’t firing. You check the Tweak Setting; it’s off. You don’t remember turning it off. Nobody on the team remembers turning it off. The change log is “what we collectively recall” — which means there is no change log. The fix is to put cpanel.config under version control so every change is a commit with a reason.

What’s happening

/var/cpanel/cpanel.config is the central store for Tweak Settings, written as key=value lines. Every change made through WHM Tweak Settings, cpconftool, or whmapi1 set_tweaksetting lands here. The file is rewritten in place; the previous value is only preserved in /var/cpanel/cpanel.config.cache and only until the next change. Without external history, you cannot answer “when did this change” or “what was the value before”.

How to verify

Inspect the current state and the cache file:

ls -la /var/cpanel/cpanel.config /var/cpanel/cpanel.config.cache
diff /var/cpanel/cpanel.config /var/cpanel/cpanel.config.cache
cat /var/cpanel/cpanel.config | wc -l
stat /var/cpanel/cpanel.config
tail -f /usr/local/cpanel/logs/access_log | grep saveTweak

The cache file is the last-known-previous value. The mtime tells you the last change time. The access log shows the WHM user who made the change — but only for the most recent ones and only for changes made through WHM, not for whmapi1 calls from scripts.

The fix

  1. Put /var/cpanel/cpanel.config into git. Initialize a repo at /etc/sysconfig-history/cpanel-config/ (or wherever your config history lives), copy the current file in, commit. Set up a daily cron: cp /var/cpanel/cpanel.config /etc/sysconfig-history/cpanel-config/cpanel.config && cd /etc/sysconfig-history/cpanel-config && git add . && git commit -m "daily snapshot $(date +%F)" || true.
  2. For every intentional change, commit immediately with a reason: after changing a setting, run git -C /etc/sysconfig-history/cpanel-config commit -am "Set maxemailsperhour=500 — ticket 4421 — reduce outbound spam volume". The reason is the value; the diff is the evidence.
  3. Cron-snapshot weekly to catch silent changes — changes made by upgrades or by scripts you forgot about. git log shows the silent drift; git blame cpanel.config per line shows when each setting was set.
  4. For multi-server fleets, store all hosts’ configs in one repo with one branch per server. A diff main..server2-prod shows every difference between baseline and that host.
  5. For takeovers, the first commit is your baseline. Snapshot before changing anything; every subsequent commit is yours to explain.

The discipline of treating cpanel.config as code is part of what makes Stack Harbor’s cPanel server management practice able to onboard fleets without losing track of why things are set the way they are.