diff --git a/src/lib/ee_lib_mysql_info.sh b/src/lib/ee_lib_mysql_info.sh index 0108d6c2..6e4706de 100644 --- a/src/lib/ee_lib_mysql_info.sh +++ b/src/lib/ee_lib_mysql_info.sh @@ -2,21 +2,26 @@ function ee_lib_mysql_info() { - local ee_mysql_version=$(mysql -V | awk '{print($5)}' | cut -d ',' -f1) - local ee_mysql_port=$(mysql -e "show variables" | grep ^port | awk '{print($2)}') - local ee_mysql_socket=$(mysql -e "show variables" | grep "^socket" | awk '{print($2)}') - local ee_mysql_data_dir=$(mysql -e "show variables" | grep datadir | awk '{print($2)}') - local ee_mysql_wait_timeout=$(mysql -e "show variables" | grep ^wait_timeout | awk '{print($2)}') - local ee_mysql_interactive_timeout=$(mysql -e "show variables" | grep ^interactive_timeout | awk '{print($2)}') - local ee_mysql_max_connections=$(mysql -e "show variables" | grep "^max_connections" | awk '{print($2)}') - local ee_mysql_max_used_connections=$(mysql -e "show global status" | grep Max_used_connections | awk '{print($2)}') + mysqladmin ping &>> $EE_COMMAND_LOG + if [ $? -ne 0 ]; then + local ee_mysql_version=$(mysql -V | awk '{print($5)}' | cut -d ',' -f1) + local ee_mysql_port=$(mysql -e "show variables" | grep ^port | awk '{print($2)}') + local ee_mysql_socket=$(mysql -e "show variables" | grep "^socket" | awk '{print($2)}') + local ee_mysql_data_dir=$(mysql -e "show variables" | grep datadir | awk '{print($2)}') + local ee_mysql_wait_timeout=$(mysql -e "show variables" | grep ^wait_timeout | awk '{print($2)}') + local ee_mysql_interactive_timeout=$(mysql -e "show variables" | grep ^interactive_timeout | awk '{print($2)}') + local ee_mysql_max_connections=$(mysql -e "show variables" | grep "^max_connections" | awk '{print($2)}') + local ee_mysql_max_used_connections=$(mysql -e "show global status" | grep Max_used_connections | awk '{print($2)}') - ee_lib_echo - ee_lib_echo "MySQL ($ee_mysql_version) on $EE_MYSQL_HOST:" - ee_lib_echo_escape "port\t\t\t\t \033[37m$ee_mysql_port" - ee_lib_echo_escape "wait_timeout\t\t\t \033[37m$ee_mysql_wait_timeout" - ee_lib_echo_escape "interactive_timeout\t\t \033[37m$ee_mysql_interactive_timeout" - ee_lib_echo_escape "max_used_connections\t\t \033[37m$ee_mysql_max_used_connections/$ee_mysql_max_connections" - ee_lib_echo_escape "datadir\t\t\t\t \033[37m$ee_mysql_data_dir" - ee_lib_echo_escape "socket\t\t\t\t \033[37m$ee_mysql_socket" + ee_lib_echo + ee_lib_echo "MySQL ($ee_mysql_version) on $EE_MYSQL_HOST:" + ee_lib_echo_escape "port\t\t\t\t \033[37m$ee_mysql_port" + ee_lib_echo_escape "wait_timeout\t\t\t \033[37m$ee_mysql_wait_timeout" + ee_lib_echo_escape "interactive_timeout\t\t \033[37m$ee_mysql_interactive_timeout" + ee_lib_echo_escape "max_used_connections\t\t \033[37m$ee_mysql_max_used_connections/$ee_mysql_max_connections" + ee_lib_echo_escape "datadir\t\t\t\t \033[37m$ee_mysql_data_dir" + ee_lib_echo_escape "socket\t\t\t\t \033[37m$ee_mysql_socket" + else + ee_lib_echo "MYSQL not installed" + fi } diff --git a/src/lib/ee_lib_nginx_info.sh b/src/lib/ee_lib_nginx_info.sh index 96257980..7d568b56 100644 --- a/src/lib/ee_lib_nginx_info.sh +++ b/src/lib/ee_lib_nginx_info.sh @@ -2,23 +2,28 @@ function ee_lib_nginx_info() { - local ee_nginx_version=$(nginx -v 2>&1 | cut -d':' -f2 | cut -d' ' -f2 | cut -d'/' -f2) - local ee_nginx_user=$(grep ^user /etc/nginx/nginx.conf | cut -d' ' -f2 | cut -d';' -f1) - local ee_nginx_processes=$(grep worker_processes /etc/nginx/nginx.conf | cut -d' ' -f2 | cut -d';' -f1) - local ee_nginx_connections=$(grep worker_connections /etc/nginx/nginx.conf | cut -d' ' -f2 | cut -d';' -f1) - local ee_nginx_keep_alive=$(grep keepalive_timeout /etc/nginx/nginx.conf | cut -d' ' -f2 | cut -d';' -f1) - local ee_fastcgi_timeout=$(grep fastcgi_read_timeout /etc/nginx/nginx.conf | cut -d' ' -f2 | cut -d';' -f1) - local ee_clinet_max_body_size=$(grep client_max_body_size /etc/nginx/nginx.conf | cut -d' ' -f2 | cut -d';' -f1) - local ee_nginx_allowed_ip_add=$(grep ^allow /etc/nginx/common/acl.conf | cut -d' ' -f2 | cut -d';' -f1 | tr '\n' ' ') + ee_lib_package_check $EE_NGINX_PACKAGE + if [ "$EE_PACKAGE_NAME" != "" ]; then + local ee_nginx_version=$(nginx -v 2>&1 | cut -d':' -f2 | cut -d' ' -f2 | cut -d'/' -f2) + local ee_nginx_user=$(grep ^user /etc/nginx/nginx.conf | cut -d' ' -f2 | cut -d';' -f1) + local ee_nginx_processes=$(grep worker_processes /etc/nginx/nginx.conf | cut -d' ' -f2 | cut -d';' -f1) + local ee_nginx_connections=$(grep worker_connections /etc/nginx/nginx.conf | cut -d' ' -f2 | cut -d';' -f1) + local ee_nginx_keep_alive=$(grep keepalive_timeout /etc/nginx/nginx.conf | cut -d' ' -f2 | cut -d';' -f1) + local ee_fastcgi_timeout=$(grep fastcgi_read_timeout /etc/nginx/nginx.conf | cut -d' ' -f2 | cut -d';' -f1) + local ee_clinet_max_body_size=$(grep client_max_body_size /etc/nginx/nginx.conf | cut -d' ' -f2 | cut -d';' -f1) + local ee_nginx_allowed_ip_add=$(grep ^allow /etc/nginx/common/acl.conf | cut -d' ' -f2 | cut -d';' -f1 | tr '\n' ' ') - ee_lib_echo - ee_lib_echo - ee_lib_echo "NGINX ($ee_nginx_version):" - ee_lib_echo_escape "user\t\t\t\t \033[37m$ee_nginx_user" - ee_lib_echo_escape "worker_processes\t\t \033[37m$ee_nginx_processes" - ee_lib_echo_escape "worker_connections\t\t \033[37m$ee_nginx_connections" - ee_lib_echo_escape "keepalive_timeout\t\t \033[37m$ee_nginx_keep_alive" - ee_lib_echo_escape "fastcgi_read_timeout\t\t \033[37m$ee_fastcgi_timeout" - ee_lib_echo_escape "client_max_body_size\t\t \033[37m$ee_clinet_max_body_size" - ee_lib_echo_escape "allow\t\t\t\t \033[37m$ee_nginx_allowed_ip_add" + ee_lib_echo + ee_lib_echo + ee_lib_echo "NGINX ($ee_nginx_version):" + ee_lib_echo_escape "user\t\t\t\t \033[37m$ee_nginx_user" + ee_lib_echo_escape "worker_processes\t\t \033[37m$ee_nginx_processes" + ee_lib_echo_escape "worker_connections\t\t \033[37m$ee_nginx_connections" + ee_lib_echo_escape "keepalive_timeout\t\t \033[37m$ee_nginx_keep_alive" + ee_lib_echo_escape "fastcgi_read_timeout\t\t \033[37m$ee_fastcgi_timeout" + ee_lib_echo_escape "client_max_body_size\t\t \033[37m$ee_clinet_max_body_size" + ee_lib_echo_escape "allow\t\t\t\t \033[37m$ee_nginx_allowed_ip_add" + else + ee_lib_echo "NGINX not installed" + fi } diff --git a/src/lib/ee_lib_php_info.sh b/src/lib/ee_lib_php_info.sh index 03c4f3f0..eca18548 100644 --- a/src/lib/ee_lib_php_info.sh +++ b/src/lib/ee_lib_php_info.sh @@ -1,52 +1,56 @@ # PHP information function ee_lib_php_info() { - #Collect information from php.ini - local ee_php_version=$(php -v | head -n1 | cut -d' ' -f2 | cut -d'+' -f1) - local ee_php_memory=$(grep ^memory_limit /etc/php5/fpm/php.ini | awk '{print $3}') - local ee_php_expose=$(grep ^expose_php /etc/php5/fpm/php.ini | cut -d'=' -f2 | cut -d' ' -f2) - local ee_php_post_max_size=$(grep post_max_size /etc/php5/fpm/php.ini | cut -d'=' -f2 | cut -d' ' -f2) - local ee_php_upload_max_filesize=$(grep upload_max_filesize /etc/php5/fpm/php.ini | cut -d'=' -f2 | cut -d' ' -f2) - local ee_php_max_execution_time=$(grep max_execution_time /etc/php5/fpm/php.ini | cut -d'=' -f2 | cut -d' ' -f2) + ee_lib_package_check php5-fpm + if [ "$EE_PACKAGE_NAME" != "" ]; then + #Collect information from php.ini + local ee_php_version=$(php -v | head -n1 | cut -d' ' -f2 | cut -d'+' -f1) + local ee_php_memory=$(grep ^memory_limit /etc/php5/fpm/php.ini | awk '{print $3}') + local ee_php_expose=$(grep ^expose_php /etc/php5/fpm/php.ini | cut -d'=' -f2 | cut -d' ' -f2) + local ee_php_post_max_size=$(grep post_max_size /etc/php5/fpm/php.ini | cut -d'=' -f2 | cut -d' ' -f2) + local ee_php_upload_max_filesize=$(grep upload_max_filesize /etc/php5/fpm/php.ini | cut -d'=' -f2 | cut -d' ' -f2) + local ee_php_max_execution_time=$(grep max_execution_time /etc/php5/fpm/php.ini | cut -d'=' -f2 | cut -d' ' -f2) - ee_lib_echo - ee_lib_echo "PHP ($ee_php_version):" - ee_lib_echo_escape "user\t\t\t\t \033[37m$EE_PHP_USER" - ee_lib_echo_escape "expose_php\t\t\t \033[37m$ee_php_expose" - ee_lib_echo_escape "memory_limit\t\t\t \033[37m$ee_php_memory" - ee_lib_echo_escape "post_max_size\t\t\t \033[37m$ee_php_post_max_size" - ee_lib_echo_escape "upload_max_filesize\t\t \033[37m$ee_php_upload_max_filesize" - ee_lib_echo_escape "max_execution_time\t\t \033[37m$ee_php_max_execution_time" - - - #Collect information from $ee_php_pool and debug.conf - for ee_php_pool in www.conf debug.conf;do - local ee_php_ping_path=$(grep ^ping.path /etc/php5/fpm/pool.d/$ee_php_pool | cut -d'=' -f2| cut -d' ' -f2) - local ee_php_status_path=$(grep ^pm.status_path /etc/php5/fpm/pool.d/$ee_php_pool | cut -d'=' -f2| cut -d' ' -f2) - local ee_php_process_manager=$(grep "^pm =" /etc/php5/fpm/pool.d/$ee_php_pool | awk '{print $3}') - local ee_php_max_requests=$(grep ^pm.max_requests /etc/php5/fpm/pool.d/$ee_php_pool | cut -d'=' -f2| cut -d' ' -f2) - local ee_php_max_children=$(grep ^pm.max_children /etc/php5/fpm/pool.d/$ee_php_pool | cut -d'=' -f2| cut -d' ' -f2) - local ee_php_start_servers=$(grep ^pm.start_servers /etc/php5/fpm/pool.d/$ee_php_pool | cut -d'=' -f2| cut -d' ' -f2) - local ee_php_min_spare_servers=$(grep ^pm.min_spare_servers /etc/php5/fpm/pool.d/$ee_php_pool | cut -d'=' -f2| cut -d' ' -f2) - local ee_php_max_spare_servers=$(grep ^pm.max_spare_servers /etc/php5/fpm/pool.d/$ee_php_pool | cut -d'=' -f2| cut -d' ' -f2) - local ee_php_request_terminate_timeout=$(grep ^request_terminate_timeout /etc/php5/fpm/pool.d/$ee_php_pool | cut -d'=' -f2| cut -d' ' -f2) - local ee_xdebug_check=$( grep "php_admin_flag\[xdebug.profiler_enable_trigger\]" /etc/php5/fpm/pool.d/$ee_php_pool | grep on &> /dev/null && echo on || echo off) - local ee_php_listen=$(grep '^listen =' /etc/php5/fpm/pool.d/$ee_php_pool | cut -d'=' -f2| cut -d' ' -f2) - ee_lib_echo - ee_lib_echo "Information about $ee_php_pool" - ee_lib_echo_escape "ping.path\t\t\t \033[37m$ee_php_ping_path" - ee_lib_echo_escape "pm.status_path\t\t\t \033[37m$ee_php_status_path" - ee_lib_echo_escape "process_manager\t\t\t \033[37m$ee_php_process_manager" - ee_lib_echo_escape "pm.max_requests\t\t\t \033[37m$ee_php_max_requests" - ee_lib_echo_escape "pm.max_children\t\t\t \033[37m$ee_php_max_children" - ee_lib_echo_escape "pm.start_servers\t\t \033[37m$ee_php_start_servers" - ee_lib_echo_escape "pm.min_spare_servers\t\t \033[37m$ee_php_min_spare_servers" - ee_lib_echo_escape "pm.max_spare_servers\t\t \033[37m$ee_php_max_spare_servers" - ee_lib_echo_escape "request_terminate_timeout\t \033[37m$ee_php_request_terminate_timeout" - ee_lib_echo_escape "xdebug.profiler_enable_trigger\t \033[37m$ee_xdebug_check" - ee_lib_echo_escape "listen\t\t\t\t \033[37m$ee_php_listen" - done + ee_lib_echo "PHP ($ee_php_version):" + ee_lib_echo_escape "user\t\t\t\t \033[37m$EE_PHP_USER" + ee_lib_echo_escape "expose_php\t\t\t \033[37m$ee_php_expose" + ee_lib_echo_escape "memory_limit\t\t\t \033[37m$ee_php_memory" + ee_lib_echo_escape "post_max_size\t\t\t \033[37m$ee_php_post_max_size" + ee_lib_echo_escape "upload_max_filesize\t\t \033[37m$ee_php_upload_max_filesize" + ee_lib_echo_escape "max_execution_time\t\t \033[37m$ee_php_max_execution_time" + + #Collect information from $ee_php_pool and debug.conf + for ee_php_pool in www.conf debug.conf;do + local ee_php_ping_path=$(grep ^ping.path /etc/php5/fpm/pool.d/$ee_php_pool | cut -d'=' -f2| cut -d' ' -f2) + local ee_php_status_path=$(grep ^pm.status_path /etc/php5/fpm/pool.d/$ee_php_pool | cut -d'=' -f2| cut -d' ' -f2) + local ee_php_process_manager=$(grep "^pm =" /etc/php5/fpm/pool.d/$ee_php_pool | awk '{print $3}') + local ee_php_max_requests=$(grep ^pm.max_requests /etc/php5/fpm/pool.d/$ee_php_pool | cut -d'=' -f2| cut -d' ' -f2) + local ee_php_max_children=$(grep ^pm.max_children /etc/php5/fpm/pool.d/$ee_php_pool | cut -d'=' -f2| cut -d' ' -f2) + local ee_php_start_servers=$(grep ^pm.start_servers /etc/php5/fpm/pool.d/$ee_php_pool | cut -d'=' -f2| cut -d' ' -f2) + local ee_php_min_spare_servers=$(grep ^pm.min_spare_servers /etc/php5/fpm/pool.d/$ee_php_pool | cut -d'=' -f2| cut -d' ' -f2) + local ee_php_max_spare_servers=$(grep ^pm.max_spare_servers /etc/php5/fpm/pool.d/$ee_php_pool | cut -d'=' -f2| cut -d' ' -f2) + local ee_php_request_terminate_timeout=$(grep ^request_terminate_timeout /etc/php5/fpm/pool.d/$ee_php_pool | cut -d'=' -f2| cut -d' ' -f2) + local ee_xdebug_check=$( grep "php_admin_flag\[xdebug.profiler_enable_trigger\]" /etc/php5/fpm/pool.d/$ee_php_pool | grep on &> /dev/null && echo on || echo off) + local ee_php_listen=$(grep '^listen =' /etc/php5/fpm/pool.d/$ee_php_pool | cut -d'=' -f2| cut -d' ' -f2) + + ee_lib_echo + ee_lib_echo "Information about $ee_php_pool" + ee_lib_echo_escape "ping.path\t\t\t \033[37m$ee_php_ping_path" + ee_lib_echo_escape "pm.status_path\t\t\t \033[37m$ee_php_status_path" + ee_lib_echo_escape "process_manager\t\t\t \033[37m$ee_php_process_manager" + ee_lib_echo_escape "pm.max_requests\t\t\t \033[37m$ee_php_max_requests" + ee_lib_echo_escape "pm.max_children\t\t\t \033[37m$ee_php_max_children" + ee_lib_echo_escape "pm.start_servers\t\t \033[37m$ee_php_start_servers" + ee_lib_echo_escape "pm.min_spare_servers\t\t \033[37m$ee_php_min_spare_servers" + ee_lib_echo_escape "pm.max_spare_servers\t\t \033[37m$ee_php_max_spare_servers" + ee_lib_echo_escape "request_terminate_timeout\t \033[37m$ee_php_request_terminate_timeout" + ee_lib_echo_escape "xdebug.profiler_enable_trigger\t \033[37m$ee_xdebug_check" + ee_lib_echo_escape "listen\t\t\t\t \033[37m$ee_php_listen" + done + else + ee_lib_echo "PHP not installed" + fi }