#!/usr/bin/env bash # Cleanup server # Min. Requirement : GNU/Linux Ubuntu 14.04 # Last Build : 01/08/2019 # Author : ESLabs.ID (eslabs.id@gmail.com) # Since Version : 1.0.0 # Include helper functions. if [ "$(type -t run)" != "function" ]; then BASEDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd ) # shellchechk source=scripts/helper.sh # shellcheck disable=SC1090 . "${BASEDIR}/helper.sh" fi # Define scripts directory. if grep -q "scripts" <<< "${BASEDIR}"; then SCRIPTS_DIR="${BASEDIR}" else SCRIPTS_DIR="${BASEDIR}/scripts" fi # Make sure only root can run this installer script. requires_root echo "Cleaning up server..." # Fix broken install, first? run dpkg --configure -a run apt install -qq --fix-broken # Remove Apache2 service if exists. if [[ -n $(command -v apache2) || -n $(command -v httpd) ]]; then warning -e "\nIt seems that Apache/httpd server installed on this server." echo "Any other HTTP web server will be removed, otherwise they will conflict." echo "" #read -rt 120 -p "Press [Enter] to continue..." /etc/lemper/lemper.conf" else echo "Found default lemper account, but not removed." fi fi # Autoremove unused packages. echo -e "\nCleaning up unused packages..." run apt autoremove -qq -y if [[ -z $(command -v apache2) && -z $(command -v nginx) && -z $(command -v mysql) ]]; then status -e "\nYour server cleaned up." else warning -e "\nYour server cleaned up, but some installation not removed." fi