su

Auto boot when wall charger is plugged

好久不见. 提交于 2019-11-27 20:36:45
I'm Developing an Android Application where it requireds 3 things:- To keep the App up an running for specific time and then phone will be off (Working Fine) When phone get charging from outlet, I want phone to power up automatically without hitting any power button. (Not Working with wall Socket, but working when connected to USB cable via Laptop). After boot my app should start working Automatically (Working Fine) You Must know :- My phone is Moto E (rooted) and want 2nd step to be done. Tried some codes but that does not work on moto E. When Connected with USB it gives 2 as response and

How to execute a group of commands as another user in Bash?

时间秒杀一切 提交于 2019-11-27 05:06:11
问题 There are already some existing questions asked here about running commands as another user. However, the question and answers focus on a single command instead of a long group of commands. For example, consider the following script: #!/bin/bash set -e root_command -p param1 # run as root # these commands must be run as another user command1 -p 'parameter with "quotes" inline' command2 -p 'parameter with "quotes" inline' command3 -p 'parameter with "quotes" inline' There are a couple of

Auto boot when wall charger is plugged [closed]

允我心安 提交于 2019-11-26 20:14:16
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 months ago . I'm Developing an Android Application where it requireds 3 things:- To keep the App up an running for specific time and then phone will be off (Working Fine) When phone get charging from outlet, I want phone to power up automatically without hitting any power button. (Not Working with wall Socket, but working

How do I use su to execute the rest of the bash script as that user?

北城以北 提交于 2019-11-26 19:25:32
I've written a script that takes, as an argument, a string that is a concatenation of a username and a project. The script is supposed to switch (su) to the username, cd to a specific directory based upon the project string. I basically want to do: su $USERNAME; cd /home/$USERNAME/$PROJECT; svn update; The problem is that once I do an su... it just waits there. Which makes sense since the flow of execution has passed to switching to the user. Once I exit, then the rest of the things execute but it doesn't work as desired. I prepended su to the svn command but the command failed (i.e. it didn't

How to run script as another user without password?

独自空忆成欢 提交于 2019-11-26 11:02:51
I have script.sh that must be run as user2. However, this script can only be run under user1 in my application. I would like the following command to run: su user2 -C script.sh but be able to run without password. I also want this to be very restrictive, as in user1 can only run script.sh under user2 and nothing else. I've tried doing this with sudoers file and just got endlessly confused after hours of trying. If somebody can provide an explicit example of how this can be accomplished (instead of something generic like use sudoers), it would be greatly appreciated. pyroscope Call visudo and

Read command output inside su process

北战南征 提交于 2019-11-26 08:14:02
问题 firstly I will present my situation. I need to execute \"su\" command in my android app and it works well. Then I need to execute \"ls\" command and read the output. I\'m doing it by getting the output stream from the \"su\" process and writing my command into it. And here goes the question. How to read the output of the \"ls\" process? All I have is the \"su\" Process object. Getting the input stream from it gives nothing, because \"su\" doesn\'t write anything. But \"ls\" does and I don\'t

How do I use su to execute the rest of the bash script as that user?

纵然是瞬间 提交于 2019-11-26 06:57:30
问题 I\'ve written a script that takes, as an argument, a string that is a concatenation of a username and a project. The script is supposed to switch (su) to the username, cd to a specific directory based upon the project string. I basically want to do: su $USERNAME; cd /home/$USERNAME/$PROJECT; svn update; The problem is that once I do an su... it just waits there. Which makes sense since the flow of execution has passed to switching to the user. Once I exit, then the rest of the things execute

Running Shell commands though java code on Android?

时光怂恿深爱的人放手 提交于 2019-11-26 03:38:32
问题 I\'ve got an app that\'s supposed to use some shell commands to copy a file from the sdcard to /system/media/. It will require root, and I am testing on a rooted device. I\'m using runtimes to execute the shell commands, but it\'s not working. Here\'s what I\'ve got for my runtimes public void RunAsRoot{String[] commands = {\"sysrw\", \"rm /data/local/bootanimation.zip\", \"sysro\"};{ Process p = Runtime.getRuntime().exec(\"su\"); DataOutputStream os = new DataOutputStream(p.getOutputStream()