Linux systemd.service配置

1. 创建your-name.service文件

    sudo nano /etc/systemd/system/your-name.service

    2. 填写service内容

    [Unit]
    Description=/etc/your-name.local Compatibility
    After=network.target
    
    [Service]
    ExecStart=/your-cmd-exc-path
    
    [Install]
    WantedBy=multi-user.target

    3. 开机自启并启动service

    sudo systemctl enable your-name.service
    sudo systemctl start rc-local.service

    发表评论