Home>

I want to run cron every 30 seconds.

# crontab -e
* * * * * for i in 15 45;do (sleep ${i};/home/testuser/test.sh -e 1 >>/dev/null 2>&1)&done


This way it will run in the background, so when you look at ps, you will pick up two processes.
(There is a branch in this shell that causes duplicate execution to be an error, so I want to avoid it somehow.
The shell script itself is a process that ends in about 2 seconds. )

I want to start the process without duplication. Is there a good way to write it?
You can add more rows.
Could you tell me how to do this?
Nice to meet you.