Doing this way is perfect. If u have anyother instances running you need to find the shm/semid using different way.