added first check the pid is working before run