Hi,
I want to create a package for Fedora 16 but I'm struggling with the
systemd service/target files. I cannot get the various services to execute
in the right order. I have 4 services (they're actually scripts that just
execute and terminate) that need to run in the order described below. Any
of the services could fail but that shouldn't affect any of the other
services.
1) Service A after the local filesystem is mounted.
2) Service B after the network is up and service A terminated.
3) At this point I'd like to create a reference point for other services to
hook into.
4) Service C after the reference point and after syslog is up.
5) Service D after rc-local and after service C terminated.
What I have at the moment is the following:
A.service:
[unit]
Description=A
After=local-fs.target
[Service]
Type=oneshot
ExecStart=/usr/bin/A
RemainAfterExit=yes
B.service:
[unit]
Description=B
After=network.target A.service
[Service]
Type=oneshot
ExecStart=/usr/bin/B
RemainAfterExit=yes
C.target:
[unit]
Description=C
After=A.service B.service
C.service:
[unit]
Description=C
After=syslog.target C.target
[Service]
Type=oneshot
ExecStart=/usr/bin/C
RemainAfterExit=yes
D.service:
[unit]
Description=D
After=rc-local.service C.service
[Service]
Type=oneshot
ExecStart=/usr/bin/D
RemainAfterExit=yes
[ 2.417488] systemd[1]: Installed new job C.service/start as 80
[ 2.417494] systemd[1]: Installed new job A.service/start as 82
[ 2.417504] systemd[1]: Installed new job D.service/start as 86
[ 2.417533] systemd[1]: Installed new job B.service/start as 100
[ 92.455037] systemd[1]: About to execute: /usr/bin/C
[ 92.460087] systemd[1]: Forked /usr/bin/C as 574
[ 92.460204] systemd[1]: C.service changed dead -> start
[ 92.557292] systemd[1]: About to execute: /usr/bin/A
[ 92.565167] systemd[1]: Forked /usr/bin/A as 578
[ 92.565289] systemd[1]: A.service changed dead -> start
[ 92.954627] systemd[1]: Received SIGCHLD from PID 574 (C).
[ 92.954649] systemd[1]: Got SIGCHLD for process 574 (C)
[ 92.954689] systemd[1]: Child 574 belongs to C.service
[ 92.954696] systemd[1]: C.service: main process exited, code=exited,
status=0
[ 92.964090] systemd[1]: C.service changed start -> exited
[ 92.964103] systemd[1]: Job C.service/start finished, result=done
[ 92.964231] systemd[1]: Got SIGCHLD for process 578 (A)
[ 92.964272] systemd[1]: Child 578 belongs to A.service
[ 92.964277] systemd[1]: A.service: main process exited, code=exited,
status=1
[ 92.965076] systemd[1]: A.service changed start -> failed
[ 92.975063] systemd[1]: Job A.service/start finished, result=failed
[ 92.975085] systemd[1]: Unit A.service entered failed state.
[ 92.976434] systemd[1]: About to execute: /usr/bin/D
[ 92.983105] systemd[1]: Forked /usr/bin/D as 642
[ 92.983177] systemd[1]: D.service changed dead -> start
[ 92.983655] systemd[1]: C.service: cgroup is empty
[ 92.983696] systemd[1]: A.service: cgroup is empty
[ 93.012250] systemd[1]: About to execute: /usr/bin/B
[ 93.020073] systemd[1]: Forked /usr/bin/B as 649
[ 93.020168] systemd[1]: B.service changed dead -> start
[ 93.228193] systemd[1]: Received SIGCHLD from PID 642 (D).
[ 93.228217] systemd[1]: Got SIGCHLD for process 642 (D)
[ 93.228259] systemd[1]: Child 642 belongs to D.service
[ 93.228273] systemd[1]: D.service: main process exited, code=exited,
status=0
[ 93.236088] systemd[1]: D.service changed start -> exited
[ 93.236100] systemd[1]: Job D.service/start finished, result=done
[ 93.236363] systemd[1]: D.service: cgroup is empty
[ 117.429569] systemd[1]: Received SIGCHLD from PID 649 (B).
[ 117.429614] systemd[1]: Got SIGCHLD for process 649 (B)
[ 117.429683] systemd[1]: Child 649 belongs to B.service
[ 117.429704] systemd[1]: B.service: main process exited, code=exited,
status=0
[ 117.437134] systemd[1]: B.service changed start -> exited
[ 117.437158] systemd[1]: Job B.service/start finished, result=done
[ 117.437627] systemd[1]: B.service: cgroup is empty
Do I really need 'RemainAfterExit=y'? Do I need any 'Wants' or 'Requires'?
Any help is greatly appreciated.
Thanks
...Juerg