v12 cli commands - xyzulu/enhance-related GitHub Wiki
Enhance ORCHD logs:
View logs for orchd service:
journalctl -u orchd.service
View logs in real-time:
journalctl -u orchd.service -f
View logs for the last hour:
journalctl -u orchd.service --since "1 hour ago"
View the last 100 logs:
journalctl -u orchd.service -n 100
Tail Apache Logs:
View logs for Apache service:
journalctl -u apache2.service
View logs in real-time:
journalctl -u apache2.service -f
View logs for the last hour:
journalctl -u apache2.service --since "1 hour ago"
View the last 100 logs:
journalctl -u apache2.service -n 100
Tail LiteSpeed & OpenLiteSpeed Logs:
View logs for lshttpd service:
journalctl -u lshttpd.service
View logs in real-time:
journalctl -u lshttpd.service -f
View logs for the last hour:
journalctl -u lshttpd.service --since "1 hour ago"
View the last 100 logs:
journalctl -u lshttpd.service -n 100
Tail Litespeed / OLS WAF logs :
tail -f /usr/local/lsws/logs/security_audit.log
tail -f /usr/local/lsws/logs/auditlog-debug.txt
Tail Nginx Logs:
View logs for nginx service:
journalctl -u nginx.service
View logs in real-time:
journalctl -u nginx.service -f
View logs for the last hour:
journalctl -u nginx.service --since "1 hour ago"
View the last 100 logs:
journalctl -u nginx.service -n 100
Tail All Web Server Logs for all accounts:
tail -f /var/local/enhance/webserver_logs/*.log
Tail Web Server Logs for one website:
tail -f /var/local/enhance/webserver_logs/{uuid}.log
^ Replace {uuid} above with the website ID. You can find this via the UI or via cli
Mysql Logs:
View logs for mysql service:
journalctl -u mysql.service
View logs in real-time:
journalctl -u mysql.service -f
View logs for the last hour:
journalctl -u mysql.service --since "1 hour ago"
View the last 100 logs:
journalctl -u mysql.service -n 100
Tail System Logs or Restart syslog service:
View the syslog:
tail -f /var/log/syslog
Restart the syslog service:
systemctl restart syslog.service
Search for IP addresses:
View Most Active IPs in the webserver logs:
tail -n 500 /var/local/enhance/webserver_logs/*.log | grep -E '"[^"]*" "[^"]*" "[A-Z]+ [^"]*" "[^"]*" "[^"]*" "[^"]*" "[^"]*" "[^"]*"' | awk '{print $1}' | sort | uniq -c | sort -nr
Edit Cronjob for a particular user:
crontab -e -u username
Restarting Services:
Apache:
start
systemctl start apache2.service
stop
systemctl stop apache2.service
restart
systemctl restart apache2.service
Litespeed & Openlitespeed Server:
start /usr/local/lsws/bin/lswsctrl start
stop /usr/local/lsws/bin/lswsctrl stop
restart /usr/local/lsws/bin/lswsctrl restart
Restart Mariadb or Mysql :
systemctl restart mysql.service
Restart ORCHD:
systemctl restart orchd.service
Reinstalling Default UFW Rules:
On each server run:
apt install -y ecp-core --reinstall
Then, on the control panel server:
systemctl restart orchd.service
Enabling Apache modules
- Edit the file:
/etc/apache2/apache2.conf
(Note: Enhance comes with a number of modules available but not enabled, see the list here
- Under the existing "Load modules" add your required module, ie for mod_buffer add:
LoadModule buffer_module modules/mod_buffer.so
-
Then restart Apache with:
systemctl restart apache2.service
-
You can verify a particular modules loaded with grep, ie
apachectl -M | grep buffer
cPanel imports
Cancel failed cPanel or are still pending:
sudo -u postgres psql orchd
Backups
Cancel Pending Restores:
sudo -u postgres psql orchd
and then update restores set finished_at = now() where finished_at is null;
Ubuntu Updates
apt update && sudo apt -y upgrade
Import databases via Command Line on Enhance:
sudo su - username
(replace username with the correct Linux username and then:
mysql -u db_username -p database_name < your_backup.sql
Disk usage
du --exclude='/var/container_tmp/*' --exclude='/var/lib/docker/*' --exclude='/var/local/enhance/*' --exclude='/proc' --exclude='/sys' -h / 2>/dev/null | awk '$1 ~ /[0-9]G/'
or
du --max-depth=3 --exclude=/var/lib/docker/overlay2 --exclude=/var/local/enhance/containers --exclude=/proc --exclude=/sys -h /
And/or:
du --max-depth=2 --exclude=/var/local/enhance/containers /var/local/enhance -h
Sort by owner/user:
du -sh /var/www/* | sort -rh
To find only the top 10 accounts by size, use:
du -sh /var/www/* | sort -rh | head -n 10
Find leftover .sql backup files :
find /var/www/*/.mysql_backup_enhance -type f -exec du -h {} \; -print
Search in Backups on Enhance Backup Server:
grep target_db_name /backups/*/current/home/public_html/wp-config.php
grep account_username /backups/*/current/home/.my.cnf
Clean ups
Empty all syslog files
find /var/log/ -type f -name "syslog*" ! -name "*.gz" -exec truncate -s 0 {} \;
To clear the Main CP logs
sudo -u postgres psql orchd
Force Disable of local MTA:
systemctl stop postfix
and then systemctl disable postfix
Stop and disable rspamd:
systemctl stop rspamd
and then systemctl disable rspamd
Resource usage
To monitor all websites (sorted by CPU usage by default): systemd-cgtop -p -n 0 --depth=1 /websites/
To sort by memory usage, add -m: systemd-cgtop -p -m -n 0 --depth=1 /websites/
To sort by IO load, add -i: systemd-cgtop -p -i -n 0 --depth=1 /websites/
To monitor a specific website, use its website ID: systemd-cgtop -p -n 0 /websites/website-id-here
To locate more long term services resource usage: systemd-cgtop -p -n 0 --depth=1 system.slice
Enhance Appcd CLI Tool:
man/help:
appcd-cli --help
List & View Main Running Processes:
appcd-cli list-processes
Reset LiteSpeed Webserver configs:
appcd-cli reset-webserver-config
Display Current Installed version:
appcd-cli version
Change Web server Type from the CLI on any server:
On the server you wish to change the webserver type, run: appcd-cli change-webserver apache
Other Enhance tips:
After changing the IP address of a server with the backup role (in use) you will need to run, from your control server:
v12-upgrade update-all-website-backup-locations
(Apparently this will not be needed in a future update, but for now it is)
Other handy cli tips
List all Usernames for all accounts on the Enhance Server:
cat /etc/passwd | grep /var/www