I created a simple little script to do a rescan of the storage adapters on the server, 60 seconds after boot.
I created a file called hbascan.sh and in that file i have this line "sleep 60s;esxcli storage core adapter rescan --all"
I placed this script in the /bin folder on the ESXi host
I edited the "/var/spool/cron/crontabs/root" in here i added "@reboot sh /bin/hbascan.sh" at the end/bottom of the file.
I then killed the Cron job after finding the correct ID
I then edited the "/etc/rc.local/" and added at the end of the file 3 rows with text.
/bin/kill $(cat /var/run/crond.pid)
/bin/echo '@reboot sh /bin/hbascan.sh' >> /var/spool/cron/crontabs/root
I saved the file and ran the command "sh /sbin/auto-backup.sh"
Problem is that when i reboot the server everything is gone, the script is gone and the changes to root and rc.local is also gone.
I did the edit of the files with winscp as i am not really confident in "vi"
I am not entirely sure what's wrong, it could be syntax or maybe file rights?
I followed a guide for this online and it's almost identical to the guide, only i did not provide any path to logs.
Any help would be greatly appreciated.
The ESXi file system is not persistent, except for the /scratch partition, which typically is vfat, 4GB in size and is used to store logs and temp data.
# df -h
vfat 4.0G 135.8M 3.9G 3% /vmfs/volumes/735367abc...
Create a dir there
mkdir /scratch/myscripts to place your scripts and run them from this location