Scratch pad

From SPOT CHECK IT
Revision as of 02:25, 13 April 2022 by Admin (talk | contribs)
Jump to: navigation, search

This page is to keep items I will organize on the page later or ideas.

Analyse and calculate php-fpm runner settings https://megamorf.gitlab.io/2021/03/08/analyse-and-calculate-php-fpm-runner-settings/


Get average memory of the php-fpm process

ps --no-headers -o "rss,cmd" -C php-fpm | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/NR/1024,"M") }'


Get memory of all php-fpm processes

ps -eo size,pid,user,command --sort -size | awk '{ hr=$1/1024 ; printf("%13.2f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }' | grep php-fpm


How many cores does server have.

echo Cores = $(( $(lscpu | awk '/^Socket/{ print $2 }') * $(lscpu | awk '/^Core/{ print $4 }') ))


php-fpm settings

https://thisinterestsme.com/php-fpm-settings/


Top 10 processes uisng memory

ps auxw|head -1;ps auxw|sort -rn -k4|head -10


Get 20 Highest mem users.

echo [PID]  [MEM]  [PATH] &&  ps aux | awk '{print $2, $4, $11}' | sort -k2rn | head -n 20

Get highest cpu users.

ps -eo pcpu,pid,user,args | sort -k 1 -r | head -20


Apache tuning.

https://hostadvice.com/how-to/how-to-tune-and-optimize-performance-of-apache/

Estimate the Thrashing Point

https://www.liquidweb.com/kb/apache-performance-tuning-swap-memory/


ps aux | grep 'httpd' | awk '{print $6/1024;}' | awk '{sum += $1;} END {print sum " MB total mem usage";}'

ps aux | grep 'httpd' | awk '{print $6/1024;}' | awk '{avg += ($1 - avg) / NR;} END {print avg " MB avg mem usage";}'


Useful shell script commands.

https://www.lancaster.ac.uk/staff/tipper/writing/luui/html/unix-intro012.html


https://www.redhat.com/sysadmin/one-line-linux-commands


Make multiple directories in one command.

mkdir -p -v /home/josevnz/tmp/{dir1,anotherdir,similardir}


Make backup via encrypted transfer:

tar --create --directory /home/josevnz/tmp/ --file - *| \

ssh raspberrypi "tar --directory /home/josevnz \

--verbose --list --file -"


Find 10 largest directories.

du -sk /var/log/* | sort -r -n | head -10


Colorize Grep

grep -i --color=auto


https://linuxcommandlibrary.com/basic/oneliners

Remove all files that dont match ext.

rm !(*.foo|*.bar|*.baz)

vi a remote file.

vi scp://username@host//path/to/somefile


Clear line in terminal

CTRL+u


so searching for "data scale" will find any results with data or with scale, "+data +scale" will only find results with both data and scale

and, thank you ignored.

stopword file list to add to ignore list.

If the innodb_ft_user_stopword_table option is set, the stopwords are taken from that table. Else, if the innodb_ft_server_stopword_table option is set, the stopwords are taken from that table. Otherwise, a built-in set of default stopwords is used."

Mediawiki rebuild index stopwords.

Types of Full-Text search IN NATURAL LANGUAGE MODE¶

https://mariadb.com/kb/en/full-text-index-overview/#in-boolean-mode