linux

A collection of 26 posts
centos

systemd服务创建

在/etc/systemd/system中新建servicename.service文件。 按以下模板填入内容 [Unit] Description=servicedescription After=network.target [Service] Type=simple WorkingDirectory=/path/to/service User=http Group=http ExecStart=/usr/bin/service(startscript) ExecStop=/usr/bin/service(stopscript) Restart=always SyslogIdentifier=servicename [Install] WantedBy=multi-user.target 之后修改启动脚本/程序的selinux属性 semanage fcontext -a -t unconfined_exec_