Android .sh Scripting Help! - Xperia Play Q&A, Help & Troubleshooting

Hey Guys!
Im making a script and its called Lagg Nullififer (Click Me)
Its pretty cool and it speeds up android, but i want to make a temporary mode and a permanent mode (init.d) so i want the .sh script to make files on SDCard/Lagg_Nullifier (or any other folder) and i want the files to have the text in them!
EG:
.sh script makes file in sdcard then copys to system/etc/init.d
Please, Please, Please help as i cant find how to do this ANYWHERE!, Thankz in Advance!

Please write what you really want - just make and copy files is easy, but i think, that it isnt all u want...

Nuck-TH said:
Please write what you really want - just make and copy files is easy, but i think, that it isnt all u want...
Click to expand...
Click to collapse
Its what i really want to do,
I want the .sh script to make a file on the sdcard with information on it, then i want the .sh script to copy it to system/etc/init.d

Why not just make script create file directly in init.d?

Ok, I dunno how to, and how to make that script in init.d have text
Sent from my R800i using xda app-developers app

Pizza_Dox said:
Ok, I dunno how to, and how to make that script in init.d have text
Sent from my R800i using xda app-developers app
Click to expand...
Click to collapse
what about making a flashable zip that contains the script? it will extract directly to init.d
Sent from my Xperia Arc S using xda premium
---------- Post added at 08:43 PM ---------- Previous post was at 08:36 PM ----------
Pizza_Dox said:
Ok, I dunno how to, and how to make that script in init.d have text
Sent from my R800i using xda app-developers app
Click to expand...
Click to collapse
do you have any experience with unix scripting at all? I can help you
Sent from my Xperia Arc S using xda premium

Pizza_Dox said:
Hey Guys!
Im making a script and its called Lagg Nullififer (Click Me)
Its pretty cool and it speeds up android, but i want to make a temporary mode and a permanent mode (init.d) so i want the .sh script to make files on SDCard/Lagg_Nullifier (or any other folder) and i want the files to have the text in them!
EG:
.sh script makes file in sdcard then copys to system/etc/init.d
Please, Please, Please help as i cant find how to do this ANYWHERE!, Thankz in Advance!
Click to expand...
Click to collapse
I'm really confused as to what you want to do, but if I understand correctly, U want to make it temporary so if users reboots the script doesn't stick but if the user wants it to stick it will create a init.d rite??
And ye i would also ask have u any experience in scripting because this is pretty/verry easy
So basically for it to be temporary you just want to run the script, if u want it to stick after reboot you must place it in init.d folder or for lupus Kernels you could also place it in boot.d, dependinfg on wether u want it to run on BOOT or INIT.

wedgess said:
I'm really confused as to what you want to do, but if I understand correctly, U want to make it temporary so if users reboots the script doesn't stick but if the user wants it to stick it will create a init.d rite??
And ye i would also ask have u any experience in scripting because this is pretty/verry easy
So basically for it to be temporary you just want to run the script, if u want it to stick after reboot you must place it in init.d folder or for lupus Kernels you could also place it in boot.d, dependinfg on wether u want it to run on BOOT or INIT.
Click to expand...
Click to collapse
exactly
Sent from my Xperia Arc S using xda premium

I dont want to make a flashable zip, i want it to be like superchrager to make the files in init.d, , Heres what im trying to do for my mod, Thing is its really good, Honestly, Go try it out, If u dont like it just reboot
Here:
http://forum.xda-developers.com/showthread.php?t=2319774
Im trying to get 2 options to come up and say install in init.d or testdrive, testdrive will inject tweaks for current sesion and when u reboot they go away, and init.d will keep those tweaks and things,
Also if u want u can Be my partner in Lagg Nullifier,

wedgess said:
I'm really confused as to what you want to do, but if I understand correctly, U want to make it temporary so if users reboots the script doesn't stick but if the user wants it to stick it will create a init.d rite??
And ye i would also ask have u any experience in scripting because this is pretty/verry easy
So basically for it to be temporary you just want to run the script, if u want it to stick after reboot you must place it in init.d folder or for lupus Kernels you could also place it in boot.d, dependinfg on wether u want it to run on BOOT or INIT.
Click to expand...
Click to collapse
Yes thanks, someone understands,, lol, Yes, thing is i dident Learn, i just read alot of scripts and tested out a TONNE of different things and values i wanted to use in my script which is HERE
And its universal accros all devices so some might not have boot.d but init.d most of them will have, And thats what i want
I want to have 2 options and have one to make init.d files and one for temp (Temporary method is working fine now, )

