小编Jac*_*ack的帖子

Systemd:如何在另一个服务启动后启动服务

我有这两项服务,一项是Google启动脚本服务,第二项是redis服务,我想在启动脚本服务启动并完成后启动redis服务,我有以下systemd配置,但我的redis服务无法启动有了这些配置

google-startup-scripts.service
[Unit]
Description=Google Compute Engine Startup Scripts
After=network-online.target network.target rsyslog.service
After=google-instance-setup.service google-network-daemon.service
After=cloud-final.service multi-user.target
Wants=cloud-final.service
After=snapd.seeded.service
Wants=snapd.seeded.service

[Service]
RemainAfterExit=yes
ExecStart=/usr/bin/google_metadata_script_runner --script-type startup
KillMode=process
Type=oneshot
StandardOutput=journal+console
Environment=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin

[Install]
WantedBy=multi-user.target
Run Code Online (Sandbox Code Playgroud)
redis.service

[Unit]
Description=Redis In-Memory Data Store
After=google-startup-scripts.service

[Service]
Type=notify
PIDFile=/run/redis-6378.pid
ExecStart=/usr/bin/redis-getdevice /etc/redis-getdevice/6378.conf
ExecStop=/usr/bin/redis-cli -p 6378 shutdown
Restart=always

[Install]
WantedBy=multi-user.target
Run Code Online (Sandbox Code Playgroud)

一旦 google-startup-script.service 运行并执行操作并进入退出状态。并且 redis 服务根本没有启动(我After在单元中使用)我在这里做错了什么

systemd ubuntu-18.04 systemd-service

13
推荐指数
1
解决办法
5万
查看次数

标签 统计

systemd ×1

systemd-service ×1

ubuntu-18.04 ×1