Execute a Script at Server Startup
As far as I know, it's impossible to use a Cron job to do this on illumos; you need to use /etc/rc.d.
Here's how I do it :
Log in as root
Write your script and copy it to /etc/init.d/
Make sure root has permissions to execute it!
Otherwise, it will not work.
Let's assume your script is called SCRIPT.SH :
chmod 740 /etc/init.d/SCRIPT.SH
Create a symbolic link to the rc3.d directory (this is where network configurations are made, among other things)
ln -s /etc/init.d/SCRIPT.SH /etc/rc3.d/S80-SCRIPT.SH
The prefix S80 is crucial because it indicates the order in which the scripts will be executed.
You must put the letter [S] followed by a number between 01 and 99, depending on the order in which you want the scripts to be executed.
Restart the server, and your SCRIPT.SH has been executed.
Don't miss what's next. Subscribe to Illumadmin: