Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| docs:techref:initscripts [2020/12/23 06:46] – Added link to rc.common source in git detly | docs:techref:initscripts [2020/12/23 07:03] (current) – detly | ||
|---|---|---|---|
| Line 56: | Line 56: | ||
| :!: OpenWrt will run the initscript **in the host system during build** (currently using actions " | :!: OpenWrt will run the initscript **in the host system during build** (currently using actions " | ||
| - | If you add a section like the one below: | + | ==== Other functions ==== |
| + | |||
| + | The '' | ||
| + | |||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | These functions can be called by procd init scripts too. | ||
| + | |||
| + | For example: | ||
| ^ Code ^ | ^ Code ^ | ||
| - | |< | + | |< |
| - | echo boot | + | boot() { |
| - | # commands | + | echo " |
| - | }</ | + | # This is a made up command |
| + | comms2_power --on | ||
| + | start " | ||
| + | } | ||
| + | |||
| + | start() { | ||
| + | # Service that uses the device we turned on in boot() | ||
| + | my_service | ||
| + | } | ||
| + | |||
| + | shutdown() { | ||
| + | # The service is finished, so turn off the hardware | ||
| + | stop | ||
| + | echo " | ||
| + | comms2_power --off | ||
| + | } | ||
| + | </ | ||
| - | In that case these commands | + | ==== Custom |
| You can add your own custom commands by using the EXTRA_COMMANDS variable, and provide help for those commands with the EXTRA_HELP variable, then adding sections for each of your custom commands: | You can add your own custom commands by using the EXTRA_COMMANDS variable, and provide help for those commands with the EXTRA_HELP variable, then adding sections for each of your custom commands: | ||