Pavel Korban Pavel Korban - 4 months ago 28
Android Question

How to start daemon on android by adb

Can you help me please, my head is swollen...

I am trying to run daemon on android emu/device by command:

adb -s <device_name> shell su -c /dir/daemon <port_number>


but nothink happens, and no errors!

If I do:

adb -s <device> shell


and then form shell cmdline:

su -c /dir/daemon <port_number>


than its work fine. I try use shell-script and run:

adb -s <device_name> shell sh su -c /dir/script.sh <port_number>


and I even try to generate script from Qt code with port number and use:

adb -s <device_name> shell sh su -c /dir/script.sh


but its not helped... problem that if I enter to adb shell previous to run daemon - its work. Another problem is on different device/emu/iso_image different command format could not work. For example:

adb -s <device_name> shell su -c /dir/daemon <port_number> // work at emu, but not at iso


and vice:

adb -s <device_name> shell su -c "/dir/daemon <port_number>" // work at iso


etc.

Everybody can answer what's the matter?

Sorry for my english

Answer
adb shell su -c "/dir > /dev/null 2> /dev/null < /dev/null &"

or

shell su -c /data/local/tmp/start_daemon.sh

#!/system/bin/sh
/data/local/tmp/nohup 
/data/local/tmp/daemon <portn_number> & 
Comments