Post Reply

init.rc to launch a script at boot

OP l_electron

5th July 2014, 06:26 PM   |  #1  
OP Junior Member
Thanks Meter: 0
 
2 posts
Join Date:Joined: Jul 2014
I'm trying to get a script to launch. I've done quite a bit of research; nothing I've found has proved very useful. I'm trying to do this on a Galaxy S3 with Cyanogenmod 10.2 Stable. Since it looks like this is a neglected issue on XDA, I'll also reference the other posts which I've read.

Running it as root at startup with SManager works, but I would really prefer to bypass a 3rd-party app.

My script doesn't seem to be loading at boot; it should create a PID file in my /sdcard folder, but it doesn't. Without knowing the PID, I have no way of verifying whether or not it's even running.
Code:
#!/system/bin/sh
(while [it's a never-ending loop]...do [stuff]; busybox sleep 900s...done) & echo $! > /sdcard/myscript.pid &
I've tried a couple different ways of calling this script from init.rc:
Code:
on boot
     sh /system/bin/myscript.sh
and
Code:
service myscript(*I also tried "myscript_boot") /system/bin/myscript.sh
     user root (*also tried it without the user command)
     oneshot (*and without oneshot)
I also find it strange that my changes to init.rc are persistent after reboot since many, many articles suggest that it should be reset after reboot (I've noticed that many of these articles date back to ~2010).

Since I can't find any conclusive documentation on this issue. I hope someone here can shed some insight.

# Editing init.rc
http://forum.xda-developers.com/show....php?t=2069928
# Tried following this article to edit/flash the boot image, but I don't have "/proc/mtd"
http://droidcore.blogspot.com/2012/1...n-android.html
# A neglected post very similar to mine
http://forum.xda-developers.com/show....php?t=1894607
# Another neglected post which addresses this issue
http://forum.xda-developers.com/xper...-init-t2089749
5th July 2014, 06:32 PM   |  #2  
OP Junior Member
Thanks Meter: 0
 
2 posts
Join Date:Joined: Jul 2014
One more thing. My script runs fine if I issue the command in the Terminal emulator, adb shell, and, as mentioned earlier, if launched with SManager. It's only init.rc that's giving me issues.
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Top Threads in Android Q&A, Help & Troubleshooting by ThreadRank