Pizza_Dox said:
Yes thanks, someone understands,, lol, Yes, thing is i dident Learn, i just read alot of scripts and tested out a TONNE of different things and values i wanted to use in my script which is HERE
And its universal accros all devices so some might not have boot.d but init.d most of them will have, And thats what i want
I want to have 2 options and have one to make init.d files and one for temp (Temporary method is working fine now, )
Click to expand...
Click to collapse
I checked your script a while ago, and it needs a lot of improvements, you should add user privilege check to the script, and add a line to mount system with read/write permission. And also you should make the script a bit more aggressive and give the user some choices to pick. Unfortunately I don't have much time to do it myself, but I'll try to.
Anyway to make the script create another script in init.d with text in it it's really simple, here's an example:
echo #put your first command here# > system/etc/init.d/99LagNullifier
echo #put your second command here# >> system/etc/init.d/99LagNullifier
">" overwrites any old text in the file
">>" adds to the existing file
Sent from my Xperia Arc S using xda premium

Pizza_Dox said:
Yes thanks, someone understands,, lol, Yes, thing is i dident Learn, i just read alot of scripts and tested out a TONNE of different things and values i wanted to use in my script which is HERE
And its universal accros all devices so some might not have boot.d but init.d most of them will have, And thats what i want
I want to have 2 options and have one to make init.d files and one for temp (Temporary method is working fine now, )
Click to expand...
Click to collapse
Oh OK and not being smart but do u know wat each line of your script does. Because I have seen many users creating scripts and although the desired effect works there are parts which are not needed or the creator does not have a clue what they do. They just cram in awhole load of things which look or sound good. IM NOT SAYING THIS IS YOU.
I'm not at a PC rite now so can't look at your script. But seen as u don't want to make it a flashable zip, I would suggest something that maybe u could run via script manager or terminal like lupus menu. With a couple if options like set on every boot. Or run until reboot and say a check to make sure other init.D's do not conflict with yours. Just some suggestions.
Lol @Themike_10452 the below will probably confuse the hell out of him

inspire yourself with this code
clear ##clear the screen
echo ""
##check for root privilege
id=`id`; id=`echo ${id#*=}`; id=`echo ${id%%\(*}`; id=`echo ${id%% *}`
if [ "$id" = "0" ] || [ "$id" = "root" ]; then
echo "Root permission: Yes"
else
echo "Root permission: No"
echo ""
echo Please run the script with SU permission
sleep 3
exit 69
fi
if [ ! "`which busybox`" ]; then ##check for busybox
echo "Busybox found: No!"
sleep 3
exit 70
else
echo "Busybox found: Yes"
fi
echo ""
busybox mount -o remount,rw /system ## mounts system as r/w
#
#
#your actions here#
#
#
line=====================
m1k3="=== Themike10452 ==="
echo $line
echo $m1k3
echo $line
echo ""
echo Done!
echo ""
echo -n "Reboot now? (Y,N)"
read input ##read user input and store it in "input" variable
case $input in
y|Y) echo "" ##if answer is "y" or "Y" then ...
echo Your phone will now reboot
sleep 2
echo ""
echo ========== POOF! =========
sleep 1
reboot ;;
*) echo "" ##any other answer then ...
echo "So reboot manually later "
sleep 2
exit ;;
esac
Sent from my Xperia Arc S using xda premium

Omg, THANKZ alot!, , only problem is I'm not on PC, so I'll continue stuff latter
Sent from my R800i using xda app-developers app

Pizza_Dox said:
Omg, THANKZ alot!, , only problem is I'm not on PC, so I'll continue stuff latter
Sent from my R800i using xda app-developers app
Click to expand...
Click to collapse
alright hit thanks at least
Sent from my Xperia Arc S using xda premium
---------- Post added at 10:37 PM ---------- Previous post was at 10:30 PM ----------
wedgess said:
Lol @Themike_10452 the below will probably confuse the hell out of him
Click to expand...
Click to collapse
I'll try to clarify things as much as I can this is Unix after all
Sent from my Xperia Arc S using xda premium

I can't, got to 8 today, will do tmrw, and again thanks alot and I'll check out the code, I like the input part but the reboot and etc... I mostly knew about,
@wedgess, it diddent really confuse me, , lol
Sent from my R800i using xda app-developers app

Pizza_Dox said:
I can't, got to 8 today, will do tmrw, and again thanks alot and I'll check out the code, I like the input part but the reboot and etc... I mostly knew about,
@wedgess, it diddent really confuse me, , lol
Sent from my R800i using xda app-developers app
Click to expand...
Click to collapse
benefit from it as much as you can, I added some colors to make it look clearer
Sent from my Xperia Arc S using xda premium

