merge
This commit is contained in:
commit
87e1abc5e0
12
README.md
12
README.md
|
@ -1,11 +1,13 @@
|
|||
# bashrc
|
||||
|
||||
```bash
|
||||
bash <(curl https://git.virtubox.net/virtubox/bashrc/raw/branch/master/authorized.sh || wget -O - https://git.virtubox.net/virtubox/bashrc/raw/branch/master/authorized.sh)
|
||||
```
|
||||
|
||||
## mybashrc install
|
||||
|
||||
```bash
|
||||
bash <(curl https://git.virtubox.net/virtubox/bashrc/raw/branch/master/netdata.sh || wget -O - https://git.virtubox.net/virtubox/bashrc/raw/branch/master/netdata.sh)
|
||||
bash <(curl -sL virtubox.net/mybashrc || wget -O - virtubox.net/mybashrc)
|
||||
```
|
||||
|
||||
## netdata install
|
||||
|
||||
```bash
|
||||
bash <(curl -sL https://git.virtubox.net/virtubox/bashrc/raw/branch/master/netdata.sh || wget -O - https://git.virtubox.net/virtubox/bashrc/raw/branch/master/netdata.sh)
|
||||
```
|
|
@ -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
|
|
@ -0,0 +1,26 @@
|
|||
# Beware! This file is rewritten by htop when settings are changed in the interface.
|
||||
# The parser is also very primitive, and not human-friendly.
|
||||
fields=0 48 17 18 38 39 40 2 46 47 49 1
|
||||
sort_key=46
|
||||
sort_direction=1
|
||||
hide_threads=0
|
||||
hide_kernel_threads=1
|
||||
hide_userland_threads=1
|
||||
shadow_other_users=0
|
||||
show_thread_names=0
|
||||
show_program_path=1
|
||||
highlight_base_name=0
|
||||
highlight_megabytes=1
|
||||
highlight_threads=1
|
||||
tree_view=0
|
||||
header_margin=1
|
||||
detailed_cpu_time=0
|
||||
cpu_count_from_zero=0
|
||||
update_process_names=0
|
||||
account_guest_in_cpu_meter=0
|
||||
color_scheme=6
|
||||
delay=15
|
||||
left_meters=AllCPUs Memory Swap Blank
|
||||
left_meter_modes=1 1 1 2
|
||||
right_meters=Clock Tasks LoadAverage Uptime Hostname
|
||||
right_meter_modes=2 2 2 2 2
|
244
mybashrc
244
mybashrc
|
@ -8,7 +8,7 @@ if [ "$(id -u)" != "0" ]; then
|
|||
NEED_SUDO="/usr/bin/sudo"
|
||||
else
|
||||
NEED_SUDO=""
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
|
@ -26,16 +26,15 @@ decompress_pigz() {
|
|||
}
|
||||
|
||||
update_git_mybashrc() {
|
||||
git -C $HOME/.mybashrc pull
|
||||
source $HOME/.bashrc
|
||||
git -C $HOME/.mybashrc pull -q
|
||||
}
|
||||
|
||||
EE_MYSQL_OPTIMIZATION() {
|
||||
|
||||
|
||||
if [ -f $HOME/.my.cnf ]; then
|
||||
/usr/bin/mysqlcheck -Aos --auto-repair
|
||||
elif [ -f /etc/psa/.psa.shadow ]; then
|
||||
MYSQL_PWD="$(cat /etc/psa/.psa.shadow)" /usr/bin/mysqlcheck -Aos -uadmin --auto-repair
|
||||
elif [ -f /etc/psa/.psa.shadow ]; then
|
||||
MYSQL_PWD="$(cat /etc/psa/.psa.shadow)" /usr/bin/mysqlcheck -Aos -uadmin --auto-repair
|
||||
else
|
||||
echo "$HOME/.my.cnf or /etc/psa/.psa.shadow doesn't exist"
|
||||
fi
|
||||
|
@ -60,45 +59,45 @@ EE_DOCKER_SETUP() {
|
|||
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"
|
||||
|
||||
|
||||
}
|
||||
|
||||
SET_TINC_DOWN() {
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
}
|
||||
|
||||
ffmpeg_start_time() {
|
||||
|
||||
if [ "${#}" = "0" ]; then
|
||||
echo "ffmpeg-cut-start <start-time> <input> <duration(optional)>"
|
||||
echo ""
|
||||
echo "example : ffmpeg-cut-start 00:34:24.85 file.mp4 300"
|
||||
else
|
||||
|
||||
FFMPEG_ARGS="-ss "$2" -i "$1""
|
||||
if [ "$3" ]; then
|
||||
FFMPEG_ARGS="$FFMPEG_ARGS -time $3 -c copy -movflags +faststart ${1%.mp4}-output.mp4"
|
||||
else
|
||||
FFMPEG_ARGS="$FFMPEG_ARGS -c copy -movflags +faststart ${1%.mp4}-output.mp4"
|
||||
fi
|
||||
/usr/bin/ffmpeg "$FFMPEG_ARGS"
|
||||
fi
|
||||
|
||||
if [ "${#}" = "0" ]; then
|
||||
echo "ffmpeg-cut-start <start-time> <input> <duration(optional)>"
|
||||
echo ""
|
||||
echo "example : ffmpeg-cut-start 00:34:24.85 file.mp4 300"
|
||||
else
|
||||
|
||||
FFMPEG_ARGS="-ss "$2" -i "$1""
|
||||
if [ "$3" ]; then
|
||||
FFMPEG_ARGS="$FFMPEG_ARGS -time $3 -c copy -movflags +faststart ${1%.mp4}-output.mp4"
|
||||
else
|
||||
FFMPEG_ARGS="$FFMPEG_ARGS -c copy -movflags +faststart ${1%.mp4}-output.mp4"
|
||||
fi
|
||||
/usr/bin/ffmpeg "$FFMPEG_ARGS"
|
||||
fi
|
||||
}
|
||||
|
||||
RANDOM_GIT_COMMIT() {
|
||||
|
@ -117,72 +116,82 @@ git add .
|
|||
git commit -am "$1"
|
||||
}
|
||||
|
||||
find_duplicates() {
|
||||
if [ -z "$(command -v rdfind)" ]; then
|
||||
apt-get install rdfind -y
|
||||
else
|
||||
rdfind -dryrun true -ignoreempty false "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
MAINTENANCE_APT() {
|
||||
|
||||
|
||||
# Colors
|
||||
# Colors
|
||||
CSI='\033['
|
||||
CEND="${CSI}0m"
|
||||
CRED="${CSI}1;31m"
|
||||
CGREEN="${CSI}1;32m"
|
||||
|
||||
|
||||
if [ "$(id -u)" = "0" ] || [ -n "$IS_SUDOERS" ]; then
|
||||
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
echo -e ' APT UPDATE '
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
$NEED_SUDO apt-get update
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
echo -e ' APT FULL-UPGRADE '
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
$NEED_SUDO apt-get dist-upgrade -y
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
echo -e ' APT-GET AUTOREMOVE '
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
$NEED_SUDO apt-get -y --purge autoremove
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
echo -e ' APT AUTOCLEAN '
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
$NEED_SUDO apt-get -y autoclean
|
||||
$NEED_SUDO apt-get -y clean
|
||||
## clean packages in deinstall state
|
||||
DEINSTALLED=$($NEED_SUDO dpkg --get-selections | grep deinstall | cut -f1)
|
||||
if [ -n "$DEINSTALLED" ]; then
|
||||
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
echo -e ' CLEAN DEINSTALL PACKAGES '
|
||||
echo -e ' APT UPDATE '
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
$NEED_SUDO dpkg --get-selections | grep deinstall | cut -f1 | xargs dpkg --purge
|
||||
fi
|
||||
if [ -x /usr/bin/docker ]; then
|
||||
$NEED_SUDO apt-get update
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
echo -e ' DOCKER CLEANUP '
|
||||
echo -e ' APT FULL-UPGRADE '
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
list_images=$(docker images --filter "dangling=true" -q --no-trunc)
|
||||
list_volumes=$(docker volume ls -qf dangling=true)
|
||||
if [ -n "$list_images" ]; then
|
||||
docker rmi "$list_images"
|
||||
DEBIAN_FRONTEND=noninteractive $NEED_SUDO apt-get -o Dpkg::Options::="--force-confmiss" -o Dpkg::Options::="--force-confold" -y dist-upgrade
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
echo -e ' APT-GET AUTOREMOVE '
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
$NEED_SUDO apt-get -y --purge autoremove
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
echo -e ' APT AUTOCLEAN '
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
$NEED_SUDO apt-get -y autoclean
|
||||
$NEED_SUDO apt-get -y clean
|
||||
## clean packages in deinstall state
|
||||
DEINSTALLED=$($NEED_SUDO dpkg --get-selections | grep deinstall | cut -f1)
|
||||
if [ -n "$DEINSTALLED" ]; then
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
echo -e ' CLEAN DEINSTALLED PACKAGES '
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
$NEED_SUDO dpkg --get-selections | grep deinstall | cut -f1 | xargs dpkg --purge
|
||||
fi
|
||||
if [ -n "$list_volumes" ]; then
|
||||
docker volume rm "$list_volumes"
|
||||
if [ -x /usr/bin/docker ]; then
|
||||
list_images=$(docker images --filter "dangling=true" -q --no-trunc)
|
||||
list_volumes=$(docker volume ls -qf dangling=true)
|
||||
if [ -n "$list_images" ]; then
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
echo -e ' DOCKER IMAGES CLEANUP '
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
docker rmi "$list_images"
|
||||
fi
|
||||
if [ -n "$list_volumes" ]; then
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
echo -e ' DOCKER VOLUMES CLEANUP '
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
docker volume rm "$list_volumes"
|
||||
fi
|
||||
fi
|
||||
OLD_LOGS=$($NEED_SUDO find /var/log/ -type f -mtime +30 -iname "*.gz")
|
||||
if [ -n "$OLD_LOGS" ]; then
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
echo -e ' CLEANUP OLD LOGS '
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
$NEED_SUDO find /var/log/ -type f -mtime +30 -iname "*.gz" -exec rm '{}' \;
|
||||
fi
|
||||
fi
|
||||
OLD_LOGS=$($NEED_SUDO find /var/log/ -type f -mtime +30 -iname "*.gz")
|
||||
if [ -n "$OLD_LOGS" ]; then
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
echo -e ' CLEANUP OLD LOGS '
|
||||
echo -e ' EE-BASHRC UPDATE '
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
$NEED_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
|
||||
update_git_mybashrc
|
||||
else
|
||||
echo "you need to be root or sudoers to launch the maintenance"
|
||||
fi
|
||||
|
||||
echo "you need to be root or sudoers to launch the maintenance"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
EE_NGINX_COMPILE() {
|
||||
|
@ -195,35 +204,69 @@ EE_NGINX_COMPILE() {
|
|||
}
|
||||
|
||||
EE_SHOW_LOG() {
|
||||
|
||||
{ [ -x /usr/bin/ccze ] && {
|
||||
tail -n 500 "$1" | ccze -A
|
||||
} } || { apt install ccze -y; tail -n 500 "$1" | ccze -A
|
||||
|
||||
{ [ -x /usr/bin/ccze ] && {
|
||||
tail -n 500 "$1" | ccze -A
|
||||
} } || { apt install ccze -y; tail -n 500 "$1" | ccze -A
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
_PYTHON_VIRTUALENV() {
|
||||
virtualenv "$1"
|
||||
source "$1/bin/activate"
|
||||
}
|
||||
|
||||
CHEAT_CHECK() {
|
||||
{
|
||||
[ -x /usr/local/bin/cht.sh ] && { /usr/local/bin/cht.sh "$@"; }
|
||||
[ -x /usr/bin/cht.sh ] && { /usr/bin/cht.sh "$@"; }
|
||||
} || {
|
||||
} || {
|
||||
curl -s 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
|
||||
/usr/local/bin/cht.sh "$@"
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
EE_SHOW_FPM() {
|
||||
|
||||
|
||||
top -bn1 | grep -c "php-fpm"
|
||||
|
||||
}
|
||||
|
||||
MAGENTO_UPGRADE() {
|
||||
|
||||
if [ -x bin/magento ]; then
|
||||
bin/magento maintenance:enable
|
||||
bin/magento cache:flush
|
||||
bin/magento setup:upgrade
|
||||
rm -Rf "./generated/metadata/*" "./generated/code/*" "./var/cache/*" "./var/page_cache/*"
|
||||
bin/magento setup:di:compile
|
||||
/usr/bin/composer dump-autoload -o --apcu
|
||||
rm -Rf "./pub/static/frontend/*" "./pub/static/adminhtml/*" "./var/view_preprocessed/*" "./pub/static/_cache/*" "./pub/static/_requirejs/*"
|
||||
bin/magento setup:static-content:deploy fr_FR
|
||||
bin/magento setup:static-content:deploy en_US --theme="Magento/backend"
|
||||
bin/magento cache:enable
|
||||
bin/magento maintenance:disable
|
||||
else
|
||||
echo "you are not in a magento root folder"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_WP_PERMISSIONS() {
|
||||
if [ -f ./wp-config.php ] || [ -f ../wp-config.php ]; then
|
||||
find . -type d -exec chmod 750 {} \;
|
||||
find . -type f -exec chmod 640 {} \;
|
||||
else
|
||||
echo "not a wordpress directory"
|
||||
fi
|
||||
}
|
||||
|
||||
alias transfer=transfer_vtbox_net
|
||||
|
||||
alias magento-upgrade=MAGENTO_UPGRADE
|
||||
alias cheat=CHEAT_CHECK
|
||||
#alias wp='/usr/bin/wp --allow-root'
|
||||
|
||||
|
@ -241,18 +284,17 @@ alias compile-nginx-ee=EE_NGINX_COMPILE
|
|||
alias ee-mysql-optimize=EE_MYSQL_OPTIMIZATION
|
||||
alias showlog=EE_SHOW_LOG
|
||||
alias dd-benchmark=DD_BENCHMARK_DISK
|
||||
alias vb-virtualenv=_PYTHON_VIRTUALENV
|
||||
|
||||
# enable color support of ls and also add handy aliases
|
||||
if [ -x /usr/bin/dircolors ]; then
|
||||
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
||||
alias ls='ls --color=auto'
|
||||
#alias dir='dir --color=auto'
|
||||
#alias vdir='vdir --color=auto'
|
||||
alias ls='ls --color=auto'
|
||||
alias dir='dir --color=auto'
|
||||
alias vdir='vdir --color=auto'
|
||||
|
||||
alias grep='grep --color=auto'
|
||||
alias fgrep='fgrep --color=auto'
|
||||
alias egrep='egrep --color=auto'
|
||||
|
||||
alias grep='grep --color=auto'
|
||||
alias fgrep='fgrep --color=auto'
|
||||
alias egrep='egrep --color=auto'
|
||||
fi
|
||||
|
||||
# some more ls aliases
|
||||
alias ll='ls -alhF'
|
||||
|
@ -260,15 +302,23 @@ alias la='ls -A'
|
|||
alias l='ls -CF'
|
||||
alias lh="stat -c '%A %a %n' ./*"
|
||||
alias ld='du -sh ./* | sort -h'
|
||||
alias ..="cd .."
|
||||
alias ...="cd ../.."
|
||||
alias ....="cd ../../.."
|
||||
alias .....="cd ../../../.."
|
||||
alias maintenance=MAINTENANCE_APT
|
||||
alias ee-maintenance=MAINTENANCE_APT
|
||||
alias ee-encrypt=encrypt_gpg
|
||||
alias ee-decrypt=decrypt_gpg
|
||||
alias gpg-crypt=encrypt_gpg
|
||||
alias gpg-decrypt=decrypt_gpg
|
||||
alias show-fpm-process=EE_SHOW_FPM
|
||||
alias ee-docker-setup=EE_DOCKER_SETUP
|
||||
alias docker-setup=EE_DOCKER_SETUP
|
||||
alias ee-ls=LIST_BY_SIZE
|
||||
alias tinc-up=SET_TINC_UP
|
||||
alias tinc-down=SET_TINC_DOWN
|
||||
alias ffmpeg-cut-start=ffmpeg_start_time
|
||||
alias commit=GIT_COMMIT
|
||||
alias random-commit=RANDOM_GIT_COMMIT
|
||||
alias wp-fix-perms=_WP_PERMISSIONS
|
||||
alias aptremove='apt-get autoremove -y --purge'
|
||||
alias allservices='service --status-all'
|
||||
alias gg="ping google.fr"
|
||||
alias wo-virtualenv=_PYTHON_VIRTUALENV
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
wget -O kickstart.sh https://my-netdata.io/kickstart.sh
|
||||
chmod +x kickstart.sh
|
||||
echo "Installing Netdata"
|
||||
./kickstart.sh all --dont-wait >>/tmp/ubuntu-nginx-web-server.log 2>&1
|
||||
./kickstart.sh all --dont-wait --no-updates >>/tmp/ubuntu-nginx-web-server.log 2>&1
|
||||
echo "Installation finished"
|
||||
rm kickstart.sh
|
||||
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
#!/bin/bash
|
||||
|
||||
# if run as root
|
||||
[ "$(id -u)" = "0" ] && {
|
||||
|
||||
# check if git & curl are installed
|
||||
[ -z "$(command -v git)" ] && { apt-get update && apt-get -y install git >>/dev/null 2>&1; }
|
||||
[ -z "$(command -v curl)" ] && { apt-get update && apt-get -y install curl >>/dev/null 2>&1; }
|
||||
[ ! -d "$HOME/.ssh" ] && { mkdir "$HOME/.ssh"; }
|
||||
|
||||
# install cht.sh if not already installed
|
||||
[ ! -x "$(command -v cht.sh)" ] && {
|
||||
curl -sL https://cht.sh/:cht.sh > /usr/bin/cht.sh || wget -O /usr/bin/cht.sh https://cht.sh/:cht.sh
|
||||
chmod +x /usr/bin/cht.sh
|
||||
}
|
||||
# check for my ssh keys comment
|
||||
[ -f $HOME/.ssh/authorized_keys ] && {
|
||||
check_ecc=$(grep "virtubox.net_ecc" $HOME/.ssh/authorized_keys*)
|
||||
check_rsa=$(grep "virtubox.net_rsa" $HOME/.ssh/authorized_keys*)
|
||||
}
|
||||
[ -z "$check_ecc" ] && {
|
||||
echo -e '\n# thomas@virtubox.net\nssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJez+vH3c5kWUqjZ9mjzzW9MTQJmzpgRC8g8vi3ToC9j thomas@virtubox.net_ecc' >>$HOME/.ssh/authorized_keys
|
||||
}
|
||||
[ -z "$check_rsa" ] && {
|
||||
echo -e 'ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAgEA8S2kxEkO5KQpWTPA4/mrotGMuIqy4KUinpWEJURbgqvGgesCXmqwDzLqJuq1hPnJVclMS137L5+l53lLmJmfqgV+Vj9YQ+pviWOwP45n/GqMPagGx/Cvzx0HVm1RMRTprDpPjHoXMze0py8mWrXmyYdi4j/v+xGhV8NOsxrZD02zgdQwpu9HqFh7Z2Q4/IiPRknP5CkwcH9iD9sHVRYggBcNOhlF5ysbPza9xsYy49niLCWpW8fH4asdhlxZ/MIAymOWbmkmXewLFWC4nm9gE0e8j6hYCybBDI+v9BdUzSNB6zx4ZvbF5em3iuX/SowQurUbRJl3j2ZyFQ+CU3iZRtGt3P7mWoZCAPTGevrtgJa2sckges1sKZDn1p+CXqa+KKzHxmKWWM346qHms+6K9V92GDgbxGs8dzwJRKfGfwCulFMmhFxRtvB0tX1LQwCny4wa6aODSMd9whyfc9Pcr5aFOiJCKrp6zCsupS14O5/BIog9alEbFrBaq3nDn6S7xg4KBOxf9R9BPwyzZhHXheuP9AK+8Pdnep2WFwVupaGwwnz5ePMRZhImidO86I5lSp9JQ7RBDqBBNoiKIfWJA0xrdPQAlYy9Ppyyn/dxQiTBFgGYzHoTPBCopN+yPhh+59YJA5JlkxZhDhBuLU9Bi+o4oVdASHNaeBzdCr/o95U= thomas@virtubox.net_rsa\n' >>$HOME/.ssh/authorized_keys;
|
||||
}
|
||||
}
|
||||
|
||||
# clone mybashrc or update it
|
||||
if [ ! -d $HOME/.mybashrc ]; then
|
||||
git clone https://git.virtubox.net/virtubox/bashrc.git $HOME/.mybashrc
|
||||
else
|
||||
git -C $HOME/.mybashrc pull origin master
|
||||
fi
|
||||
|
||||
if [ -f $HOME/.config/htop/htoprc ]; then
|
||||
cp $HOME/.mybashrc/env/htoprc $HOME/.config/htop/htoprc -f
|
||||
else
|
||||
mkdir -p $HOME/.config/htop
|
||||
cp $HOME/.mybashrc/env/htoprc $HOME/.config/htop/htoprc -f
|
||||
fi
|
||||
|
||||
if [ -f $HOME/.bashrc ]; then
|
||||
check_mybashrc=$(grep "mybashrc" $HOME/.bashrc)
|
||||
if [ -z "$check_mybashrc" ]; then
|
||||
echo ". $HOME/.mybashrc/mybashrc" >> $HOME/.bashrc
|
||||
fi
|
||||
else
|
||||
[ ! -f $HOME/.profile ] && {
|
||||
wget -O $HOME/.profile https://git.virtubox.net/virtubox/ubuntu-nginx-web-server/raw/branch/master/var/www/.profile
|
||||
}
|
||||
wget -O $HOME/.bashrc https://git.virtubox.net/virtubox/ubuntu-nginx-web-server/raw/branch/master/var/www/.bashrc
|
||||
echo ". $HOME/.mybashrc/mybashrc" >> $HOME/.bashrc
|
||||
fi
|
Loading…
Reference in New Issue