service update
This commit is contained in:
parent
4a925e1185
commit
c7431aba6b
|
@ -0,0 +1,117 @@
|
|||
#!/bin/bash
|
||||
#----------------------------------------------------------------------------
|
||||
# wo-bashrc - bashrc functions and alias
|
||||
#----------------------------------------------------------------------------
|
||||
# Website: https://virtubox.net
|
||||
# GitHub: https://github.com/VirtuBox/ee-acme-sh
|
||||
# Author: VirtuBox
|
||||
# License: M.I.T
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
[ ! -d $HOME/.scripts ] && {
|
||||
mkdir -p $HOME/.scripts
|
||||
}
|
||||
|
||||
|
||||
# Nginx-ee compilation
|
||||
|
||||
_NGINX_EE() {
|
||||
wget -O $HOME/.scripts/nginx-build.sh https://raw.githubusercontent.com/VirtuBox/nginx-ee/master/nginx-build.sh
|
||||
chmod +x $HOME/.scripts/nginx-build.sh
|
||||
$HOME/.scripts/nginx-build.sh --mainline
|
||||
}
|
||||
|
||||
_MAINTENANCE() {
|
||||
|
||||
# Colors
|
||||
# Colors
|
||||
CSI='\033['
|
||||
CEND="${CSI}0m"
|
||||
CRED="${CSI}1;31m"
|
||||
CGREEN="${CSI}1;32m"
|
||||
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
echo -e ' APT UPDATE '
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
sudo apt update
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
echo -e ' APT FULL-UPGRADE '
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
sudo apt full-upgrade -y
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
echo -e ' APT-GET AUTOREMOVE '
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
sudo apt-get -y --purge autoremove
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
echo -e ' APT AUTOCLEAN '
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
sudo apt-get -y autoclean
|
||||
sudo apt-get -y clean
|
||||
## clean packages in deinstall state
|
||||
DEINSTALLED=$(sudo dpkg --get-selections | grep deinstall | cut -f1)
|
||||
if [ ! -z "$DEINSTALLED" ]; then
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
echo -e ' CLEAN DEINSTALL PACKAGES '
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
sudo dpkg --get-selections | grep deinstall | cut -f1 | xargs dpkg --purge
|
||||
fi
|
||||
if [ -x /usr/bin/docker ]; then
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
echo -e ' DOCKER CLEANUP '
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
list_images=$(docker images --filter "dangling=true" -q --no-trunc)
|
||||
list_volumes=$(docker volume ls -qf dangling=true)
|
||||
if [ ! -z "$list_images" ]; then
|
||||
docker rmi $list_images
|
||||
fi
|
||||
if [ ! -z "$list_volumes" ]; then
|
||||
docker volume rm $list_volumes
|
||||
fi
|
||||
fi
|
||||
OLD_LOGS=$(sudo find /var/log/ -type f -mtime +30 -iname "*.gz" ;)
|
||||
if [ ! -z "$OLD_LOGS" ]; then
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
echo -e ' CLEANUP OLD LOGS '
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
sudo find /var/log/ -type f -mtime +30 -iname "*.gz" -exec rm '{}' \;
|
||||
fi
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
echo -e ' EE-BASHRC UPDATE '
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
update_git_mybashrc
|
||||
|
||||
}
|
||||
|
||||
while [ ${#} -gt 0 ]; do
|
||||
case "${1}" in
|
||||
"--nginx-ee")
|
||||
_NGINX_EE
|
||||
exit 1
|
||||
;;
|
||||
"--maintenance")
|
||||
_MAINTENANCE
|
||||
exit 1
|
||||
;;
|
||||
"--syslog")
|
||||
_TASK="syslog"
|
||||
;;
|
||||
"--netdata")
|
||||
_TASK="netdata"
|
||||
;;
|
||||
"--docker")
|
||||
_TASK="docker"
|
||||
;;
|
||||
"--mysqltuner")
|
||||
_TASK="mysqltuner"
|
||||
;;
|
||||
"--mysqlcheck")
|
||||
_TASK="mysqlcheck"
|
||||
;;
|
||||
"-h" | "--help" | "help")
|
||||
_help
|
||||
exit 1
|
||||
;;
|
||||
*) ;;
|
||||
esac
|
||||
shift
|
||||
done
|
4
mybashrc
4
mybashrc
|
@ -300,5 +300,5 @@ alias tinc-up=SET_TINC_UP
|
|||
alias tinc-down=SET_TINC_DOWN
|
||||
alias ffmpeg-cut-start=ffmpeg_start_time
|
||||
alias wp-fix-perms=_WP_PERMISSIONS
|
||||
alias services='service --status-all'
|
||||
alias gg="ping google.fr"
|
||||
alias allservices='service --status-all'
|
||||
alias gg="ping google.fr"
|
||||
|
|
Loading…
Reference in New Issue