Reputation: 395
I'm trying to write a page in openwrt that changes the configuration of an application I wrote and then restarts a service. For now, I'm using a simple "service" that writes to a log to see that once I click "save and apply" on the page, it writes the time to this text file. However, I think I'm missing something. I added a section to the /etc/config/ucitrack like this
config app
option init gps
although, to be honest, I just did that because all the other service apps in there did this. My service init script looks like this
#!/bin/sh /etc/rc.common
START=10
start() {
echo Start
echo 'date' > ~/test.txt
}
stop(){
echo Stop
}
reload_service() {
echo "Restarting"
stop
start
}
The page that I wrote (using cbi) already reads the configuration file and then applies the changes. I'm guessing this will also call the init portion of the /etc/config/ucitrack, but I could be wrong. What am I missing here exactly?
Upvotes: 0
Views: 2544
Reputation: 395
So it turns out I was doing this right, except for the path of the file. I shouldn't have used the home "~" shortcut, since I suppose you can't really be sure what user the system will run the script as. When I changed the path to the full one "/root/test.txt", it works just fine.
Upvotes: 1