2021年12月28日星期二

Linux error output and command tee

echo test | grep test 2>&1

standard error output redirect to standard output to file.

ex.  find result show in screen and export to cmdlist file.

find /bin /usr/bin -type f | tee -a cmdlist 

$ tee --help

Usage: tee [OPTION]... [FILE]...

Copy standard input to each FILE, and also to standard output.


  -a, --append              append to the given FILEs, do not overwrite

  -i, --ignore-interrupts   ignore interrupt signals

      --help     display this help and exit

      --version  output version information and exit


If a FILE is -, copy again to standard output.


GNU coreutils online help: <http://www.gnu.org/software/coreutils/>

For complete documentation, run: info coreutils 'tee invocation'

2021年12月17日星期五

Oracle Charset Select for Check

 SELECT VALUE  
 FROM NLS_DATABASE_PARAMETERS 
 WHERE PARAMETER='NLS_CHARACTERSET'

2021年12月4日星期六

nginx reverse proxy

docker run --name nginx -p 80:80 -v /home/$(whoami)/data/nginx/html:/usr/share/nginx/html:ro -v /home/$(whoami)/data/nginx/conf:/etc/nginx nginx 

ref:https://github.com/dunwu/nginx-tutorial

http {

upstream product_server{
server www.helloworld.com:8081;
}

upstream admin_server{
server www.helloworld.com:8082;
}

upstream finance_server{
server www.helloworld.com:8083;
}

server {
#此处省略一些基本配置
#默认指向product的server
  
  // for hide port 
  server_name_in_redirect off;
  proxy_set_header Host $host:$server_port;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

location / {
proxy_pass http://product_server;
}

location /product/{
proxy_pass http://product_server;
}

location /admin/ {
proxy_pass http://admin_server;
}

location /finance/ {
proxy_pass http://finance_server;
}


# load balance 
upstream backend { ip_hash; server 192.168.1.106:80; server 192.168.1.107:80; }

2021年12月3日星期五

linux mint フォルダ名を英字化

OSインストール直後の実行コマンド: 

$ LANG=C xdg-user-dirs-gtk-update

参照: https://reiwa-period.com/computer/linux-mint/englishname/

2021年12月2日星期四

ppk2pem, pem2ppk shell


#.pem file to .ppk file
puttygen $1 -o $2 -O private


#.ppk file to .pem file
puttygen $1 -O private-openssh -o $2