0

I am using adb commands to manage processes on android phone.

I am able to kill a specific process by the command

adb kill "PID"  (PID is the process ID)

and the process gets killed.

But when I start it using the command

adb start "PID"

It doesnt start the process.

And the process that I wish to start is in /system/bin folder and I dont know what the package or activity name is of that process. All I know is "PID" and "User" of the process.

Is there any command that starts a specific process on android device?

DeveloperLove
  • 567
  • 2
  • 8
  • 16

3 Answers3

3

Once you've killed the process corresponding to PID, how can you start it again?

You can instead try to launch an app from adb this way:-

adb shell
am start -n com.package.name/com.package.name.ActivityName

Or you can use this directly:

adb shell am start -n com.package.name/com.package.name.ActivityName
Rahul
  • 44,383
  • 11
  • 84
  • 103
  • The process that I am going to start is in /system/bin folder and I dont know the package name for that.. All I know is PID and user for that process – DeveloperLove Feb 21 '13 at 09:54
  • you can get the running app info using a `PID` [this](http://stackoverflow.com/a/8543401/2024761) way. After that, you can do what I suggested above. – Rahul Feb 21 '13 at 10:04
1

Native apps do not have activities. They are just that - native binaries.

If all you know is process' numeric ID - then ps <PID> command will show you the process binary's name in the NAME column. Like this:

# ps 407
USER     PID   PPID  VSIZE  RSS     WCHAN    PC         NAME
root      407   1     4540   272   ffffffff 000160a4 S /sbin/adbd

If PPID value is 1 - it means that it has been started by system init and more likely than not the app is a "service" app. To control it you need to find the service's name and then just use stop <service> and start <service>.

To find the service's name run grep ^service /init*rc | grep <binary name> the service's name will be in the second column (i.e. "adbd"):

# grep ^service /init*rc | grep /sbin/adbd
/init.rc:service adbd /sbin/adbd

So to properly control this app - you should use stop adbd and start adbd.

Alex P.
  • 30,437
  • 17
  • 118
  • 169
0

You said that you knew your binary is in /system/bin so I assume that you also know name of that binary file. In case you don't, that command will help you find out:

ps PID

To start a binaries (eg. uptime) you just have to type its name in shell:

adb shell
uptime

or in one command

adb shell uptime

but if your binary file isn't in one of the directories listed in $PATH you have to type whole path to it

adb shell /system/bin/uptime

you can check $PATH with:

adb shell echo $PATH
rav_kr
  • 434
  • 8
  • 16