File size: 309 Bytes
e90f765
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/bash
service_name="2336"

while true; do
    if [[ $(ps -ef | grep -v grep | grep "$service_name" | wc -l) -gt 0 ]]; then
        echo "Service $service_name is already running."
    else
        echo "Service $service_name is not running. Restarting..."
        python ./api.py
    fi
    sleep 5
done