보관함

프로그램을 데몬으로 돌리기

nohub python main.py &

보통은 터미널에서 python main.py를 실행시키면 터미널을 닫으면서 프로그램이 끝나지만 nohub을 사용하고 백그라운드로 돌아가라고 하는 & 를 붙이면 터미널을 종료시켜도 주구장창 돈다.

다만 다음에 다시 접속해서 프로세스를 종료시키려면 ps -ef 명령으로 찾아서 kill 해야만 한다.

SSH 터널링

ssh -v -N -L localhost:8080:localhost:8080 -L localhost:8081:localhost:8081 [email protected]
  • localhost (앞쪽) : binding 할 현재 컴퓨터의 8080 포트
  • localhost (뒤쪽) : 리모트 의 binding 가능한 8080 포트
  • [email protected] : ssh로 접속할 server

colortail config

COLOR magenta
{
# matches the date
^(... ..).*$
}

COLOR cyan
{
# matches the time
^... .. (..:..:..).*$
# matches the word INFO
^.*(INFO|info).*$
}

COLOR green
{
# matches the hostname
^... .. ..:..:.. ([^ ]+).*$
}

COLOR yellow
{
# matches the "program" that wrote to syslog
^... .. ..:..:.. [^ ]+ ([^ ]+)
}

COLOR brightyellow
{
# matches all ip adresses
^.*([0-9]{3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}){1}([:][0-9][0-9][0-9][0-9][0-9]?).*$
^.*([0-9]{2}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}){1}([:][0-9][0-9][0-9][0-9][0-9]?).*$
^.*([0-9]{1}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}){1}([:][0-9][0-9][0-9][0-9][0-9]?).*$
# matches two ip adresses in one line
^.*([0-9]{3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}){1}([:][0-9][0-9][0-9][0-9][0-9]?).*([0-9]{3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}){1}([:][0-9][0-9][0-9][0-9][0-9]?).*$
^.*([0-9]{2}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}){1}([:][0-9][0-9][0-9][0-9][0-9]?).*([0-9]{2}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}){1}([:][0-9][0-9][0-9][0-9][0-9]?).*$
^.*([0-9]{1}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}){1}([:][0-9][0-9][0-9][0-9][0-9]?).*([0-9]{1}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}){1}([:][0-9][0-9][0-9][0-9][0-9]?).*$
# matches the word WARNING
^.*(WARNING|warning|WARN).*$
}

COLOR brightred
{
# matches the word root
^.*(root).*$
# matches DENY
^.*(ppp-in DENY ppp0).*$
^.*(eth-in DENY eth0).*$
# matches the word ERROR
^(ERROR|error|err).*$
^.*(ERROR|error|err).*$
}

COLOR brightblue
{
# matches the output from the "program"
^... .. ..:..:.. [^ ]+ [^ ]+ (.*)
# matches the time
^.*([0-9]{2}:[0-9]{2}:[0-9]{2}).*$
}