Themike_10452 said:
I'll try to clarify things as much as I can this is Unix after all
Sent from my Xperia Arc S using xda premium
Click to expand...
Click to collapse
Oh u came back and edited it much easier for him now
Pizza_Dox said:
I can't, got to 8 today, will do tmrw, and again thanks alot and I'll check out the code, I like the input part but the reboot and etc... I mostly knew about,
@wedgess, it diddent really confuse me, , lol
Sent from my R800i using xda app-developers app
Click to expand...
Click to collapse
Good but I would still however look up some bash so u know exactly what's going on and how to fix it if u run into problems.
Ok I looked through your script quickly there... as mike said there is still alot of work to do. this is not ment as destructive criticism but constructive, to help you make it better, which i'm sure is what you want.
It can be cleaned up quite a bit. It looks like you took alot of other peoples scripts/tweaks and put them together with a lot of sleeps, which certainly will not be good... unless u run them in the background. Because device wont boot for a long time with them all, I think there is 3/4mins where script pauses. It will be fine in boot.d as it wont affect boot time but in init.d seems like a NO NO. also thigs like
Code:
/system/xbin/echo 1 > /proc/sys/vm/oom_kill_allocating_task
can simply be
Code:
echo 1 > /proc/sys/vm/oom_kill_allocating_task
or even better, I think its a good idea to create a variable for busybox say BB. I noticed on LuPuS script at the start certain commands would not work unless I had busybox before each command. I run my kernels busybox from /sbin, So would be
Code:
BB=/sbin/busybox
-- this way
Code:
$BB echo 1 > /proc/sys/vm/oom_kill_allocating_task
As I also mentioned u should place a check so your script will make sure any scripts already in init.d will not conflict. And if they do give the user option to overwrite or keep their current script or back it up.
edit - Crap u said u wanted it to be universal. So maybe better to check for busybox.
Code:
if [ -e /sbin/busybox ]; then
BB=/sbin/busybox
elif [ -e /system/xbin/busybox ]; then
BB=/system/xbin/busybox
elif [ -e /system/bin/busybox ]; then
BB=/system/bin/busybox
else
echo "No busybox found!"
fi

Thanks alot, for all the help guys! I'll get on working and just to clarify I took the base commands from Lenarox, Juwe11 & many others, tested them & modified alot to find the best combo and I added some of my Own Tweaks!,
Also with the whole sleeps thing I already know that it's not Good In init.d and so o was making it to
Just inject all commands
Also in the script their were alot of sleeps because this way it gives each tweak to settle in
Sent from my R800i using xda app-developers app

Ok I tried testing this:
(Thanks mike)
Code:
case $input in
y|Y) echo "Would You Like to Reboot Now?"
echo "Your phone will now reboot"
sleep 2
echo ""
echo "========== POOF! ========="
sleep 1
reboot ;;
*) echo "If You Dident Reboot Then..."
echo "Reboot Manually!"
sleep 2
exit ;;
esac
And it dosent work in smanager... Need some help with it,

Related

[ENG.DEV.] Sony Bravia Engine -DesZ- HQ IMAGE/MOVIE Quality Improvements

