I'm running shell script in init.rc as a service but it killed and restarts continuously.
Service registering in init.rc as follows
service Storelog /system/bin/logwrapper /system/bin/store_log.sh
user root
disabled
and script store_log.sh is
#!bin/sh
while true
do
echo "Updating system log.."
logcat > /data/system.log &
sleep 600
echo "Killing background logcat."
logpid=$!
echo "logpid $logpid"
kill $logpid
logcat -c
done
and I am starting this Storelog on some trigger like boot_completed
This service starts, after one loop its killed and restarted.
What I am missing here ?? some permission ?? Any suggestion are helpful.
according to this page: http://developer.android.com/tools/help/logcat.html
the '-c' option causes logcat to exit
however, by then, the 'kill' has already exited logcat.
suggest modifying the script to: (following untested)