Blog et Aide mémoire informatique

jeudi 2 juillet 2020

Latest Command Line

du -sh /* 
control-r
Run task in Background
nohup command

Inotify

https://manpages.ubuntu.com/manpages/bionic/man1/inotifywait.1.html

lundi 18 mai 2020

Read file without comment

Usefull to drop all comment from php.ini file and long configuration with lot of comments. Thank you Pierre Renard !

Lire la suite

mercredi 5 février 2020

Some usefull tool to install on Unix

  • HTTPIE
  • htop
  • ncdu
  • glances
  • httpstat

jeudi 11 juillet 2019

Elastic Beanstalk : Some fail

List of tips and tricks hardly discovered setting up a Elastic Beanstalk

Lire la suite

mardi 2 juillet 2019

EFS Performance Test

Related EFS test performance

Lire la suite

Tuning Linux server

Some configuration to tune

Lire la suite

vendredi 28 juin 2019

AWS Athena : Partition

Quick Tips AWS athena

Lire la suite

jeudi 20 juin 2019

Increase Ulimit to solve heavy http traffic

Check some values

See ulimit , also per user
sudo su {user} 
#all limit
ulimit -a

#Ulimite -hard: 
ulimit -Hn

#Ulimite -Soft: 
ulimit -Sn
List open file per process or per user
lsof -p {pid}| wc -l
lsof -u {youruser} |wc -l
List Network connection per state
netstat -an|awk '/tcp/ {print $6}'|sort|uniq -c
List php-fpm process running
ps aux | grep php-fpm | wc -l

Apply Ulimit change

sudo vi /etc/security/limits.conf

*       soft    nofile  65000  //for all user
user  soft     nofile  5000 // for a specific user

Too many connection in time-wait

This should not be too problematic according source below. One solution will be to open the service on several port and balance connexion to several port.

Some source

https://www.netadmintools.com/art295.html
https://medium.com/@muhammadtriwibowo/set-permanently-ulimit-n-open-files-in-ubuntu-4d61064429a
https://app.getpocket.com/read/2383097919

mercredi 10 avril 2019

ssh-agent

In order to use the ssh-key in Bastion and leap-frog to protected server

Make sure the ssh agent is running
eval `ssh-agent -s`
then add your key
ssh-add -k your-key.pem
ssh-add -L
Then use the ssh agent
ssh -A ec2-user@your-ip
https://www.daveeddy.com/2017/10/18/persistent-sshagent-on-bash-on-ubuntu-on-windows/ https://medium.com/@crishantha/handing-bastion-hosts-on-aws-via-ssh-agent-forwarding-f1d2d4e8622a

vendredi 1 février 2019

Monitor progress on copy DD command

When you use dd copy,
dd if=/dev/xvdf of=/dev/xvdg bs=4096 
just monitor progress this way.
watch -n5 'sudo kill -USR1 $(pgrep ^dd)'
Some more fancy progress tools : https://www.cyberciti.biz/faq/linux-unix-dd-command-show-progress-while-coping/

vendredi 18 janvier 2019

Root User Name AMI on AWS

et the default user name for the AMI that you used to launch your instance
For Amazon Linux 2 or the Amazon Linux AMI, the user name is ec2-user.

For a Centos AMI, the user name is centos.

For a Debian AMI, the user name is admin or root.

For a Fedora AMI, the user name is ec2-user or fedora.
For a RHEL AMI, the user name is ec2-user or root. For a SUSE AMI, the user name is ec2-user or root. For an Ubuntu AMI, the user name is ubuntu. Otherwise, if ec2-user and root don't work, check with the AMI provider.

mercredi 26 décembre 2018

Docker PostgreSQL

Start the Docker
docker run --rm   --name pg-docker 
-e POSTGRES_PASSWORD=docker 
-d -p 5432:5432 
-v $HOME/docker/volumes/postgres:/var/lib/postgresql/data  postgres
List Database
SELECT datname FROM pg_database
WHERE datistemplate = false;
List Schema
SELECT schema_name FROM information_schema.schemata;
List Tables
SELECT * FROM pg_catalog.pg_tables
List tables schema
SELECT column_name, data_type, character_maximum_length
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_name = '';
Initial Source : Git Link source

jeudi 17 mai 2018

Convert SVN to Git

- Get repositotry Commiters
svn log -q https://yourRepoUrl | awk -F '|' '/^r/ {sub("^ ", "", $2); sub(" $", "", $2); print $2" = "$2" <"$2">"}' | sort -u > authors-transform.txt
- Checkout / Convert To Git
git svn --authors-file=authors-transform.txt clone https://yourRepoUrl   --trunk=trunk --branches=branches --tags=tags
- List all branch
git branch -a
- Checkout the Branch Localy
git checkout remotes/origin/v2
git checkout master
-Create Local Branch From Remote Branch
git branch v2 remotes/origin/v2
-Push Publish on Github
git remote add origin https://user@gitRepos/theGitProject.git
git push -u origin master
git push --all
git push --tags

mardi 19 décembre 2017

Nice link with time function

https://wiki.archlinux.org/index.php/time

mercredi 13 septembre 2017

Remove from boot Linux

update-rc.d -f mongodb remove
chkconfing