Now the scripts inside /etc/local.d/ directory with suffix .start will be executed at system startup and all the scripts with suffix .stop will be executed during system shutdown. First make sure you have enabled local.d scripts using below steps.
Enable local.d Scripts
To start the local.d scripts at boot time, add its init.d script to the default runlevel# rc-update add local defaultNow start the service by making OpenRC check for stopped services in the default runlevel:
# rc-service local start
Run Script on Startup
Create a script /etc/local.d/myService.start and put your content in it. This will be executed during system boot.# vi /etc/local.d/myService.start
#!/bin/sh # Show below message on system startup echo "Welcome back!"
Run Script on Shutdown
Create a script /etc/local.d/myService.stop and put your content in it. This will be executed during system shutdown.# vi /etc/local.d/myService.stop
#!/bin/sh # Show below message on system shutdown echo "Good bye!"
Comments
Post a Comment