Please use CODE blocks to avoid the forum software mangling your code

.
And, yes, the second example depends in parts on FW 5.x features, so it's not terribly surprising that it doesn't behave on your device.
OTOH, a cron job would indeed be the most painless & cleanest solution.
Barring that, a crappy for-ever loop in a shell script (you should be able to rip parts of the second example for that).