Generate PID name based on script name

Fixes #533
Merge pull request #534 from TheSerapher/issue-533

Generate PID name based on script name