Hello guys i'm very happy to share with you this...BRAVIA ENGINE! Enjoy
I tell about this: video
IT's A Post-Processing Engine, so you can view the improvements only on your phone's screen...enjoy new quality!
1) GUIDE for Manual Installation on each Rom! (2.2 & 2.3)
-Download BraviaE Files Pack: HERE
-Extract files on phone and put they in the directory:
Code:
[B]/system/etc[/B]
-Open /system/build.prop with a text editor (like RootExplorer)
and add these lines at the end:
Code:
#Additional Tweaks by XxXPachaXxX
#Bravia Engine Service
ro.service.swiqi.supported=true
persist.service.swiqi.enable=1
-Then, Save the file and Exit
-Now, set the right permissions or open a terminal emulator and execute:
Code:
su
busybox chmod 0755 /system/etc/be_photo
busybox chmod 0755 /system/etc/be_movie
busybox chown 0.0 /system/etc/be_photo
busybox chown 0.0 /system/etc/be_movie
-Fully Reboot the device and enjoy BRAVIA
DOWNLOADS:::INFO:::SUPPORT
hi, I had tried but when I write on emulator "busybox chmod 0755 /system/etc/be_photo
" it replies to me "Busybox permission denied"!
which ROM is supported??
It's supposed to work only when viewing photos/vids?
If so, it seems to work for me. Contrast bumped a bit.
Unity 2.39 on European DZ, if anyone's interested.
Would be good if it's possible to add this BE toggle to settings, to disable/enable it on the fly (to compare the image quality, for ex.)
Thanks for your post.
edit: nope, it seems it doesn't work. got another dz to compare and there's absolutely no difference in image quality.
maybe some devs will get their hands on this thing?
Flashable zips ? 0_o where?
Sent from my HTC Vision using XDA App
Yeah I'd like the flash zip
Not into changing permission and crap. Too lazy
Also will it work on miui and cm7?
Sent from my HTC Vision using xda premium
TheUndertaker21 said:
Yeah I'd like the flash zip
Not into changing permission and crap. Too lazy
Also will it work on miui and cm7?
Sent from my HTC Vision using xda premium
Click to expand...
Click to collapse
Same xD Flashing a zip would be nicer than messing with permissions xD
Thanks for your work, but I've tried it and this makes no difference whatsoever.
I've installed it without a problem. I don't see very much difference between having it enabled or not, and installation is too cumbersome to maintain everytime I update to a new rom or nightly. Its cool, but too much hastle. Make it a flashable zip if you want more people to use it.
Not the biggest difference in the world. But it still looks really nice and it's a joy to use. I love it!
bruciato said:
hi, I had tried but when I write on emulator "busybox chmod 0755 /system/etc/be_photo
" it replies to me "Busybox permission denied"!
Click to expand...
Click to collapse
Type "su -", press enter, than type the busybox command.
Honestly, I'm not even sure if this even runs at all. Putting two files in /system/etc and adding 2 lines to build.prop doesn't seem to me that it makes anything run. I'm not 100% sure how build.prop works, so I might be wrong.
I've tried the fix on one G2 and compared to another G2 on the same picture, at the same time. Exact same picture quality, but then again, my eyes might not be good enough.
tsubus said:
Honestly, I'm not even sure if this even runs at all. Putting two files in /system/etc and adding 2 lines to build.prop doesn't seem to me that it makes anything run. I'm not 100% sure how build.prop works, so I might be wrong.
I've tried the fix on one G2 and compared to another G2 on the same picture, at the same time. Exact same picture quality, but then again, my eyes might not be good enough.
Click to expand...
Click to collapse
eyes might not be good enough? lol
If you cannot see the difference then obviously the quality change is insignificant enough to disregard the trouble of typing in all these commands
I applied this patch, but i have to say for me its also hard to see the difference... Is there any way to proof that its working?
Sent from my HTC Vision using XDA App
Stargazer418 said:
Type "su -", press enter, than type the busybox command.
Click to expand...
Click to collapse
no it was a problem with su..now works!But I can't see particular changes..
tsubus said:
Honestly, I'm not even sure if this even runs at all. Putting two files in /system/etc and adding 2 lines to build.prop doesn't seem to me that it makes anything run. I'm not 100% sure how build.prop works, so I might be wrong.
I've tried the fix on one G2 and compared to another G2 on the same picture, at the same time. Exact same picture quality, but then again, my eyes might not be good enough.
Click to expand...
Click to collapse
I agree. I can't tell a difference on video either. I CAN tell when Sony did it's demo but this... nada. I smell bs here. I doubt a rendering engine can be so small. It seems like these are just files that accompany an engine and not the full deal. The OP needs to come up with some proof that this sh!t runs because the consensus is that same everywhere he posts this: it doesn't do a thing!
This is a dev forum. But I have only seen one person reply with anything dev worthy. By that I mean what rom they are using. Just saying you ran this on a g2 or a DZ does not help anything. More info about what your running would be best to make this discussion worth anything.
Also. What video are you attempting to view? Something converted to the phones resolution? Video taken with the phone? A blueray 1080p rip? I see alot of *****ing but no info coming forth.
Sent from my HTC Vision using xda premium
ngc604 said:
This is a dev forum. But I have only seen one person reply with anything dev worthy. By that I mean what rom they are using. Just saying you ran this on a g2 or a DZ does not help anything. More info about what your running would be best to make this discussion worth anything.
Click to expand...
Click to collapse
it was me, lol
But ROM name/version won't help here IMO.
The files OP has uploaded are too small.
And the contents is quite strange. Not an ELF or any other binary. Maybe just a screen color profile, sort of ICC. But it won't work if we just put them onto phone.
There should be some service to manage all these things. Something from /system/lib or /system/framework. There's something about "swiqi" service in original post, but there's no file for this.
Why should our rom just use files put to /etc?
So I'm guessing it won't work... maybe just yet
NeverGone\RU said:
it was me, lol
But ROM name/version won't help here IMO.
The files OP has uploaded are too small.
And the contents is quite strange. Not an ELF or any other binary. Maybe just a screen color profile, sort of ICC. But it won't work if we just put them onto phone.
There should be some service to manage all these things. Something from /system/lib or /system/framework. There's something about "swiqi" service in original post, but there's no file for this.
Why should our rom just use files put to /etc?
So I'm guessing it won't work... maybe just yet
Click to expand...
Click to collapse
that's what I was saying... there are no lib files or any type of an engine to run this overlay. It doesnt work that way.
Is there a flash able zip for cm7.1 stable.?? If solo can someone please pm me please !
Sent from my HTC Vision using XDA App

