自启动文件放在 /usr/lib/systemd/system

1
2
3
4
5
6
7
8
9
10
[Unit]
Description=code-server

[Service]
Type=simple
ExecStart=/usr/bin/code-server
User=your user name

[Install]
WantedBy=multi-user.target
1
2
3
sudo systemctl daemon-reload  #刷新
sudo systemctl start code-server
sudo systemctl enable code-server