This question is confusing - do you want a script because you have to restart the process because it stops working after 2-3 days? And do you want to know why the process stops working? If so, it depends entirely on the process; what is the actual process? Nobody can tell you why a program stops working if they don't know what the program is!
If you just want an idea for a script, try this:
kill -9 $pidfile
echo $! > $pidfile
and run it on a crontab of every three days:
0 0 1/3 * * /your/script
This isn't tested so please excuse the odd error, but you should see the general idea.