Thank You for looking into the question.
I have a Systemd service lets call it main-application.service which needs service testA.service and testB.service started before start of itself. Following is the service implementation(dir location - /usr/lib/systemd/system)
main-application.service file
[Unit]
Description=Main App
After=testA.service
After=testB.service
Requires=testA.service testB.service
[Service]
EnvironmentFile=/appl/main-application/env-1.conf
EnvironmentFile=/appl/main-application/env-2.conf
ExecStart=/usr/bin/java -jar $EXEC_PATH --spring.config.location=file:/appl/main-application/app.properties
User=root
SuccessExitStatus=143
[Install]
WantedBy=multi-user.target
testA.service
[Unit]
Description=SVC A
After=syslog.target
[Service]
Type=oneshot
ExecStart=/appl/service-a/main.sh
User=root
[Install]
WantedBy=multi-user.target
testB.service
[Unit]
Description=SVC B
After=syslog.target
[Service]
Type=oneshot
ExecStart=/appl/service-b/main.sh
User=root
[Install]
WantedBy=multi-user.target
We want test service A and B both to execute before main application service, there is no ordering requirement. I have still specified "After" directive in main service in the hope that it might work but it doesnot. Weird thing is when I restart main application service it randomly starts either test service A or B but not both.
OS - Redhat 8.9
Can you give suggestions? Thank You in Advance !!