Browse Source

Merge branch 'refactor' of github.com:rtCamp/easyengine into refactor

old-stable
harshadyeola 11 years ago
parent
commit
7338d2ae89
  1. 3181
      bin/easyengine
  2. 3
      src/lib/ee_lib_variables.sh
  3. 58
      src/modules/system/ee_system_status.sh
  4. 9
      src/modules/system/install/ee_mod_setup_nginx.sh
  5. 2
      src/vendor/ee_ven_install_wp_cli.sh

3181
bin/easyengine

File diff suppressed because it is too large

3
src/lib/ee_lib_variables.sh

@ -1,5 +1,8 @@
# Define global variables # Define global variables
# EasyEngine version
readonly EE_VERSION='2.0.0'
# WP-CLI version # WP-CLI version
readonly EE_WP_CLI_VERSION='0.15.1' readonly EE_WP_CLI_VERSION='0.15.1'

58
src/modules/system/ee_system_status.sh

@ -0,0 +1,58 @@
# Execute: ee system status
function ee_system_status()
{
# Detect operating system
local ee_operating_system=$(lsb_release -d | awk '{print $2,$3,$4}')
# Detect system load and processes
local ee_system_load=$(cat /proc/loadavg | awk '{print $1}')
local ee_system_processes=$(ps ax | wc -l)
# Uses of / partition and users logged in
local ee_logged_in_users=$(w -h | wc -l)
local ee_root_usage=$(df -h | grep /$ | head -1 | awk '{print $5}')
# Memory uses
local ee_memory_total=$(free | grep Mem: | awk '{print $2}')
local ee_memory_used=$(free | grep Mem: | awk '{print $3}')
local ee_memory_buffers=$(free | grep Mem: | awk '{print $6}')
local ee_memory_cache=$(free | grep Mem: | awk '{print $7}')
local ee_memory_usage=$(echo "($ee_memory_used-$ee_memory_buffers-$ee_memory_cache)*100/$ee_memory_total" | bc -l | cut -d'.' -f1)
# Swap uses
local ee_swap_total=$(free | grep Swap: | awk '{print $2}')
if [[ $ee_swap_total > 0 ]]; then
local ee_swap_used=$(free | grep Swap: | awk '{print $3}')
local ee_swap_usage=$(echo "$ee_swap_used*100/$ee_swap_total" | bc -l | cut -d'.' -f1)
else
local ee_swap_usage=$(echo "N/A")
fi
# Service status
local ee_nginx_status=$(service nginx status | grep 'nginx is running' \
&>> $EE_COMMAND_LOG && ee_lib_echo "Running" || ee_lib_echo_fail "Stopped")
local ee_php_status=$(service php5-fpm status | grep running \
&>> $EE_COMMAND_LOG && ee_lib_echo "Running" || ee_lib_echo_fail "Stopped")
local ee_mysql_status=$(mysqladmin ping \
&>> $EE_COMMAND_LOG && ee_lib_echo "Running" || ee_lib_echo_fail "Stopped")
local ee_postfix_status=$(service postfix status | grep 'postfix is running' \
&>> $EE_COMMAND_LOG && ee_lib_echo "Running" || ee_lib_echo_fail "Stopped")
echo
echo
ee_lib_echo_info " System information as of $(/bin/date)"
echo
echo -e " System load:\t$ee_system_load\t\t Processes:\t\t$ee_system_processes"
echo -e " Usage of /:\t$ee_root_usage\t\t Users logged in:\t$ee_logged_in_users"
echo -e " Memory usage:\t$ee_memory_usage%\t\t Swap usage:\t\t$ee_swap_usage"
echo
ee_lib_echo_info " Service status information"
echo
echo -e " Nginx:\t$ee_nginx_status"
echo -e " PHP5-FPM:\t$ee_php_status"
echo -e " MySQL:\t$ee_mysql_status"
echo -e " Postfix:\t$ee_postfix_status"
echo
echo
}

9
src/modules/system/install/ee_mod_setup_nginx.sh

@ -61,7 +61,12 @@ function ee_mod_setup_nginx()
fi fi
# Setup SSL # Setup SSL
# Generate SSL Key # Create SSL certificate directory
if [ !-d /var/www/22222/cert ]; then
mkdir /var/www/22222/cert
fi
# Generate SSL key
ee_lib_echo "Generating SSL private key, please wait..." ee_lib_echo "Generating SSL private key, please wait..."
openssl genrsa -out /var/www/22222/cert/22222.key 2048 &>> $EE_COMMAND_LOG \ openssl genrsa -out /var/www/22222/cert/22222.key 2048 &>> $EE_COMMAND_LOG \
|| ee_lib_error "Unable to generate SSL private key for port 22222, exit status = " $? || ee_lib_error "Unable to generate SSL private key for port 22222, exit status = " $?
@ -79,7 +84,7 @@ function ee_mod_setup_nginx()
openssl x509 -req -days 3652 -in /var/www/22222/cert/22222.csr -signkey /var/www/22222/cert/22222.key -out /var/www/22222/cert/22222.crt &>> $EE_COMMAND_LOG \ openssl x509 -req -days 3652 -in /var/www/22222/cert/22222.csr -signkey /var/www/22222/cert/22222.key -out /var/www/22222/cert/22222.crt &>> $EE_COMMAND_LOG \
|| ee_lib_error "Unable to generate SSL certificate for port 22222, exit status = " $? || ee_lib_error "Unable to generate SSL certificate for port 22222, exit status = " $?
# Whitelist IP address # White list IP address
if [ -n "$EE_IP_ADDRESS" ]; then if [ -n "$EE_IP_ADDRESS" ]; then
for ee_whitelist_ip_address in $(echo $EE_IP_ADDRESS) for ee_whitelist_ip_address in $(echo $EE_IP_ADDRESS)
do do

2
src/vendor/ee_ven_install_wp_cli.sh

@ -11,7 +11,7 @@ function ee_ven_install_wp_cli()
# Add WP-CLI command in $PATH variable # Add WP-CLI command in $PATH variable
if [ ! -L /usr/bin/wp ]; then if [ ! -L /usr/bin/wp ]; then
ln -s /usr/share/wp-cli/bin/wp /usr/bin/wp \ ln -s /usr/share/wp-cli/bin/wp /usr/bin/wp \
|| ee_lib_error "Unable to create symbolic link for WP-CLI command, exit status = " $? || ee_lib_error "Unable to create symbolic link for WP-CLI command, exit status = " $?
fi fi

Loading…
Cancel
Save