Monitor Process and Restart

Medium Shell OS
Solve this problem

Write a shell script that monitors a given process name and restarts it if it stops running. Log restart times.

Constraints

  • Arg: process name.
  • Loop forever.
  • pgrep detect.
  • restart on fail.
  • append log.
Starter codeShell
1#!/bin/bash2# TODO