You may have to call your script with "start" or "stop" option.

Usually the Startup/Shutdown of the machine calls the script with these options.