Systemd脚本规范

/etc/systemd/system/pgsql.service

[Unit]
Description=PostgreSQL-XL Master Node

[Service]
Type=forking
User=pgsql
GuessMainPID=yes
ExecStart=/usr/local/pgxl/bin/pg_ctl -D /data/pg-hma -l /data/pglog/hma start
ExecStop=/usr/local/pgxl/bin/pg_ctl -D /data/pg-hma -l /data/pglog/hma stop
# 如果进程意外终止自动重新启动 systemctl 结束不会自动重启
Restart=always

[Install]
WantedBy=multi-user.target

启动: systemctl start pgsql
状态:systemctl status pgsql

mysql:

[Unit]
Description=MySQL RDBMS

[Service]
#类型simple
Type=simple
GuessMainPID=yes
ExecStart=/usr/local/mysql/bin/mysqld --defaults-file=/usr/local/mysql/my.cnf
Restart=always

[Install]
WantedBy=multi-user.target

了解更多点击这里:https://zh.opensuse.org/openSUSE:How_to_write_a_systemd_service

去打赏

您的支持将鼓励我们继续创作!

[微信] 扫描二维码打赏

发表评论

电子邮件地址不会被公开。