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
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
1 Comment
Vipin Sahu
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......