0

I have a requirement to do a script for gather some data from one db and formatting according to a requirement, this should run by a scheduled cron job. but there should not be parallel runs. (If one process is running, then other should not start).

Help me to do this in bash scripting.

1 Answers1

0

You can use lock file. At script start check if lock file is already exist, if so exit, if not continue. When create lock file. execute your script. And before exit remove lock file. something like this:

if [ - f lock ] ; then
exit 1
fi
touch lock
your code
rm lock
dolpa
  • 16