I need to run a script that sets cpu_freq .In order to retain the settings after reboot i need to run script which takes care of this issue.I tried to write service in init.rc but the edited part in init.rc disappears on reboot .is there some other way to start script on reboot.thanks
For Linux startup scripts, you can use bash or non-bash file. To use a non-bash file, designate the interpreter by adding a #! to the top of the file. For example, to use a Python 3 startup script, add #! /usr/bin/python3 to the top of the file.
I've found success with magisk. When installed, it adds a directory for boot scripts under /data/adb/service.d
, in which you can throw your shell scripts and have them executed by Magisk on boot.
For example, I have the following script:
#!/bin/sh
sleep 15 # to make sure we aren't running in an early stage of the boot process
crond -b -c /data/crontab/
Once created as /data/adb/service.d/start-crond.sh
and made executable, it automatically launches crond
at boot (provided by Magisk's internal busybox instance).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With