ESXi 7.0で cron を使う

先に結末を明かしてしまうと… /etc/rc.local.d/ に数行を加えます。この例だと exit 0 の手前の3行で、定期的に ping を打ちます。

[root@localhost:~] cat /etc/rc.local.d/ 
#!/bin/sh ++group=host/vim/vmvisor/boot

# 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.

# Note: This script will not be run when UEFI secure boot is enabled.

/bin/echo "分 時 日 月 曜日 /sbin/ping IPアドレス" >> /var/spool/cron/crontabs/root
/bin/kill $(cat /var/run/
/usr/lib/vmware/busybox/bin/busybox crond

exit 0



[root@localhost:~] grep cron /var/log/syslog.log
2021-03-10T15:30:55Z crond[543001]: crond (busybox 1.29.3) started, log level 8
2021-03-10T15:31:00Z crond[543001]: USER root pid 543002 cmd /sbin/ping IPアドレス




メールアドレスが公開されることはありません。 * が付いている欄は必須項目です