1
0
Fork 0
This commit is contained in:
VirtuBox 2019-01-09 01:02:50 +01:00
parent 79bb9616db
commit 6a1b293a84
1 changed files with 39 additions and 31 deletions

View File

@ -1,15 +1,15 @@
# FUNCTIONS
transfer_vtbox_net() {
{ curl --progress-bar --upload-file $1 https://transfer.vtbox.net/$(basename $1) && echo ""; } | tee -a $HOME/.transfer.log && echo ""
{ curl --progress-bar --upload-file "$1" https://transfer.vtbox.net/$(basename $1) && echo ""; } | tee -a $HOME/.transfer.log && echo ""
}
compress_pigz() {
tar -I pigz -cvf $1.tar.gz $1
tar -I pigz -cvf $1.tar.gz "$1"
}
decompress_pigz() {
tar -I pigz -xvf $1
tar -I pigz -xvf "$1"
}
update_git_mybashrc() {
@ -24,48 +24,47 @@ EE_MYSQL_OPTIMIZATION() {
}
encrypt_gpg() {
gpg -c $1
gpg -c "$1"
}
decrypt_gpg() {
gpg --output ${1%.gpg} -d $1
gpg --output "${1%.gpg}" -d "$1"
}
LIST_BY_SIZE() {
du -sh * | sort -h
du -sh * | sort -h
}
EE_DOCKER_SETUP() {
if [ ! -d $HOME/.ee ]; then
mkdir $HOME/.ee
fi
curl -fsSL get.docker.com -o $HOME/.ee/get-docker.sh
chmod +x $HOME/.ee/get-docker.sh
$HOME/.ee/get-docker.sh
if [ ! -d $HOME/.ee ]; then
mkdir $HOME/.ee
fi
curl -fsSL get.docker.com -o $HOME/.ee/get-docker.sh
chmod +x $HOME/.ee/get-docker.sh
$HOME/.ee/get-docker.sh
}
SET_TINC_UP() {
sudo tincd -n $1
sudo tincd -n "$1"
}
SET_TINC_DOWN() {
sudo tincd -n $1 -k
sudo tincd -n "$1" -k
}
DD_BENCHMARK_DISK() {
dd if=/dev/zero bs=1024 count=1000000 of=file_1GB
dd if=file_1GB of=/dev/null bs=1024
rm file_1GB
dd if=/dev/zero bs=1024 count=1000000 of=file_1GB
dd if=file_1GB of=/dev/null bs=1024
rm file_1GB
}
MAINTENANCE_APT() {
# Colors
@ -107,19 +106,19 @@ MAINTENANCE_APT() {
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
docker rmi "$list_images"
fi
if [ ! -z "$list_volumes" ]; then
docker volume rm $list_volumes
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
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}"
@ -133,24 +132,33 @@ EE_NGINX_COMPILE() {
fi
wget -qO $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 $@
$HOME/.scripts/nginx-build.sh "$@"
}
EE_SHOW_LOG() {
tail -n 500 $1 | ccze -A
tail -n 500 "$1" | ccze -A
}
CHEAT_CHECK() {
if [ ! -x /usr/local/bin/cht.sh ]; then
curl https://cht.sh/:cht.sh > /usr/bin/cht.sh || wget -O /usr/bin/cht.sh https://cht.sh/:cht.sh
chmod +x /usr/local/bin/cht.sh
fi
/usr/local/bin/cht.sh
}
EE_SHOW_FPM() {
top -bn1 | grep php-fpm | wc -l
top -bn1 | grep php-fpm | wc -l
}
alias transfer=transfer_vtbox_net
alias cheat='cht.sh'
alias cheat=CHEAT_CHECK
alias wp='wp --allow-root'
alias gpigz=compress_pigz