added pid check so the script can only run once