自己建设网站用哪个,东网站建设,网站怎么加友情链接,肇庆网站seo这里以python脚本为例
创建服务#xff1a;
# 查看已有的服务有哪些
cd /etc/systemd/system
ls# 创建新服务
sudo vim test.service#编辑service文件内容#xff08;如果无法输入或修改#xff0c;点击i代表insert#xff09;
[Unit]
Description项目描述Wantsnetwork.t…这里以python脚本为例
创建服务
# 查看已有的服务有哪些
cd /etc/systemd/system
ls# 创建新服务
sudo vim test.service#编辑service文件内容如果无法输入或修改点击i代表insert
[Unit]
Description项目描述Wantsnetwork.target #设置依赖关系弱依赖
Aftersyslog.target network-online.target #设置启动顺序[Service]
Typeidle #定义启动类型Userroot
ExecStartpython3 -u 脚本地址 #指定启动单元的命令或脚本
ExecReload/bin/kill -s HUP $MAINPID #指定单元重启时执行的命令或者脚本
ExecStop/bin/kill -s QUIT $MAINPID #指定单元停止时执行的命令或者脚本Restartalways
RestartSec5s[Install]
WantedBymulti-user.target #表示该服务所在的 Target完成service文件编辑后点击ESC进入命令行模式
命令含义:q不保存退出:q!不保存并强退出:wq保存退出:wq!强制保存退出:x保存退出如果没有修改则不修改更新时间
开启服务
ls #查看服务是否存在systemctl enable test.service #开启服务
systemctl status test.service #检查服务状态命令含义systemctl enable test.service启用服务开机启动后台启动systemctl is-active test.service激活服务systemctl disable test.service禁用服务systemctl start test.service启动服务systemctl restart test.service重启服务systemctl stop test.service停止服务systemctl reload test.service重新加载服务systemctl status test.service检查服务状态