Got two questions.

1. How can I prevent the user from starting two instances of the same program?

2. I am executing a SHELL command from within my program. Is there a way to have my program wait until the SHELL command has completed?