For some reasons I need to run a script whenever system property is changed, so I write code like this in init.rc:
on property:persist.sys.proptest=*
start mytest
service mytest /system/bin/sh /system/etc/mytest.sh ${persist.sys.proptest}
class main
user system
oneshot
group system
disabled
but it didn't work, my script get the "${persist.sys.proptest}" string instead of the value of the persist.sys.proptest. I check all the *.rc file and find out that access ${persist.sys.proptest} in service statement seems not working, so I changed code like this:
on property:persist.sys.proptest=*
/system/bin/sh /system/etc/mytest.sh ${persist.sys.proptest}
this time my script didn't get called at all. But when I checked init.fugu.rc, this code seems works:
on property:init.post_fs_data.bootreason=*
# Create dump dir and collect dumps. (use the same location as in init.rc)
mkdir /data/dontpanic 0750 root log
copy /proc/emmc_ipanic_console /data/dontpanic/ipanic_console
chown root log /data/dontpanic/ipanic_console
chmod 0640 /data/dontpanic/ipanic_console
copy /proc/emmc_ipanic_threads /data/dontpanic/ipanic_threads
chown root log /data/dontpanic/ipanic_threads
chmod 0640 /data/dontpanic/ipanic_threads
copy /proc/emmc_ipanic_gbuffer /data/dontpanic/ipanic_gbuffer
chown root log /data/dontpanic/ipanic_gbuffer
chmod 0640 /data/dontpanic/ipanic_gbuffer
# Clear panic partition
write /proc/emmc_ipanic_header 1
so what's wrong with my code? Is the mkdir/chown/copy not the real shell command at all? If then, how could I pass the value of persist.sys.proptest to my script?