Init.d script

Post your questions and help other users.

Moderator: Martin

Post Reply
LED
Posts: 45
Joined: 28 Jun 2014 00:51

Init.d script

Post by LED » 10 Jul 2016 19:07

Hi Martin, I don't want to abuse of your good will but you may be able to help me if you can, and it is fine if not.

From automagic i can use "execute root to command" execute scripts. It works perfectly.

One of the scripts I use is to change the CPU frequency and governor as well as the number of online cores. It simply works, no issue with your app.

The scrip is quite long and I use ";" in between each line.

Im now trying to embed this script into a init.d file with no success.

As a test I have created a small file, inside syste/etc/init.d with a single line like this

echo 4 > /sys/bus/cpu/devices/cpu0/core_ctl/min_cpus

Do you now if I'm missing other lines at the top? I'm totally clueless on how to achieve his, but pretty sure it is possible to run this at boot.

Best regards

LED

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Init.d script

Post by Martin » 11 Jul 2016 19:44

I usually try to avoid making changes to the system so I'm fairly clueless about such things. :D

Maybe ensure there's a proper shebang and the permission of the file is correct. This thread sounds interesting: http://android.stackexchange.com/questi ... pt-on-boot

Regards,
Martin

User avatar
Bushmills
Posts: 286
Joined: 23 Sep 2014 21:56

Re: Init.d script

Post by Bushmills » 12 Jul 2016 01:56

Instead of specifying solely the script name in Automagic "execute command" action - with hashbang in script needed, and execute bit set -, you could give as command: sh /path/to/script/name_of_script. Invoking the script this way doesn't require you to do any of the above.
Running scripts at boot time without involvement from Automagic I do by placing them in directory /data/local/userinit.d - this may be a CyanogenMod feature, not sure whether stock Android provides the same. But placing them there, scripts need hashbang and execute bit again.

LED
Posts: 45
Joined: 28 Jun 2014 00:51

Re: Init.d script

Post by LED » 13 Jul 2016 07:44

Thanks guys.
Ill try and see if it works.
I knew I was missing something.

Cheers.

Post Reply