cd  /etc/systemd/system

sudo vim startpic.service:


[Unit]
Description=It is startpic

[Service]
Type=simple
ExecStart=/home/ubuntu/.myenv/myfirst/bin/python /home/ubuntu/mymnt/project/myproject/wanwenyc/WWSpider/mybase/spiderXiuRenMeiMvWang.py
#启动失败之后重启
Restart=on-failure
#重启间隔为5s
RestartSec=5s

[Install]
WantedBy=multi-user.target

复制代码
复制代码

然后 

sudo systemctl enable startpic  :注册服务

sudo systemctl start startpic :注册服务

 

sudo service startpic status  :查看startpic 服务启动状态

posted on 2022-02-22 07:41  大话人生  阅读(35)  评论(0编辑  收藏  举报