How to stop Second Job which is running parallely with first Job when first Job failed

I have a pipeline which contains two jobs job1 and job2 with different resources, when I start the pipeline job1 and job2 are running parallely, but when job1 fails immediately I should be stopping the job2.can someone help me with this requirement.

I know I should perform on_failure step when the first job fails but got struck up at the shell script to execute to stop the second job.

With Concourse, jobs are completely separate and can’t natively influence the behaviour of other jobs. If two jobs are running in parallel you can’t make one monitor the status of another short of running something like fly watch in one of the scripts.

Within a job you can make the execution of some steps depend on the exit code of previous steps using steps like on_failure, on_success, or one of the others. However you still won’t be able to terminate an already-running step based on the failure of a different step.

Thanks crsimmons for the response