Simple SH script started with cron job, will not persist and settings/files are deleted after reboot.

This post was originally published on this site



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 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/” 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/

/bin/echo ‘@reboot sh /bin/’ >> /var/spool/cron/crontabs/root

/bin/busybox crond


I saved the file and ran the command “sh /sbin/”


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.



Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.