[Unit]
Description=Run foo
# You can sepcify dependencies
#After=network.target
[Service]
# Service that is not actually a service
# Process is spawned (state=active) then exits (state=inactive)
Type=simple
# The actual program to run
ExecStart=/usr/local/bin/foo
[Install]
# You can make it so that you can run all
# processes you need with
# systemctl start magic-process-group.target
WantedBy=magic-process-group.target
Check if foo.service or bar.service are running, otherwise exit
systemctl is-active foo bar | grep '^active$' || systemctl poweroff