制作内置novnc服务

1.获取novnc的服务代码

我的下载里面获取

2.制作启动脚本

vim /root/novnc_start.sh

#!/bin/bash

nohup /root/noVNC-1.0.0/utils/launch.sh --vnc localhost:5901  &
echo $! > /var/run/novnc.pid

3.制作service

vim /etc/systemd/system/novnc.service

[Unit]
Description=novnc service
After=network-online.target
Wants=network-online.target

[Service]
Type=forking
User=root
Group=root
ExecStart=/bin/bash /root/novnc_start.sh
ExecStop=/bin/kill -9 $MAINPID
Restart=on-failure
PrivateTmp=true

[Install]
WantedBy=multi-user.target

4.服务自启动

systemctl daemon-reload
systemctl enable novnc
systemctl start novnc
systemctl status novnc

你可能感兴趣的:(虚拟机,kubernetes)