[GUIDE]HOW to make init.d work......not use custom kernel(sorry if my word is wrong)

Hey guys, i'am newbie in XDA I just want directory init.d work and not use custom kernel....its just simple code..
you just put the code:
# init.d support
busybox run-parts /system/etc/init.d/
In >install-recovery.sh< in directory /system/etc, click instal-recovery.sh and click execute, and you will be get
Init.d work..
________________
YOU CAN TEST INIT.D with 99test(create a new file in /system/etc/init.d
And gift name 99test or other...
And this the code:
( #!/system/bin/sh
touch /data/local/tmp/init.d_log_test.txt
echo "done" >> /data/local/tmp/init.d_log_test.txt
),
If have file :
init.d_log_test.txt in
/data/local/temp/
Init.d its work
__________
NOTE: you must have BUSYBOX, you can execute instal-recovery.sh again if 99test not work
Ok, good luck
Sorry if my english so bad
Sent from my GT-S5360 using XDA
shoutokuyaki said:
Hey guys, i'am newbie in XDA I just want directory init.d work and not use custom kernel....its just simple code..
you just put the code:
# init.d support
busybox run-parts /system/etc/init.d/
In >install-recovery.sh< in directory /system/etc, click instal-recovery.sh and click execute, and you will be get
Init.d work..
________________
YOU CAN TEST INIT.D with 99test(create a new file in /system/etc/init.d
And gift name 99test or other...
And this the code:
( #!/system/bin/sh
touch /data/local/tmp/init.d_log_test.txt
echo "done" >> /data/local/tmp/init.d_log_test.txt
),
If have file :
init.d_log_test.txt in
/data/local/temp/
Init.d its work
__________
NOTE: you must have BUSYBOX, you can execute instal-recovery.sh again if 99test not work
Ok, good luck
Sorry if my english so bad
Sent from my GT-S5360 using XDA
Click to expand...
Click to collapse
I ran this
# init.d support
busybox run-parts /system/etc/init.d/
and I guess it ran cuz I got a wall of text. But the 99test didn't execute. But there was a init.d_log_test.txt in /data/local/tml/
So does that mean its working or that it was ALREADY working?
sorry brother but i have already made a thread about this in dev section...
it won't work.
hell_lock said:
sorry brother but i have already made a thread about this in dev section...
Click to expand...
Click to collapse
Sorry if I repost
Sent from my GT-S5360 using XDA
raolemo said:
I ran this
# init.d support
busybox run-parts /system/etc/init.d/
and I guess it ran cuz I got a wall of text. But the 99test didn't execute. But there was a init.d_log_test.txt in /data/local/tml/
So does that mean its working or that it was ALREADY working?
Click to expand...
Click to collapse
Yeah sure..
Sent from my GT-S5360 using XDA
delete /data/local/temp/init.d_log_test.txt then reboot the phone. please check if we could find the same file after reboot.
kurotsugi said:
it won't work.
Click to expand...
Click to collapse
why it will not work? please give me a clue where the fault
Sent from my GT-S5360 using XDA
kurotsugi said:
delete /data/local/temp/init.d_log_test.txt then reboot the phone. please check if we could find the same file after reboot.
Click to expand...
Click to collapse
follow above test. please confirm the result
kurotsugi said:
follow above test. please confirm the result
Click to expand...
Click to collapse
Ok I will try...
Sent from my GT-S5360 using XDA

[Q] init.d Help

I am having problems with an init.d script I have made for myself. I am using Script Manager to make sure it has correct syntax and what not. However I keep receiving this error:
Code:
Command:
'/etc/init.d/99tweaks'
-------------
Out:
bin/sh '/etc/init.d/99tweaks' <
/etc/init.d/99tweaks[3]: can't create /sys/kernel/debug: Permission denied/autocomp
/etc/init.d/99tweaks[4]: can't create /sys/class/misc/c: No such file or directory
/etc/init.d/99tweaks[6]: can't create /sys/kernel/debug: Permission denied/autocomp
/etc/init.d/99tweaks[7]: can't create /sys/class/misc/c: No such file or directory
/etc/init.d/99tweaks[9]: can't create /sys/kernel/debug: Permission deniede/autocomp
Apparently just the mpu voltages are getting through, and nothing else. Do I have to keep changing permissions to allow for writting? I am going to continue to research, but it came to mind to post this on Q&A just in case someone knew a solution. I am using franco.Kernel in the case I might be using the wrong paths, but I doubt it because I can run each line individually however I do not want to make 6 single line init.d scripts unless that is the only solution.
This is the init.d script:
Code:
#!/system/bin/sh
# mpu
echo 0 > /sys/kernel/debug/smartreflex/sr_mpu/autocomp
echo "1450 1425 1400 1300 1225 1175 1150 1100 1000 800" > /sys/class/misc/customvoltage/mpu_voltages
# iva
echo 0 > /sys/kernel/debug/smartreflex/sr_iva/autocomp
echo "1050 1050 850 850" > /sys/class/misc/customvoltage/iva_voltages
# core
echo 0 > /sys/kernel/debug/smartreflex/sr_core/autocomp
echo "1000 800 800" > /sys/class/misc/customvoltage/core_voltages
This is going to sound like a "no duh" question, but did you run the script with root?
Sent from my Galaxy Nexus using Tapatalk 2
Yeah, I did. I've never been able to get multiple line init.d scripts to work. I don't know if it's a syntax issue or something else.
Sent from my Galaxy Nexus using Tapatalk 2
What did you write the script with? I.e. was it written in windows with notepad?
Sent from my Galaxy Nexus using Tapatalk 2
I used notepad++.
Sent from my Galaxy Nexus using Tapatalk 2
OK, did you make sure to tell it the language was bash, and the follow UNIX line endings instead of windows?
Try copying a currently working init.d and then modifying it to what you're trying to accomplish and see if it works that way.
Sent from my Galaxy Nexus using Tapatalk 2
geoffcorey said:
OK, did you make sure to tell it the language was bash, and the follow UNIX line endings instead of windows?
Try copying a currently working init.d and then modifying it to what you're trying to accomplish and see if it works that way.
Sent from my Galaxy Nexus using Tapatalk 2
Click to expand...
Click to collapse
Nice catch. Indeed, try setting the control character to LF only (Windows uses CR + LF).
Ah that might be the problem. I'll try to do so when I get home later.
Sent from my Nexus 7 using Tapatalk 2
I got it fixed! The problem was the CFLR endings. The init.d guide I read a while back never talked about line endings, so I was at a loss to begin with. I guess I should research more UNIX next time I have init.d problems. Thanks to the both of you for the help.
maeriooo said:
I got it fixed The problem was the CFLR endings. The init.d guide I read a while back never talked about line endings, so I was at a loss to begin with. I guess I should research more UNIX next time I have init.d problems. Thanks to the both of you for the help.
Click to expand...
Click to collapse
Nice you got it working. :good:

[Q] setting apps oom value using terminal emulator?

just asking,is there a way to set the oom value of certain apps using terminal emulator or any other alternative?im using autokiller memory optimizer apps and it kill the messaging apps due to its high value of oom.is there a way to lower it since this app dont hv that function(it does hv but temporarily).already did some research and found a similiar thread in xda but the respondents suggested using other apps to lower the oom(e.g system tuner pro,supercharger,automemomry manager).im curious if lowering the oom can be achieve with just using terminal emulator.thank you in advance
su
echo $new_oom_adj > /proc/$pid_of_process/oom_adj
The problem is finding the $pid_of_process , and that's your homework
Sent from my GT-I8150 using xda app-developers app
pepoluan said:
su
echo $new_oom_adj > /proc/$pid_of_process/oom_adj
The problem is finding the $pid_of_process , and that's your homework
Sent from my GT-I8150 using xda app-developers app
Click to expand...
Click to collapse
thanks..will search for it..btw noticed u upgraded to cm9 rc2.
pepoluan said:
su
echo $new_oom_adj > /proc/$pid_of_process/oom_adj
The problem is finding the $pid_of_process , and that's your homework
Sent from my GT-I8150 using xda app-developers app
Click to expand...
Click to collapse
thanks..will search for it..btw noticed u upgraded to cm9 rc2.
edit:
did the finding,the pid is 2103 but how do i type it?is it like this?(em.dont quite understand when to enter)
su
echo $new_oom_adj > /proc/2103/oom_adj
edit: or should it be like this?
su
echo -8 > /proc/2103/oom_adj
afif_7070 said:
thanks..will search for it..btw noticed u upgraded to cm9 rc2.
Click to expand...
Click to collapse
Yup
@dewadg's Kernel is perfect for me :thumbup:
afif_7070 said:
did the finding,the pid is 2103 but how do i type it?is it like this?(em.dont quite understand when to enter)
su
echo $new_oom_adj > /proc/2103/oom_adj
edit: or should it be like this?
su
echo -8 > /proc/2103/oom_adj
Click to expand...
Click to collapse
The second one.
$new_oom_adj was just a placeholder because I didn't know what value exactly you want to set it to...
Sent from my GT-I8150 using xda app-developers app
pepoluan said:
Yup
@dewadg's Kernel is perfect for me :thumbup:
The second one.
$new_oom_adj was just a placeholder because I didn't know what value exactly you want to set it to...
Sent from my GT-I8150 using xda app-developers app
Click to expand...
Click to collapse
thanks.luckily i rememberd those code that u type in the apk seeder thread..another thing i wanna ask is the pid sometimes changing.so is the oom adj still applied? to be precise if i already set with pid=2103, then i run tm to kill that apps,once i run the apps again n check the pid thru tm the pid changed..(sorry for my bad english)
afif_7070 said:
thanks.luckily i rememberd those code that u type in the apk seeder thread..another thing i wanna ask is the pid sometimes changing.so is the oom adj still applied? to be precise if i already set with pid=2103, then i run tm to kill that apps,once i run the apps again n check the pid thru tm the pid changed..(sorry for my bad english)
Click to expand...
Click to collapse
yes, you have to search for the right PID after every boot.
If you know the exact package name (e.g., com.yadda.yadda.yadda), you can easily pgrep for it. Example script:
Code:
#!/system/bin/sh
targproc=com.yadda.yadda.yadda
targoom=-8
targpid="$(pgrep $targproc)" || exit 1
for p in $targpid; do
echo $targoom > /proc/$p/oom_adj
done
Sent from my GT-I8150 using xda app-developers app
pepoluan said:
yes, you have to search for the right PID after every boot.
If you know the exact package name (e.g., com.yadda.yadda.yadda), you can easily pgrep for it. Example script:
Code:
#!/system/bin/sh
targproc=com.yadda.yadda.yadda
targoom=-8
targpid="$(pgrep $targproc)" || exit 1
for p in $targpid; do
echo $targoom > /proc/$p/oom_adj
done
Sent from my GT-I8150 using xda app-developers app
Click to expand...
Click to collapse
lol.its become more complicated.but thanks alot.
edit:
didnt understand this part,for example: pid=2103
targpid=2103(pgrep com.yada.yada.yada) || exit 1
for p in 2103; do echo -8 > proc/p/oom_adj done
?is it correct?im really sorry coz i dont understand bout doing script.
afif_7070 said:
lol.its become more complicated.but thanks alot.
edit:
didnt understand this part,for example: pid=2103
targpid=2103(pgrep com.yada.yada.yada) || exit 1
for p in 2103; do echo -8 > proc/p/oom_adj done
?is it correct?im really sorry coz i dont understand bout doing script.
Click to expand...
Click to collapse
#!/system/bin/sh
targproc=com.yadda.yadda.yadda
targoom=-8
targpid="$(pgrep $targproc)" || exit 1
for p in $targpid; do
echo $targoom > /proc/$p/oom_adj
done
the thing you need to set there is the targproc and the targoom value. com.yada.yada is only example. the problem we have here is we don't know the pid because it's changing like variable in algebra so the command
Code:
targproc=com.yadda.yadda.yadda
targoom=-8
targpid="$(pgrep $targproc)" || exit 1
is needed to find the pid of the process you want. the real code is
Code:
for p in $targpid; do
echo $targoom > /proc/$p/oom_adj
done
CMIIW

[MOD][5/10/13] Add init.d support to your ROOTED S4

First off, I did not come up with this idea but I adapted it from smokin1337 and his thread: [MOD] EZ InitD - init.d the EZ way !!
How to make it work...
Take file in the attached zip and use your favorite root explorer and paste it in /system/etc/ overwriting the file that is there.
Set permissions of the file to be rwx, rx, rx
Create an init.d folder inside of /system/etc and set permisions to rwx, rx, rx
Add init.d scripts and make sure they are also set to rwx, rx, rx.
Reboot and enjoy your init.d scripts!
All credits to smokin1337 for the mod, I just added the line to our postboot.sh.
I tested it and it works as it should :good:
Enjoy!
-Scott
EDIT: Changed the permissions of the scripts to 755 from 777 to guard against possible malware. Info courtesy of jcase.
Just a note, I use ES File Explorer to do this but any root level explorer should work. I just use ES because I am familiar with it.
Some init.d scripts can rely upon the use of BusyBox so install that from the market.
Sorry for the stupid question but what does this actually do.
What can I get out of it if I install it?
Sent from my SAMSUNG-SGH-I337 using xda app-developers app
azz72 said:
Sorry for the stupid question but what does this actually do.
What can I get out of it if I install it?
Sent from my SAMSUNG-SGH-I337 using xda app-developers app
Click to expand...
Click to collapse
Good question... If you have to ask it then this is not something for you. Haha, Just kidding... But seriously..
Basically init.d scripts are scripts that run when the phone boots up. You can make them do various things like setting system level tweaks, cleaning and purgin databases, and on and on and on...
In the ROMS I build I use an init.d script that remounts the file system more efficiently (in theory anyways) but there are other uses for init.d scripts.
A real popular one is called "V6 Supercharger" Its a collection of scripts that are designed to really tweak out the operating system for the supreme performance (once again, debatable).
There are other things that could be done... If your familiar with old school computing and you know autoexec.bat this is basically that for Android.
-Scott
Gotcha
Ive tried the super charger v6 for my htc inspire a long time ago couldnt tell if it worked or not so I kinda got what ur saying.
Thanks for clearing it up for me
azz72 said:
Gotcha
Ive tried the super charger v6 for my htc inspire a long time ago couldnt tell if it worked or not so I kinda got what ur saying.
Thanks for clearing it up for me
Click to expand...
Click to collapse
Yeah, no problem at all.
scrosler said:
Good question... If you have to ask it then this is not something for you. Haha, Just kidding... But seriously..
Basically init.d scripts are scripts that run when the phone boots up. You can make them do various things like setting system level tweaks, cleaning and purgin databases, and on and on and on...
In the ROMS I build I use an init.d script that remounts the file system more efficiently (in theory anyways) but there are other uses for init.d scripts.
A real popular one is called "V6 Supercharger" Its a collection of scripts that are designed to really tweak out the operating system for the supreme performance (once again, debatable).
There are other things that could be done... If your familiar with old school computing and you know autoexec.bat this is basically that for Android.
-Scott
Click to expand...
Click to collapse
Thanks for the explanation i really needed too before perform this mod thanks
elvin9 said:
Thanks for the explanation i really needed too before perform this mod thanks
Click to expand...
Click to collapse
Yeah, this mod is not your ordinary mod. Most people will never use this type of mod.... Or they do use it in the custom ROM they use and never even know about what it does.
Try using 755 instead of 777, otherwise you are opening yourself up to potential problems.
scrosler said:
First off, I did not come up with this idea but I adapted it from smokin1337 and his thread: [MOD] EZ InitD - init.d the EZ way !!
How to make it work...
Take file in the attached zip and use your favorite root explorer and paste it in /system/etc/ overwriting the file that is there.
Set permissions of the file to be rwx, r, r
Create an init.d folder inside of /system/etc and set permisions to rwx, rwx, rwx
Add init.d scripts and make sure they are also set to rwx, rwx, rwx.
Reboot and enjoy your init.d scripts!
All credits to smokin1337 for the mod, I just added the line to our postboot.sh.
I tested it and it works as it should :good:
Enjoy!
-Scott
Click to expand...
Click to collapse
jcase said:
Try using 755 instead of 777, otherwise you are opening yourself up to potential problems.
Click to expand...
Click to collapse
Responded in updater script thread.
So do we have to find make scripts I'm assuming this just set up the device to work with the scripts
Sent from my SAMSUNG-SGH-I337 using Tapatalk 2
DJsCrIBbLe said:
So do we have to find make scripts I'm assuming this just set up the device to work with the scripts
Sent from my SAMSUNG-SGH-I337 using Tapatalk 2
Click to expand...
Click to collapse
Right, exactly.
You can peruse the forums and find your favorite "battery saving" and "super charger" scripts.
Gotcha thanks .
Sent from my SAMSUNG-SGH-I337 using Tapatalk 2
I've discovered the same thing you achieve here before, when i was trying to create a swap internal SD for the external, but unfortunately it didn't work, i used your rom on my old Note 2, it was amazing hope to see CleanROM for this one. Thanks for publishing this.
juanyunis said:
I've discovered the same thing you achieve here before, when i was trying to create a swap internal SD for the external, but unfortunately it didn't work, i used your rom on my old Note 2, it was amazing hope to see CleanROM for this one. Thanks for publishing this.
Click to expand...
Click to collapse
Yeah, I am starting to grow frustrated. Hopefully soon!

Categories

Resources