ubuntu开机自启

sudo vim /etc/systemd/system/jupyter.service
[Unit]
Description=jupyter notebook
After=network.target
[Service]
Type=simple

User=cjr403
EnvironmentFile=/home/cjr403/anaconda3/envs/pytorch/bin/jupyter-notebook
ExecStart=/home/cjr403/anaconda3/envs/pytorch/bin/jupyter-notebook
ExecStop=/usr/bin/pkill /home/cjr403/anaconda3/envs/pytorch/bin/jupyter-notebook
KillMode=process
Restart=on-failure
RestartSec=30s
[Install]
WantedBy=multi-user.target

sudo vim /etc/systemd/system/frpc.service
[Unit]
Description=frpc
After=network.target
Wants=network.target

[Service]
Restart=on-failure
RestartSec=5
ExecStart=/home/cjr403/Documents/frp_0.20.0_linux_amd64/frpc -c /home/cjr403/Documents/frp_0.20.0_linux_amd64/frpc.ini
ExecStop=/bin/kill $MAINPID

[Install]
WantedBy=multi-user.target

你可能感兴趣的:(ubuntu开机自启)