# Complete System Variables Reference **Generated from**: All `lib/*-paths.sh` and `lib/system-*.sh` derivation files **Last Updated**: 2026-03-20 **Purpose**: Complete list of all `SYS_*` variables available for scripts to use --- ## Overview When launcher.sh initializes, it runs system detection once and derives all platform-specific paths. All scripts can then source `lib/system-variables.sh` to access these variables without needing to hardcode paths or re-detect the platform. **Key Principle**: Never hardcode paths. Always use the appropriate SYS_* variable. --- ## System Detection Variables (from lib/system-detect.sh) ### Control Panel Detection ```bash SYS_CONTROL_PANEL # "cpanel", "plesk", "interworx", or "none" SYS_CONTROL_PANEL_VERSION # Version number (e.g., "102.0.0") ``` ### Operating System Detection ```bash SYS_OS_TYPE # "ubuntu", "debian", "centos", "almalinux", "rocky", "cloudlinux" SYS_OS_VERSION # Major version (e.g., "20", "22" for Ubuntu) SYS_OS_DISTRO # Full distro name ``` ### Web Server Detection ```bash SYS_WEB_SERVER # "apache", "nginx", "litespeed", "openlitespeed" SYS_WEB_SERVER_VERSION # Version string ``` ### Database Detection ```bash SYS_DB_TYPE # "mysql", "mariadb", "postgresql" SYS_DB_VERSION # Version string ``` ### Mail System Detection ```bash SYS_MAIL_SYSTEM # "exim", "postfix", "sendmail" SYS_MAIL_SYSTEM_VERSION # Version string ``` ### Firewall Detection ```bash SYS_FIREWALL # "csf", "firewalld", "iptables", "ufw", "plesk", "none" SYS_FIREWALL_VERSION # Version string ``` ### Detection Status ```bash SYS_DETECTION_COMPLETE # "yes" when all detection is done ``` --- ## Log Path Variables (from lib/log-paths.sh) ### Web Server Logs ```bash SYS_LOG_WEB_ACCESS # Main web server access log SYS_LOG_WEB_ERROR # Main web server error log SYS_LOG_WEB_DOMAIN_ACCESS # Per-domain access logs directory (cPanel/Plesk/InterWorx) SYS_LOG_WEB_DOMAIN_ERROR # Per-domain error logs directory ``` ### Authentication & System Logs ```bash SYS_LOG_AUTH # SSH/sudo/login authentication log (/var/log/auth.log or /var/log/secure) SYS_LOG_SSH # SSH log (alias for SYS_LOG_AUTH) SYS_LOG_WTMP # Who login database (/var/log/wtmp - binary) SYS_LOG_BTMP # Failed login attempts (/var/log/btmp - binary) ``` ### Mail System Logs ```bash SYS_LOG_MAIL_MAIN # Main mail server log SYS_LOG_MAIL_REJECT # Mail rejection log (Exim only) SYS_LOG_MAIL_PANIC # Mail panic log (Exim only) SYS_MAIL_QUEUE_DIR # Mail queue directory (/var/spool/exim, /var/spool/postfix, etc.) ``` ### Firewall Logs ```bash SYS_LOG_FIREWALL # Active firewall log SYS_LOG_FIREWALL_BLOCK # Firewall block events log ``` ### Control Panel Logs ```bash SYS_LOG_PANEL # Control panel logs directory SYS_LOG_PANEL_ERROR # Control panel error log SYS_LOG_PANEL_ACCESS # Control panel access log ``` ### Database Logs ```bash SYS_LOG_DB_ERROR # Database error log SYS_LOG_DB_SLOW # Slow query log ``` ### Security Scanner Logs ```bash SYS_LOG_CLAMAV # ClamAV antivirus log SYS_LOG_MALDET # Linux Malware Detect log SYS_LOG_RKHUNTER # Rootkit Hunter log SYS_LOG_IMUNIFY # Imunify360 log directory ``` ### System Logs ```bash SYS_LOG_SYSTEM # Main system log (/var/log/syslog or /var/log/messages) SYS_LOG_MESSAGES # Alias for SYS_LOG_SYSTEM SYS_LOG_KERN # Kernel log SYS_LOG_AUDIT # Audit log (/var/log/audit/audit.log) SYS_LOG_PKG_MGR # Package manager log (apt or yum) ``` ### PHP Logs ```bash SYS_LOG_PHP_FPM # PHP-FPM error log SYS_LOG_PHP_ERROR # PHP error log ``` ### Service Logs ```bash SYS_LOG_FTP # FTP/VSFTPD log SYS_LOG_DNS # DNS/Named log ``` --- ## Database Path Variables (from lib/database-paths.sh) ### MySQL/MariaDB ```bash SYS_DB_SOCKET # MySQL socket location (/var/lib/mysql/mysql.sock or /var/run/mysqld/mysqld.sock) SYS_DB_CONFIG # MySQL config file (/etc/my.cnf or /etc/mysql/my.cnf) SYS_DB_CONFIG_DIR # MySQL config directory (/etc/my.cnf.d or /etc/mysql/conf.d) SYS_DB_DATA_DIR # MySQL data directory (/var/lib/mysql) SYS_DB_BINARY # MySQL binary path SYS_DB_TMPDIR # MySQL temporary directory SYS_DB_PID_FILE # MySQL PID file ``` ### PostgreSQL ```bash SYS_PG_SOCKET # PostgreSQL socket directory SYS_PG_CONFIG # PostgreSQL config directory SYS_PG_DATA_DIR # PostgreSQL data directory SYS_PG_BINARY # PostgreSQL binary path ``` --- ## Service Information Variables (from lib/service-info.sh) ### Web Server Service Info ```bash SYS_WEB_SERVICE # Service name ("httpd", "apache2", "nginx", etc.) SYS_WEB_USER # Web server user ("www-data", "apache", "nginx") SYS_WEB_GROUP # Web server group SYS_WEB_CONFIG_DIR # Web server main config directory SYS_WEB_MODULES_DIR # Web server modules directory SYS_WEB_VHOSTS_DIR # Virtual hosts config directory SYS_WEB_PID_FILE # Web server PID file ``` ### Database Service Info ```bash SYS_DB_SERVICE # Database service name ("mysqld", "mariadb", "postgresql") SYS_DB_USER # Database system user ("mysql", "postgres") SYS_DB_GROUP # Database system group ``` ### Mail Service Info ```bash SYS_MAIL_SERVICE # Mail service name ("exim", "postfix", "sendmail") SYS_MAIL_USER # Mail system user SYS_MAIL_GROUP # Mail system group SYS_MAIL_CONFIG # Mail config file SYS_MAIL_ALIAS_FILE # Mail aliases file ``` ### SSH/Auth Service Info ```bash SYS_AUTH_SERVICE # SSH service name ("sshd") SYS_AUTH_USER # SSH user ("root") SYS_AUTH_CONFIG # SSH config file (/etc/ssh/sshd_config) ``` ### Firewall Service Info ```bash SYS_FIREWALL_SERVICE # Firewall service name SYS_FIREWALL_CONFIG # Firewall config directory/file SYS_FIREWALL_ALLOW # Firewall allow list file (if applicable) SYS_FIREWALL_DENY # Firewall deny list file (if applicable) ``` ### Package Manager Info ```bash SYS_PKG_MANAGER # Package manager name ("apt", "yum", "dnf") SYS_PKG_MANAGER_CMD # Package manager command SYS_PKG_MANAGER_UPDATE # Update command SYS_PKG_MANAGER_INSTALL # Install command with flags SYS_PKG_MANAGER_REMOVE # Remove command with flags SYS_PKG_MANAGER_UPGRADE # Upgrade command with flags ``` ### Init System Info ```bash SYS_INIT_SYSTEM # Init system type ("systemd" or "sysvinit") SYS_SERVICE_CMD # Service control command SYS_SERVICE_START # Service start command SYS_SERVICE_STOP # Service stop command SYS_SERVICE_RESTART # Service restart command SYS_SERVICE_STATUS # Service status command SYS_SERVICE_ENABLE # Service enable command SYS_SERVICE_DISABLE # Service disable command ``` --- ## Control Panel Specific Variables (from lib/control-panel-paths.sh) ### cPanel Specific Paths ```bash SYS_CPANEL_VERSION_FILE # /usr/local/cpanel/version SYS_CPANEL_BIN_DIR # /usr/local/cpanel/bin SYS_CPANEL_SCRIPTS_DIR # /usr/local/cpanel/scripts SYS_CPANEL_LOGS_DIR # /usr/local/cpanel/logs SYS_CPANEL_ACCESS_LOG # /usr/local/cpanel/logs/access_log SYS_CPANEL_ERROR_LOG # /usr/local/cpanel/logs/error_log SYS_CPANEL_LOGIN_LOG # /usr/local/cpanel/logs/login_log SYS_CPANEL_USERS_DIR # /var/cpanel/users SYS_CPANEL_USERDATA_DIR # /var/cpanel/userdata SYS_CPANEL_MAINIP_FILE # /var/cpanel/mainip SYS_CPANEL_UPDATELOGS_DIR # /var/cpanel/updatelogs SYS_CPANEL_HULK_DB # /var/cpanel/hulkd/cphulk.sqlite SYS_CPANEL_HULK_CTL # /usr/local/cpanel/bin/cphulk_pam_ctl SYS_CPANEL_HULK_WHITELIST # /usr/local/cpanel/scripts/cphulkdwhitelist SYS_CPANEL_PHP_DIR # /usr/local/php SYS_CPANEL_PHP_LOG # /usr/local/php/lib/php.log SYS_CPANEL_DOMAIN_LOGS # /var/log/apache2/domlogs (or alternate) ``` ### Plesk Specific Paths ```bash SYS_PLESK_VERSION_FILE # /usr/local/psa/version SYS_PLESK_BIN_DIR # /usr/local/psa/bin SYS_PLESK_LOGS_DIR # /var/log/plesk SYS_PLESK_VHOSTS_BASE # /var/www/vhosts SYS_PLESK_CONFIG_DIR # /var/lib/psa/db SYS_PLESK_LOG_STRUCTURE # "new" (18.0.50+) or "old" SYS_PLESK_VHOSTS_LOGS_BASE # /var/www/vhosts/system or /var/www/vhosts ``` ### InterWorx Specific Paths ```bash SYS_INTERWORX_VERSION_FILE # /etc/interworx/iworx.ini SYS_INTERWORX_BIN_DIR # /home/interworx/bin SYS_INTERWORX_LOGS_DIR # /home/interworx/var/log SYS_INTERWORX_IWORX_LOG # /home/interworx/var/log/iworx.log SYS_INTERWORX_SITEWORX_LOG # /home/interworx/var/log/siteworx.log SYS_INTERWORX_HOME # /home/interworx SYS_INTERWORX_CHROOT_BASE # /chroot/home ``` ### Common Panel Tools ```bash SYS_PANEL_TOOL_NGINX # ea-nginx location SYS_PANEL_TOOL_CLOUDFLARE # Cloudflare tool location SYS_PANEL_TOOL_LETSENCRYPT # Let's Encrypt tool location ``` --- ## Web Server Configuration Variables (from lib/web-server-config.sh) ### Apache/httpd Configuration ```bash SYS_APACHE_MAIN_CONFIG # Main Apache config file SYS_APACHE_CONFIG_DIR # Apache config directory SYS_APACHE_MODS_DIR # Enabled modules directory SYS_APACHE_MODS_AVAILABLE_DIR # Available modules directory SYS_APACHE_SITES_DIR # Enabled sites directory SYS_APACHE_SITES_AVAILABLE_DIR # Available sites directory SYS_APACHE_CONF_DIR # Config.d directory SYS_APACHE_CONF_AVAILABLE_DIR # Available configs directory SYS_APACHE_DEFAULT_SITE # Default site config SYS_APACHE_MOD_SSL # SSL module config SYS_APACHE_MOD_DEFLATE # Deflate module config SYS_APACHE_MOD_REWRITE # Rewrite module file SYS_APACHE_CPANEL_INCLUDES # cPanel includes directory (cPanel only) SYS_APACHE_CPANEL_MAIN_GLOBAL # cPanel global config (cPanel only) SYS_APACHE_CPANEL_VHOST_DIR # cPanel vhost directory (cPanel only) ``` ### Nginx Configuration ```bash SYS_NGINX_MAIN_CONFIG # Main Nginx config file SYS_NGINX_CONFIG_DIR # Nginx config directory SYS_NGINX_CONF_DIR # conf.d directory SYS_NGINX_SITES_DIR # Enabled sites directory SYS_NGINX_SITES_AVAILABLE_DIR # Available sites directory SYS_NGINX_DEFAULT_SITE # Default site config SYS_NGINX_FASTCGI_PARAMS # FastCGI parameters file SYS_NGINX_PROXY_PARAMS # Proxy parameters file ``` ### LiteSpeed Configuration ```bash SYS_LITESPEED_HOME # LiteSpeed home directory SYS_LITESPEED_CONF_DIR # Config directory SYS_LITESPEED_CONFIG # Main config file SYS_LITESPEED_VHOSTS_DIR # Virtual hosts directory SYS_LITESPEED_LOGS_DIR # Logs directory ``` ### Security Modules ```bash SYS_MODSECURITY_CONF # ModSecurity config SYS_MODSECURITY_RULES_DIR # ModSecurity rules directory SYS_MODSECURITY_AUDIT_LOG # ModSecurity audit log SYS_FAIL2BAN_CONFIG # Fail2Ban config SYS_FAIL2BAN_FILTER_DIR # Fail2Ban filters directory SYS_FAIL2BAN_ACTION_DIR # Fail2Ban actions directory SYS_CSF_CONFIG # CSF firewall config SYS_CSF_ALLOW # CSF allow list SYS_CSF_DENY # CSF deny list SYS_CSF_WHITELIST # CSF whitelist SYS_CSF_REGEX # CSF regex file ``` ### Caching & Optimization ```bash SYS_VARNISH_CONFIG # Varnish config file SYS_VARNISH_CACHE_DIR # Varnish cache directory SYS_PACKAGE_CACHE # Package manager cache directory SYS_PACKAGE_LISTS # Package manager lists directory SYS_PHP_OPCACHE_DIR # PHP OPcache directory ``` ### SSL/TLS Certificates ```bash SYS_SSL_CERT_DIR # System certificates directory SYS_SSL_KEY_DIR # System private keys directory SYS_SSL_CONFIG # OpenSSL config file SYS_LETSENCRYPT_DIR # Let's Encrypt directory SYS_LETSENCRYPT_LIVE # Live certificates directory SYS_LETSENCRYPT_ARCHIVE # Certificate archive directory SYS_CPANEL_SSL_DIR # cPanel SSL directory (cPanel only) SYS_CPANEL_DOMAINS_SSL # cPanel domain certs (cPanel only) ``` --- ## Base Directory Variables ### User Home Directories ```bash SYS_USER_HOME_BASE # Base directory for user homes # /home (cPanel/Standalone) # /var/www/vhosts (Plesk) # /chroot/home (InterWorx) SYS_LOG_DIR # Base directory for logs # /var/log (standard) ``` --- ## Usage Examples ### Example 1: Check Web Access Logs ```bash source "$SCRIPT_DIR/lib/system-variables.sh" # Works on all platforms if [ -f "$SYS_LOG_WEB_ACCESS" ]; then tail -f "$SYS_LOG_WEB_ACCESS" fi ``` ### Example 2: Check Domain-Specific Logs (Platform-Aware) ```bash source "$SCRIPT_DIR/lib/system-variables.sh" # Automatically handles cPanel (/var/log/apache2/domlogs), # Plesk (/var/www/vhosts/system/*/logs), InterWorx (/home/*/var/*/logs) if [ -n "$SYS_LOG_WEB_DOMAIN_ACCESS" ]; then find "$SYS_LOG_WEB_DOMAIN_ACCESS" -name "*.log" -mtime -1 fi ``` ### Example 3: Database Operations ```bash source "$SCRIPT_DIR/lib/system-variables.sh" # Connect to database using correct socket for OS mysql -S "$SYS_DB_SOCKET" -u root -e "SHOW DATABASES" # Check database error log tail -f "$SYS_LOG_DB_ERROR" ``` ### Example 4: Service Management ```bash source "$SCRIPT_DIR/lib/system-variables.sh" # Works on both systemd and sysvinit systems "$SYS_SERVICE_RESTART" "$SYS_WEB_SERVICE" # Or use convenience function restart_service "$SYS_WEB_SERVICE" ``` ### Example 5: Platform-Specific Configuration ```bash source "$SCRIPT_DIR/lib/system-variables.sh" # Handle Apache config differently for Ubuntu vs RHEL if [ -f "$SYS_APACHE_MODS_DIR/ssl.conf" ]; then echo "SSL enabled" fi # Check firewall configuration if [ -f "$SYS_CSF_CONFIG" ]; then echo "CSF Firewall installed" fi ``` --- ## Missing or Expected Fallback If a variable is empty or missing, it typically means: 1. That service is not installed on the system 2. The path has changed in a newer version (check version variables) 3. The variable doesn't apply to the detected platform (e.g., `SYS_CPANEL_*` on a Plesk server) Always check if a variable is non-empty before using it: ```bash if [ -n "$SYS_LOG_MAIL_MAIN" ]; then grep "error" "$SYS_LOG_MAIL_MAIN" fi ``` --- ## Extending System Variables To add new variables for new services or paths: 1. Create or edit the appropriate `lib/*-paths.sh` file 2. Add a `derive_*()` function to set the variables 3. Call it from `derive_all_*()` function 4. Update `lib/system-detect.sh` to call the new derivation 5. Update this reference document 6. Source it in `launcher.sh` --- ## Related Files - **Sourced by scripts**: `lib/system-variables.sh` (re-exports all variables) - **Detection**: `lib/system-detect.sh` (performs initial detection) - **Derivation libraries**: - `lib/log-paths.sh` - `lib/database-paths.sh` - `lib/service-info.sh` - `lib/control-panel-paths.sh` - `lib/web-server-config.sh`