Browse Source

update

master
VirtuBox 8 months ago
parent
commit
2cd9c4fd7b
3 changed files with 78 additions and 24 deletions
  1. +26
    -0
      env/htoprc
  2. +43
    -22
      mybashrc
  3. +9
    -2
      setup.sh

+ 26
- 0
env/htoprc View File

@@ -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

+ 43
- 22
mybashrc View File

@@ -31,7 +31,7 @@ update_git_mybashrc() {
}

EE_MYSQL_OPTIMIZATION() {
if [ -f $HOME/.my.cnf ]; then
/usr/bin/mysqlcheck -Aos --auto-repair
elif [ -f /etc/psa/.psa.shadow ]; then
@@ -60,37 +60,37 @@ 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"
@@ -101,19 +101,26 @@ ffmpeg_start_time() {
fi
}

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}"
@@ -166,7 +173,7 @@ MAINTENANCE_APT() {
else
echo "you need to be root or sudoers to launch the maintenance"
fi
}

EE_NGINX_COMPILE() {
@@ -179,13 +186,13 @@ 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
}
}

_PYTHON_VIRTUALENV() {
@@ -202,17 +209,17 @@ CHEAT_CHECK() {
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
@@ -228,7 +235,16 @@ MAGENTO_UPGRADE() {
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
@@ -258,7 +274,7 @@ if [ -x /usr/bin/dircolors ]; then
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'
@@ -270,6 +286,10 @@ 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
@@ -280,3 +300,4 @@ 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 wp-fix-perms=_WP_PERMISSIONS

+ 9
- 2
setup.sh View File

@@ -2,12 +2,12 @@

# 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
@@ -33,6 +33,13 @@ 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

Loading…
Cancel
Save