๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

TIL/Linux

2. ์ฃผํ”ผํ„ฐ ์„œ๋ฒ„ ๋ฐฑ๊ทธ๋ผ์šด๋“œ์—์„œ ์‹คํ–‰ํ•˜๊ธฐ

ํ•˜์ง€๋งŒ ์œ„์˜ ์ƒํƒœ๋Š” ์„œ๋ฒ„์—์„œ ๋กœ๊ทธ์•„์›ƒ(exit)ํ•˜๋ฉด ์ฃผํ”ผํ„ฐ ์‹คํ–‰์ด ๋ฉˆ์ถฅ๋‹ˆ๋‹ค.

๊ณ„์†ํ•ด์„œ ์ฃผํ”ผํ„ฐ๋ฅผ ์ผœ๋†“๊ณ  ์‹ถ๋‹ค๋ฉด, ๋ฐฑ๊ทธ๋ผ์šด๋“œ๋กœ ์ฃผํ”ผํ„ฐ ๋…ธํŠธ๋ถ ์„œ๋ฒ„๋ฅผ ๋Œ์•„๊ฐ€๊ฒŒ ํ•ด์ฃผ์–ด์•ผํ•ฉ๋‹ˆ๋‹ค.

1) ๋ฐฑ๊ทธ๋ผ์šด๋“œ ๋“ฑ๋ก

#์ฃผํ”ผํ„ฐ ์‹คํ–‰
jupyter-notebook
#ํ”„๋กœ์„ธ์Šค๋ฅผ ๋ณด๋ฅ˜ ์‹œํ‚ค๊ธฐ
ctrl + Z
#๋ฐฑ๊ทธ๋ผ์šด๋“œ ์ „ํ™˜
bg

#์ž‘์—… ๊ถŒํ•œ์„ ์‰˜ session์—์„œ ํ•ด์ œ
disown

 

2) ์‹œ์Šคํ…œ ์„œ๋น„์Šค์— ๋“ฑ๋ก

which jupyter-notebook

 

jupyter-notebook ์‹คํ–‰ ํŒŒ์ผ ์œ„์น˜๋ฅผ ๋ณต์‚ฌํ•ด๋‘ก๋‹ˆ๋‹ค.

 

jupyter.service ํŒŒ์ผ์„ ์ˆ˜์ •ํ•ฉ๋‹ˆ๋‹ค.

sudo vi /etc/systemd/system/jupyter.service

 

jupyter.service ํŒŒ์ผ์— ์•„๋ž˜ ๋‚ด์šฉ์„ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค.

[Unit]
Description = Jupyter Notebook Server

[Service]
Type=simple
User=ubuntu
ExecStart=/usr/bin/sudo /home/azure/.local/bin/jupyter-notebook --allow-root 
--config=/home/azure/.jupyter/jupyter_notebook_config.py
User = azure
WorkingDirectory = /home/azure/home
Restart = always
RestartSec = 10

[Install]
WantedBy=multi-user.target
#๋กœ๊ทธ์•„์›ƒ
exit

 

๋‹ค์‹œ ์ฃผํ”ผํ„ฐ ์„œ๋ฒ„์— ์ ‘์†ํ•˜์—ฌ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.