nohup-mv

#trouble-shooting

๋ฌธ์ œ์ 

  • ํ•œ๋ฒˆ์— ํ•œ๊ฐœ๋งŒ ๋™์ž‘ํ•˜๋˜ ํ”„๋กœ์„ธ์Šค(Tomcat), ์—ฌ๋Ÿฌ ๊ฐœ์˜ ํ”„๋กœ์„ธ์Šค๊ฐ€ ๋™์ž‘ํ•  ์ˆ˜ ์žˆ๋„๋ก ๋ณ€๊ฒฝ.

  • ๊ทธ๋Ÿฐ๋ฐ ๊ด€๋ฆฌ๋˜๋˜ ๋กœ๊ทธํŒŒ์ผ๋„ ํ•˜๋‚˜

๋ฐฐํฌ ์Šคํฌ๋ฆฝํŠธ ์˜ˆ์‹œ

...

cp /hello-spring/spring.log /logs/spring-$(date +$s).log
nohup java -jar /hello-spring/target/hello-spring.jar 2> spring.log 1> dev/null &
  • ๋งŒ์•ฝ์— A ํ”„๋กœ์„ธ์Šค๊ฐ€ ๋™์ž‘ ์ค‘์ด๋‹ค๊ฐ€, B๊ฐ€ ๋ฐฐํฌ๋œ๋‹ค๊ณ  ํ•  ๋•Œ, nohup ์ด ํ›„ ๋ฐœ์ƒํ•œ A ๋กœ๊ทธ๋ฅผ ๋ชป๋ณผ ์ˆ˜ ์žˆ์Œ.

ํ•ด๊ฒฐ

  • mv ์ปค๋งจ๋“œ๋ฅผ ์ด์šฉ

  • mv /hello-spring/spring.log /logs/spring-(date +s).log ์ด๋Ÿฐ์‹์œผ๋กœ ์‚ฌ์šฉํ•˜๋ฉด, A ํ”„๋กœ์„ธ์Šค์— nohup ์„ ํ†ตํ•ด ๋ฐœ์ƒํ•˜๋˜ ๋กœ๊ทธ๊ฐ€ ์ง€์†์ ์œผ๋กœ ์Œ“์ด๋Š” ๋“ฏ.

  • ์ฆ‰ ํŒŒ์ผ ์ด๋ฆ„์€ ๋ฐ”๋€Œ์ง€๋งŒ, nohup ์„ ํ†ตํ•ด ๋กœ๊ทธ๊ฐ€ ์Œ“์ด๋˜ ๋งํฌ๋Š” ๋ณ€ํ™”๊ฐ€ ์—†๋Š”๋“ฏํ•จ.

์ฐธ๊ณ 

Last updated