Thursday, January 23, 2020

Counting lines of code in shell scripts

Sorted
 > find . -name '*.sh' | xargs wc -l | sort -nr

Not sorted
> find . -name '*.sh' | xargs wc -l

Friday, January 17, 2020

When it becomes handy to disable NFS attribute caching

https://docstore.mik.ua/orelly/networking_2ndEd/nfs/ch18_06.htm

If changes made by one client need to be reflected on other clients with finer granularity, the attribute cache lifetime can be reduced to one second using the actimeo option, which sets both the regular file and directory minimum and maximum lifetimes to the same value:

> mount -t nfs -o actimeo=1 server:/export /mnt

This has the same effect as:

> mount -t nfs -o acregmin=1,acregmax=1,acdirmin=1,acdirmax=1 \ server:/export /mnt

To disable the caching completely:

> mount -t nfs -o actimeo=0 server:/export /mnt

Thursday, January 16, 2020

Docker on CentOS 8

> sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
> dnf list docker-ce --showduplicates | sort -r
> sudo dnf install https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm
> sudo dnf install docker-ce

> systemctl enable docker
> systemctl start docker
> systemctl status docker

> cd ~
> mkdir docker-centos
> cd docker-centos

> echo "FROM centos" > Dockerfile
> docker build .
> docker run centos uname -a
> docker run centos cat "/etc/redhat-release"