I want to run a shell script on my Android device every time it boots. What do I need to do? The script is stored on the MMC of the device and looks like this:

MUXPORT=`/system/bin/getprop hn.gsmux.port`
Modemport=`/system/bin/getprop hn.gsmmux.modem`
/system/bin/setprop hn.gsmmux.mux-exit""

/system/bin/log -t gsmmux "port: $MUXPORT"
/system/bin/log -t gsmmux "modemtype: modemport"

/system/bin/hn_gsmmux -p $MUXPORT -b 115200 -s/dev/hmmodemmux -m Modemport

/system/bin/setprop hn.gsmmux.mux-exit $?
#exit $?

migrated from unix.stackexchange.com Mar 30 '14 at 0:35

This question came from our site for users of Linux, FreeBSD and other Un*x-like operating systems.

  • You wanna look pretty hard at /init*rc – mikeserv Mar 29 '14 at 10:40
  • sir mikeserv can u expalin me how it can happen..? what to do ..any example – john Mar 29 '14 at 10:52
  • Do you have root access? – mikeserv Mar 29 '14 at 10:54
  • no root acess... – john Mar 29 '14 at 11:01
  • 1
    I know what youre saying - at boot the Android system interprets and executes shell scripts and rules applied in /init*rc. Without root you cannot modify these files. So you have to compromise - either write an app that can get boot service permissions and have it execute your script or use one that already does and tell it to run your script. Thats what youre looking at. Sorry. – mikeserv Mar 29 '14 at 11:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy