Managing an Enhance server requires familiarity with various commands that help you monitor and maintain your server’s performance. Below is a list of essential daily commands that will assist you in efficiently managing your Enhance server. Enhance servers run on Ubuntu and utilize Docker containers for services like PHP, web servers, and account management, making these commands particularly useful.
Enhance ORCHD logs:
docker logs -f orchd
Container Stats Rams / CPU / Net IO / Block IO :
# With live updates :
sudo docker stats
# No live Updates:
docker stats --no-stream
Tail Apache Logs:
docker logs -f apache
Tail OpenLiteSpeed Logs:
docker logs -f openlitespeed
Tail LiteSpeed Logs:
docker logs -f litespeed
Tail Litespeed cPFence WAF logs :
docker exec litespeed tail -f /usr/local/lsws/logs/security_audit.log
docker exec litespeed tail -f /usr/local/lsws/logs/auditlog-debug.txt
or
docker exec openlitespeed tail -f /usr/local/lsws/logs/security_audit.log
docker exec openlitespeed tail -f /usr/local/lsws/logs/auditlog-debug.txt
Tail Nginx Logs:
docker logs -f nginx
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
Tip: Replace {uuid} with the website ID which is visible in your browser’s address bar when managing the website.
Tail Docker Container Logs:
tail -f /var/lib/docker/containers/*/*.log
Tail System Logs:
tail -f /var/log/syslog
View Most Active IPs:
tail -n 500 /var/local/enhance/webserver_logs/*.log | grep -E '"[^"]*" "[^"]*" "[A-Z]+ [^"]*" "[^"]*" "[^"]*" "[^"]*" "[^"]*" "[^"]*"' | awk '{print $1}' | sort | uniq -c | sort -nr
Edit Cronjob for Users:
crontab -e -u username
Container Management
Entering a Container:
docker exec -it apache bash
docker exec -it openlitespeed bash
docker exec -it litespeed bash
docker exec -it nginx bash
To exit, simply type:
exit
Restarting Apache Service in Enhance:
docker exec apache apachectl -k stop
docker exec apache apachectl -k start
docker exec apache apachectl -k restart
Graceful Restart of Apache:
docker exec apache apachectl -k graceful
Restart / Stop / Start Litespeed & Openlitespeed Server:
# OLS
docker exec openlitespeed /usr/local/lsws/bin/lswsctrl stop
docker exec openlitespeed /usr/local/lsws/bin/lswsctrl start
docker exec openlitespeed /usr/local/lsws/bin/lswsctrl restart
# Litespeed
docker exec litespeed /usr/local/lsws/bin/lswsctrl stop
docker exec litespeed /usr/local/lsws/bin/lswsctrl start
docker exec litespeed /usr/local/lsws/bin/lswsctrl restart
Restart Mariadb or Mysql :
# Mysql
docker stop mysql
docker start mysql
# Mariadb
docker stop mariadb
docker start mariadb
Restart Enhance orchd:
docker restart orchd
Reinstalling Default UFW Rules:
On each server run this :
apt install --reinstall appcd
Then, on the control panel server:
docker restart orchd
Listing All Containers and Checking Status:
docker ps -a
Cancel cPanel imports that failed and are still pending:
Run this command :
docker exec -it orchd-postgres psql -U enhance
Then run this command :
update import_migrations set status = 'failed' where status = 'queued';
Cancel Hanged Pending Restores :
First run this :
docker exec -it orchd-postgres psql -U enhance
Then This :
update restores set finished_at = now() where finished_at is null;
Apply Latest Ubuntu Updates :
apt update && sudo apt -y upgrade
Change Web server Type from the CLI on Main Control Panel :
On the main control panel :
appcd-cli 127.0.0.1 change-webserver apache
Tip : you can replace apache with the server type you want , possible values: apache, dummy-web-server, lite-speed, open-lite-speed, nginx
List all Usernames for all accounts on the Enhance Server :
cat /etc/passwd | grep /var/www
Import Big DB via Command Line on Enhance:
su username
mysql -u db_username -p database_name < your_backup.sql
Clear Unused Docker Images to save space:
docker image prune -a
This will clear from 1 GB to 5GB or more.
Diagnose Enhance Server 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 you can also run :
du --max-depth=2 --exclude=/var/local/enhance/containers /var/local/enhance -h
To find the accounts with the largest size, use:
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 /*/*/*/.mysql_backup_enhance -type f -exec du -h {} \; -print
Search in Backups on Enhance Backup Server:
grep target_db_name /backups/*/backup-subvolume/home/public_html/wp-config.php
or
grep account_username /backups/*/backup-subvolume/home/.my.cnf
Search and Delete Snapshots on Enhance Backup Server :
# Search for Snapshots :
btrfs subvolume list /backups/ | grep 'website_id_here'
# Delete Snapshots with IDs:
btrfs subvolume delete --subvolid=id_from_list_command /backups/
Empty all syslog files
find /var/log/ -type f -name "syslog*" ! -name "*.gz" -exec truncate -s 0 {} \;
To clear the Main CP logs
docker exec -it orchd-postgres psql -U enhance
then
delete from activities;
Force Disable of local MTA :
systemctl stop postfix
systemctl disable postfix
Enhance Appcd CLI Tool :
This CLI tool from Enhance you can use –help to find more info about it :
appcd-cli --help
appcd
appcd client
USAGE:
appcd-cli [IP]
ARGS:
OPTIONS:
-h, --help Print help information
SUBCOMMANDS:
change-webserver
container-status
create-website
delete-website
help Print this message or the help of the given subcommand(s)
install-imap
install-maria-db
install-mta
list-containers
list-processes
list-websites
reset-webserver-config
run-command-in-container
uninstall-legacy-email-services
upgrade-mysqlcd-to-mysql
upload-file
version
These commands form the backbone of daily operations on an Enhance server. By familiarizing yourself with these commands, you can ensure smooth operation, quickly address issues, and maintain the security and performance of your server.
If you have any other useful commands that you regularly use to manage your Enhance server and aren’t listed here, we’d love to hear from you! Share your tips and tricks in the comments below to help others optimize their server management routines. Together, we can build a more comprehensive resource for the Enhance community.
No comment