2

I have rooted android phone and I am getting the # when I use "su" i wish to write a script that would keep running in background like service at application end and do the needful task for me. Where should i keep the .sh fle so that it will run on system boot so that no body will able to kill it ... i mean it should work like system service/apps ..

1 Answer 1

1

you have to write a script and save it either data/local/tmp/example.sh and it should like that example.sh

#!/system/bin/sh

cd /data/local/tmp

while true; do


for i in *.apk ; do
    if ls $i 2> /dev/null >/dev/null ; then 
        echo "`date` : Found new $i " >> /data/local/tmp/update_log


    fi
done



sleep 120
reboot 


sleep 180
done

and add it to any .sh file which is run on boot of the device it will check for any apk on data/local/tmp folder and create a list of that as update_log i put it on /data/local/tmp and bind it with init.wlan.sh on the last line with & ..hope it works for you

Sign up to request clarification or add additional context in comments.

1 Comment

now I want the script to catch other intent broadcast by the system and then i will do the needful as i do in onReceive method of broadcast receiver......

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.