You are not logged in.

#1 2012-12-29 10:55:14

Never
Member
Registered: 2008-07-01
Posts: 103

Systemd service order

I rebooted a system and suddenly noticed I could not ssh into it anymore, puzzled, went to it and found that for some reason eth0 was down, but the netcfg.service had managed to put the loopback up. So systemctl restart netcfg and everything came back normal. Then a thought occured to me, these services are not ordered the way I would have ordered my daemons, so I tried to do that:

#
#     The Shoreline Firewall (Shorewall) Packet Filtering Firewall - V4.4
#
#     Copyright 2011 Jonathan Underwood (jonathan.underwood@gmail.com)
#
[Unit]
Description=Shorewall IPv4 firewall
After=syslog.target
After=network.target

[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=-/etc/sysconfig/shorewall
StandardOutput=syslog
ExecStart=/usr/sbin/shorewall $OPTIONS start
ExecStop=/usr/sbin/shorewall $OPTIONS stop

[Install]
WantedBy=multi-user.target
[Unit]
Description=Netcfg multi-profile daemon
After=shorewall.service

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/netcfg-daemon start
ExecStop=/usr/bin/netcfg-daemon stop
KillMode=none

[Install]
WantedBy=multi-user.target
[Unit]
Description=OpenSSH Daemon
Wants=sshdgenkeys.service
After=sshdgenkeys.service netcfg.service

[Service]
ExecStart=/usr/sbin/sshd -D
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=always

[Install]
WantedBy=multi-user.target

# This service file runs an SSH daemon that forks for each incoming connection.
# If you prefer to spawn on-demand daemons, use sshd.socket and sshd@.service.

This should force network.target-> shorewall.service -> netcfg.service -> sshd.service always and forever right? If not how would I do that? Anything potentially wrong with this?

Offline

Board footer

Powered by FluxBB