Restart Needed in a baseline

I want to be able to add the restart needed fixlet at the end of the baseline but If it comes back up and it still has the pending restart flag I want it restarted up to three times. There is no option to have it do this when you add it to a baseline as you would when you independently kick off this fixlet. I am assuming that this could be added as part of the action script?

Create a task that has an IF statement in it. If it is pending restart, then ‘restart 60’. Insert up to three copies of this within your baseline.

Note, it is important to use the Actionscript restart command, not an OS command.