• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Shell Script questions...(pretty basic I'd assume)

Dracconus

Android Enthusiast
First I'd like to say Hello to everyone that reads this as I'm sure many of you I don't know.
I'm Dracconus, and am frequent in the LG Connect 4G Section. I'm a budding *NIX developer with over 15 years of programming/game design/database administration experience for windows based applications/frameworks, and have decided it's time to switch...

That being said, I recently coded this simple shell script to disable, and enable the softkey lights on the LG Connect with a simple "toggle."

The only problem is that it still requires the scriptlayer terminals to run it, and for some reason they don't close automatically upon script completion.

So...

Is there a way to get the process name, and ID of the terminal application SManager (what we use to run the script) and close it, or at least leave it running in the BG, and return to homescreen?
I've typed everything i can think of into google, and haven't really found anything useful pertaining to this issue.

Also, is there a way to "lock" the screen (put the phone into sleep) upon script execution? This is necessary for the way this script works, because the lights will stay on/off until we lock the screen, then when we unlock it, they will be what the desired setting would be (off/on.)

Thanks for any help you can provide in advance.
Here's the source for what I'm working with right now.
Code:
#!/system/bin/sh
if [ -e /sys/class/leds/button-backlight/max_brightness ]; then
if [ `cat /sys/class/leds/button-backlight/max_brightness` -eq 0 ]
then
echo 15 > sys/class/leds/button-backlight/max_brightness
else
echo 0 > sys/class/leds/button-backlight/max_brightness
fi
fi

I have tried kill, KILL, exit, EXIT, close, CLOSE, and even kill PPID without a declaration pointing to the parent process (which apparently is necessary - saddening)
 
Back
Top Bottom