Single Instance

Hi,

I have a script. I want only one instance of the script to be running at any point of the time. How can I do it.
what would be the exact format of the ps command for doing this. For example the name of my script is "Inst.sh"

Thanx in advance

ps listing gives you all the processes that are running. If more than one instance of Inst.sh is running, you plan to kill the other instances ? Better would be to introduce a lock file concept rather than killing processes.

ps x | grep '[i]nst.sh' gives you the pid(s) of Inst.sh

See the lock file getting used in how to detect my script is already running and How to check if another instance of the process is running

why to kill the other instances,
while booting the particular script itself just make a check if any of the previous instance is currently running if so dont boot the new instance.