Let's say I have this script:
start daemon1 &
start daemon2 &
echo "Running..."
daemon2 can only be started if daemon1 was started successfully.
if daemon1 did not start successfully, then the script most be aborted
"Running..." should be displayed only if daemon2 started successfully.
if daemon2 did not start successfully, then the script most be aborted
How can I make this with a shell script ?