I have followed the steps from RedHat to start the multiple services into one service.
https://access.redhat.com/solutions/3097871
/etc/systemd/system/myapps.target
[Unit]
Description=App Service Unit
# This collection of apps should be started at boot time.
[Install]
WantedBy=multi-user.target
App1.service
/etc/systemd/system/app1.service
[Unit]
Description= Instance of App1 Service
PartOf=myapps.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/home/mark/bin/app1.sh start
ExecStop=/home/mark/bin/app1.sh stop
# When the service runs globally, make it run as a particular user for added security
#User=user1
#Group=group1
# When systemctl enable is used, make this start when the App service starts
[Install]
WantedBy=myapps.target
App2.service
[Unit]
Description= Instance of App2 Service
PartOf=myapps.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/home/mark/bin/app2.sh start
ExecStop=/home/mark/bin/app2.sh stop
# When the service runs globally, make it run as a particular user for added security
#User=user1
#Group=group1
[Install]
WantedBy=myapps.target
I want to stop the app1.service independently. But when I check the status of the myapps.target, I do not see the current app1.service status as stopped. Instead, it shows that app1.service is running. How can I change myapps.target to reflect the status?
Thanks in advance.