cd /etc/systemd/system vim startspiderimg.server: [Unit] Description=It is startspiderimg [Service] Type=simple ExecStart=/home/ubuntu/virtualenvs/myfirst/bin/python /home/ubuntu/mymount/project/myproject/wanwenyc/WWSpider/mybase/spiderXiuRenMeiMvWang.py #启动失败之后重启 Restart=on-failure #重启间隔为5s RestartSec=5s [Install] WantedBy=multi-user.target
然后
systemctl enable startspiderimg :注册服务
systemctl start startspiderimg :注册服务
service startspiderimg status :查看startspiderimg服务启动状态