I have a bash as below, it has been been launched with nohup firstly, when I launch the same with nohup again, then 2 process will be running, which is not wanted.
#!/bin/sh
i=0
while true
do
    echo $i
    ((i++))
    sleep 1
done
How can I add logic in script to check previous launched process exist? and if exist then kill it firstly to avoid 2 process running at the same time?
I run ps to list the process info and saw below:
shell          6669   6327 12346608  3948 hrtimer_nanosleep   0 S sleep
I can not just kill shell process since maybe some other shell script is running!
