vsphere5-親ホストの自動ブート

  • crontabの原本
# cat /var/spool/cron/crontabs/root
#min hour day mon dow command
0    20   *   *   *   /bin/reboot
1    1    *   *   *   /sbin/tmpwatch.py
1    *    *   *   *   /sbin/auto-backup.sh
0    *    *   *   *   /usr/lib/vmware/vmksummary/log-heartbeat.py
*/5  *    *   *   *   /sbin/hostd-probe
  • crontabを書き換えするコマンドライン
#/bin/kill $(cat /var/run/crond.pid)
#/bin/echo "0    20   *   *   *   /bin/reboot" >> /var/spool/cron/crontabs/root
#/usr/lib/vmware/busybox/bin/busybox crond 
  • 更新するための方法
    /etc/rc.local.d/local.shに追記する

起動時間はJSTではなくUTCで指定する必要がある。
たとえばJST5:00の場合、UTCでは9時間バックするため、UTC20:00を指定する。

#!/bin/sh

# local configuration options

# Note: modify at your own risk!  If you do/use anything in this
# script that is not part of a stable API (relying on files to be in
# specific places, specific tools, specific output, etc) there is a
# possibility you will end up with a broken system after patching or
# upgrading.  Changes are not supported unless under direction of
# VMware support.

/bin/kill $(cat /var/run/crond.pid)
/bin/echo "00  20   *   *   *   /bin/reboot" >> /var/spool/cron/crontabs/root
/usr/lib/vmware/busybox/bin/busybox crond

exit 0
タイトルとURLをコピーしました