[root@xhk system]# cd /var/lib/systemd/system
[root@xhk system]# cat mariadb.service |egrep -v "^$|[[:space:]]*#"
[Unit]
Description=MariaDB database server
After=syslog.target
After=network.target
[Service]
Type=simple
User=mysql
Group=mysql
ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n
ExecStart=/usr/bin/mysqld_safe --basedir=/usr
ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID
TimeoutSec=300
PrivateTmp=true
[Install]
WantedBy=multi-user.target
我们只需要修改一下参数就行
[root@xhk system]# vim mfs.service
[Unit]
Description=mfs
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/mfs/sbin/mfsmaster start
ExecStop=/usr/local/mfs/sbin/mfsmaster stop
PrivateTmp=true
[Install]
WantedBy=multi-user.target
保存退出之后,就可以使用system来控制mfs进程了
[root@xhk system]# systemctl start mfs
[root@xhk system]# systemctl enable mfs
原文地址:http://blog.51cto.com/xhk777/2091145