Saturday, December 03, 2016

Creating Script to Run on Boot for OpenWRT (Chaos Calmer) - kerem izzet atam

Chaos Calmer has brand new process management daemon to handle init scripts to run on boot, named procd. You can do further reading links below if my shitty tutorial wont work for you. Sadly documentation about procd in OpenWRT wiki site has not been finished at the moment while i was writing this dramatic blog post... ;_;

Anyway ssh to your OpenWRT device and follow steps below. All red parts are personal shit, so put your personal own file names and commands according to your configuration :

1 - create script file under "/etc/init.d/" I named my script :

root@OpenWrt:/# vim /etc/init.d/

2- copy and paste lines below to your file :

#!/bin/sh /etc/rc.common

# it is run order of your script, make it high to not fuck up with other init scripts


start_service() {
  procd_set_param command /target/to/your/shitty/command -some -shit -here

3- Give execute permission to your script :

root@OpenWrt:/# chmod +x /etc/init.d/

4- Enable init script with the command below. It will create symlink in /etc/rc.d directory so it makes your script run on boot :

root@OpenWrt:/# /etc/init.d/ enable

And done! Reboot your device and check if it works. Check links below for further reading :