5 將服務部署到本機 Ubuntu14 04

2022-08-05 14:12:10 字數 2133 閱讀 6300

首先,先將檔案複製到指定的資料夾

我這裡選擇在/var下面新建一個www的資料夾來存放

複製blog資料夾的內容到www資料夾下

1 sudo cp -r /home/jakeychen/jakey/blog/ /var/www/

1 [email protected]:/var/www/blog$ sudo service supervisor restart

2restarting supervisor: supervisord.

3 [email protected]:/var/www/blog$ sudo supervisorctl

4 tornadoes:tornado-8000 running pid 10949, uptime 0:00:08

5 tornadoes:tornado-8001 running pid 10950, uptime 0:00:08

6 tornadoes:tornado-8002 running pid 10951, uptime 0:00:08

7 tornadoes:tornado-8003 running pid 10952, uptime 0:00:08

8 supervisor>

在conf.d目錄下新建一個tornado.conf

sudo vim /etc/supervisor/conf.d/tornado.conf

tornado.conf檔案內容

1

[group:tornadoes]

2 programs=tornado-8000,tornado-8001,tornado-8002,tornado-8003

34 [program:tornado-8000]

5 command=sudo python /var/www/blog/main.py --port=8000

6 directory=/var/www/blog

7 user=root

8 autorestart=true

9 redirect_stderr=true

10 stdout_logfile=/var/www/blog/logs/server.log

11 loglevel=info

1213 [program:tornado-8001]

14 command=sudo python /var/www/blog/main.py --port=8001

15 directory=/var/www/blog

16 user=root

17 autorestart=true

18 redirect_stderr=true

19 stdout_logfile=/var/www/blog/logs/server.log

20 loglevel=info

2122 [program:tornado-8002]

23 command=sudo python /var/www/blog/main.py --port=8002

24 directory=/var/www/blog

25 user=root

26 autorestart=true

27 redirect_stderr=true

28 stdout_logfile=/var/www/blog/logs/server.log

29 loglevel=info

3031 [program:tornado-8003]

32 command=sudo python /var/www/blog/main.py --port=8003

33 directory=/var/www/blog

34 user=root

35 autorestart=true

36 redirect_stderr=true

37 stdout_logfile=/var/www/blog/logs/server.log

38 loglevel=info

重啟服務

sudo service supervisor restart