Is it safe to change runlevel inside a cron script?
I created the following script
#!/bin/bash
date
who -r
/sbin/telinit 2
who -r
/sbin/telinit 3
who -r
date
and installed it in cron
* * * * * /home/iain/test &>>/tmp/test.out
It's output
Thu Mar 20 03:06:01 EDT 2014
run-level 3 2014-03-20 03:05 last=2
run-level 2 2014-03-20 03:06 last=3
run-level 3 2014-03-20 03:06 last=2
Thu Mar 20 03:06:01 EDT 2014
As you can see the script keeps running. As to the safety of this only you can decide based on your testing in your environment.
On an older HP-UX system, we used to do cold backups of our databases nightly using runlevel changes. We had the database start and stop at runlevel 4, and basically did an telinit 3, took snapshots of the disks, telinit 4, started backing up the disks. It's a slightly different strategy than your looking at, but for all intents and purposes, it'll behave the same.