how to add cron jobs to vmware esxi

…and have them survive a reboot.

btw, best to store the script on a datastore so it still exists after the reboot, as well. for instance, at + /vmfs/volumes/datastore1/scripts/myscript

        #!/bin/sh
        # make sure the scripts dir exists
        [ -d /vmfs/volumes/datastore1/scripts ] || mkdir /vmfs/volumes/datastore1/scripts
        # get the script
        cd /vmfs/volumes/datastore1/scripts
        [ -x myscript ] || wget http:_mywww/myscript
        # add job to root's crontab
        # i know... i know... but it all fits on one line this way...
        tabfile=/var/spool/cron/crontabs/root
        line="1 1 * * * /vmfs/volumes/datastore1/scripts/myscript myarg"
        echo "$line" >>$tabfile
        kill `cat /var/run/crond.pid` && crond
        # add to /etc/rc.local to do it again after next boot
        # untested: check the quoting on this...
        cat >>/etc/rc.local <<EOM
        echo "$line" >>$tabfile
        kill `cat /var/run/crond.pid` && crond
        EOM
        # backup /etc/rc.local so that the changes survive
        auto-backup.sh