大网数据广告活动
服务器运维问答

Order of services using systemd and legacy init.d services

· 52CE 我爱测

On my Fedora 23 system a database is started by systemd. Another service (hive-metastore) that depends on that database ist started through a init.d script. I'am unclear about what would be the correct way to make those services …

问题原文

原帖链接 · cstotzer · CC BY-SA 3.0

On my Fedora 23 system a database is started by systemd. Another service (hive-metastore) that depends on that database ist started through a init.d script. I'am unclear about what would be the correct way to make those services start in the right order (database before hive-megastore).

已采纳解答

原帖链接 · TomH · CC BY-SA 3.0

It's quite likely that the best solution is simply to write a systemd unit for the hive-metastore service - so long as it has the same name systemd will use it in preference to the init script and it will likely be a lot easier to read and a lot more reliable.

You can control the ordering without that though, by adding Before=hive-metastore.service to the database service unit. That's best done using a dropin fragment, so create something like /etc/systemd/system/database-name.service.d/hive-metastore.conf with this content:

[Unit]
Before=hive-metastore.service

It's not quite what you would do if both were native systemd units, as in that case you would likely add the configuration to the other service, and use both After to control the ordering and Requires to ensure the database is started, but the ordering alone is sufficient if both services are enabled and ordering can be controlled from either end of the dependency.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-02-23)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。