yashsingh1/xdaforums huggingface dataset:
[Android General] Paget96:
#!/system/bin/sh

mount -o remount,rw /sys

chmod 0666 /sys/devices/system/cpu/cpu0/opp_table

echo 307200000 610000 > /sys/devices/system/cpu/cpu0/opp_table
echo 422400000 630000 >> /sys/devices/system/cpu/cpu0/opp_table
echo 480000000 635000 >> /sys/devices/system/cpu/cpu0/opp_table
echo 556800000 645000 >> /sys/devices/system/cpu/cpu0/opp_table
echo 652800000 665000 >> /sys/devices/system/cpu/cpu0/opp_table
echo 729600000 670000 >> /sys/devices/system/cpu/cpu0/opp_table
echo 844800000 685000 >> /sys/devices/system/cpu/cpu0/opp_table
echo 960000000 715000 >> /sys/devices/system/cpu/cpu0/opp_table
echo 1036800000 730000 >> /sys/devices/system/cpu/cpu0/opp_table
echo 1113600000 750000 >> /sys/devices/system/cpu/cpu0/opp_table
echo 1190400000 770000 >> /sys/devices/system/cpu/cpu0/opp_table
echo 1228800000 775000 >> /sys/devices/system/cpu/cpu0/opp_table
echo 1324800000 805000 >> /sys/devices/system/cpu/cpu0/opp_table
echo 1401600000 830000 >> /sys/devices/system/cpu/cpu0/opp_table
echo 1478400000 850000 >> /sys/devices/system/cpu/cpu0/opp_table
echo 1593600000 880000 >> /sys/devices/system/cpu/cpu0/opp_table
echo 1728000000 885000 >> /sys/devices/system/cpu/cpu0/opp_table

chmod 0666 /sys/devices/system/cpu/cpu1/opp_table

echo 307200000 610000 > /sys/devices/system/cpu/cpu1/opp_table
echo 422400000 630000 >> /sys/devices/system/cpu/cpu1/opp_table
echo 480000000 635000 >> /sys/devices/system/cpu/cpu1/opp_table
echo 556800000 645000 >> /sys/devices/system/cpu/cpu1/opp_table
echo 652800000 665000 >> /sys/devices/system/cpu/cpu1/opp_table
echo 729600000 670000 >> /sys/devices/system/cpu/cpu1/opp_table
echo 844800000 685000 >> /sys/devices/system/cpu/cpu1/opp_table
echo 960000000 715000 >> /sys/devices/system/cpu/cpu1/opp_table
echo 1036800000 730000 >> /sys/devices/system/cpu/cpu1/opp_table
echo 1113600000 750000 >> /sys/devices/system/cpu/cpu1/opp_table
echo 1190400000 770000 >> /sys/devices/system/cpu/cpu1/opp_table
echo 1228800000 775000 >> /sys/devices/system/cpu/cpu1/opp_table
echo 1324800000 805000 >> /sys/devices/system/cpu/cpu1/opp_table
echo 1401600000 830000 >> /sys/devices/system/cpu/cpu1/opp_table
echo 1478400000 850000 >> /sys/devices/system/cpu/cpu1/opp_table
echo 1593600000 880000 >> /sys/devices/system/cpu/cpu1/opp_table
echo 1728000000 885000 >> /sys/devices/system/cpu/cpu1/opp_table
[Android General] patalao:
Forgot the space between... rw /sys.

But still gives me read only error.

Even putting the file to system and set rw permissions its the same.
[Android General] Paget96:
ask your developer, does it possible to change parameters.
[Android General] patalao:
I'm using OP3 with stock OxygenOS.

On Stock it as the stock values but on CM the values are different.

So it should be able to be changed.
[Android General] adewisman:
[MENTION=5514152]Paget96[/MENTION] is this http://pubs.opengroup.org/onlinepubs/009695399/utilities/contents.html the same language?
[Android General] Paget96:
Can you change them with kernel adiutor?

After changing, check file with file manager, does it really set your changes. Then you'll know is it possible to change or not :)

Yes, all the commands.
[Android General] slimcyril:
[MENTION=5514152]Paget96[/MENTION] Please I need your help, if I open the camera of my SCH-I535 running 4.4.2 the phone freezes then restarts, the same thing happens if I played any videos wherever.
[Android General] Paget96:
Change your rom.
[Android General] slimcyril:
As u advised I changed the rom to Superlite rom & the issue was gone [emoji4]
[Android General] slimcyril:
[MENTION=5514152]Paget96[/MENTION] please the link below contains a cron script that has ran flawlessly on all the device I had ever own & what I loved about this script is the capability of integrating scripts I wanted to run on schedule but after changing roms as u earlier advised the camera & video crashes was fixed but this script failed to run, please take a look at it & see what u can do to make it work in the new rom?

As we know you are one the best if not the best scripter on xda that's still with us.

http://xdaforums.com/showthread.php?t=2700146
[Android General] Paget96:
Last time i tried it (was when i had L7) cron had a problems. Will do some test later, and will see what can i do.

Thank you :)
[Android General] BRoy_98:
Hi [MENTION=5514152]Paget96[/MENTION], I am writing a script and stuck on a problem. I want to do something like this:

I have a String "[ABC]XYZ[ABC]" in a txt file. The XYZ can be anything unknown. I want to find this string on the file and add a String with it like this: [ABC]XYZ ADDITION[ABC]. Is it possible to do with a shell script?
[Android General] Paget96:
It's possible with grep or sed on Linux, but since android have simpler commands with less options i think it isn't :/

I'll try later to day to find a way and post here. If that is not a problem. ;)
[Android General] BRoy_98:
Actually this is not for android device. It is for a PC running a linux OS. So, please tell me the way to do it. Thanks.
[Android General] Paget96:
http://stackoverflow.com/questions/15635321/get-string-between-two-special-characters
[Android General] slimcyril:
[MENTION=5514152]Paget96[/MENTION] Please could u provide me with a flashable to enable init.d support. I remember u had/made one in the past?
[Android General] D1kiy:
Hello. I have question about this script:

#!/system/bin/sh
busybox chmod 644 /proc/sys/vm/*
busybox sysctl -e -w vm.dirty_background_ratio=3
busybox sysctl -e -w vm.dirty_ratio=15
busybox sysctl -e -w vm.swappiness=40
busybox sysctl -e -w vm.dirty_expire_centisecs=500
busybox sysctl -e -w vm.dirty_writeback_centisecs=3000
busybox sysctl -e -w vm.min_free_kbytes=4096
busybox sysctl -e -w vm.overcommit_memory=1
busybox sysctl -e -w vm.overcommit_ratio=75
busybox sysctl -e -w vm.page-cluster=0

As I understand after placement this script in init.d, it changes some options of system files during boot. But why I need this file after that? Are this options change to default after every boot?

If so, can I return to my default options just with deleting this file from init.d and rebooting?
[Android General] Paget96:
After rebooting, kernel will load defaults, so you need a script to overwrite them.
[Android General] zputnyq:
Hi [MENTION=5514152]Paget96[/MENTION] I'm confused about init.d folder's permission. What is the correct permission for it, is it 755 or 777 because first time I made it, it automatically showed 777 but then it changed to 755?
[Android General] Paget96:
You can set any perm, there isn't correct one.
[Android General] DEVILOPS 007:
I'm not sure if I missed it as there is so much but could someone point me in the direction of being able to add busybox commands to a mod just like what govtuner does with the battery, balanced and performance options accessible through a terminal emulator like termux. Thanks a lot.
[Android General] Scarr3:
Screen of script

Hi guys, I have a litle problem when my screen is turned off. My minimum CPU frequency is changed from 200Mhz to 400mhz when my screen is off and that's always drives me crazy. I don't want to use a tasker to do it since it cost me memory that I spend much to save, so I am here to ask if I can use a simple script to change my minimum CPU frequency to 200mhz when my screen is turned OFF. I had used the app "tasker" and put it to set my min freq to 200mhz when the screen go off and it worked just fine, I guess this clue could help to make a workaround for this problem. I guess that "powerHAL" is changing my freq when screen is off but I don't know how to fix this properly. Any advice?
[Android General] zputnyq:
U can use governor tuner or L Speed to minimize your cpu frequency. Here are the links

Governor tuner

https://xdaforums.com/android/software-hacking/mod-gov-tuner-project-29th-june-2016-t3407828

L Speed

https://xdaforums.com/apps/l-speed/tweak-l-speed-v1-0-02-02-2015-t3020138
[Android General] Scarr3:
Thanks for your reply bro. But I already use "L speed" and this other mod you list do a lot more than I need, it could touch things that I don't want to he touched since I search for his changes and found nothing detailed of which are those changes. I really need a script to run as a workaround or if someone know how, a way to stop whatever is changing my minimum CPU frequency. One more thing, the same service that is changing my minimum CPU frequency is also changing my target loads to default (90), but since Is more energy efficient to the target loads be at 90 I don't mind it. Thanks a lot for you reply.
[Android General] zputnyq:
Probably u can use KA or setcpu to set the min cpu freq or u can create init.d script to set it but u must know the path for your device cpu min freq but your device must have init.d support.

Somehow, KA & setcpu can cause the issue that u have experienced too (I experienced it w/ those two apps). If it's so, using init.d can be the alternative. To grab your device's path for cpu min freq u can use KA. The first u have to set cpu min freq using KA then enable activate on boot. The Second, look at KA's on boot tab, there u will find the path for your cpu min freq.

For the script, the script usually look like this

#!/system/bin/sh

echo 500000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq

echo 500000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq

However, u have to edit the number to suit your need.
[Android General] Mizan_Rifat:
Hello,can anyone tell me what is the shell script for installing an app???
[Android General] Zobat:
adb instal blabla. apk from a computer does that.
[Android General] lightjoe:
Chmod permission 644, and 755

hi paget, thanks for your guide :) :).

And i have a question about changing permission using chmod, because i can't change permission from 660/644 to 755 using command (busybox chmod 755 /path).

And i also try to make it flashabel with 755, and after i flash, it back again to 644 , so how to make it automatically, because i only change it using app :).

thank you :) :)
[Android General] Zobat:
did you do su?
[Android General] lightjoe:
of course dude, but it still change to 644/660
[Android General] Paget96:
change it without busybox, use just chmod.
[Android General] Paget96:
Hahah, ok mate :D

No problem for that ;)
[Android General] MSF Jarvis:
IMO writing busybox before each applet and passing args isn't required. I mean yeah everything is symlinked to that single busybox binary, but they also exist independently. You can do cat /proc/meminfo without any errors.
[Android General] Paget96:
For sure that you can :)

We can call busybox "toolbox" ;) heheh
[Android General] Black_Eyes:
You know busybox for Xperia Devices is different than default...

It is necessary for Dual recovery to work ?

"You know, My aircraft is on fire ?"
[Android General] MSF Jarvis:
Didn't, what sort of differences are we talking about???
[Android General] Paget96:
How do you mean "dual recovery" ?? :)
[Android General] Black_Eyes:
Have a look here

http://xdaforums.com/showthread.php?t=2261606

"You know, My aircraft is on fire ?"
[Android General] Paget96:
If I understand that is recovery problem and it cannot work if other busybox is installed?? Right?
[Android General] Black_Eyes:
Yes, you get it right.

"You know, My aircraft is on fire ?"
[Android General] Paget96:
What is "special" it that busybox which is on xperia??

What is the difference? :)
[Android General] Black_Eyes:
It does contain some special modification, to run Recovery on FOTA partition because Sony doesn't allow a separate partition for recovery to avoid users brick their devices

"You know, My aircraft is on fire ?"
[Android General] Paget96:
Interesting, also interesting idea by sony drvelopers, ok thanks for the info about xperia devices. :)
[Android General] Black_Eyes:
[emoji2]

"You know, My aircraft is on fire ?"
[Android General] MSF Jarvis:
Another command : df, probably not that useful but nifty none the less. Cheers to [MENTION=5941794]anonymous-user[/MENTION] to telling me about it [emoji16] [emoji16] [emoji16]
[Android General] Paget96:
Heh :D i know for that command, only problem is there we can use it only for printing that ;)
[Android General] Black_Eyes:
I've used it on my Pico few years ago ?

Very much explanatory for memory info.

"You know, My aircraft is on fire ?"
[Android General] MSF Jarvis:
Trial Run :):):):)
[Android General] Paget96:
You first created file, then make an output from it with cat, but nothing appears because file is empty and then you make an basic output with echo.

Try next

touch /sdcard/test.log

echo "Hello Paget96" > /sdcard/test.log

Then you can use only cat, it will print Hello Paget96. If you run this with sh you will not get an output.

Btw, hello to you too ;)
[Android General] MSF Jarvis:
I did that command afterwards but probably you missed it coz it's split b/w two lines.

---------- Post added at 04:11 AM ---------- Previous post was at 04:07 AM ----------

I wrote this script but there's an error in the sleep command. I did a cat on it so you can see the whole script

Don't bother, I figured out my mistake.
[Android General] Paget96:
In sleep, remove "( )". :D

You don't need, put just sleep 5
[Android General] MSF Jarvis:
Actually i was a bit confused coz updater scripts have brackets with sleep command. Anyway, i wanted to know if there's a way to log the output of any command into a file if the command doesn't have this feature already. Like logcat has -f parameter to print output to a file, can that be used with df or is there any other way to do it.
[Android General] Paget96:
You need to make difference between updater-script and this :D

There is no logging like this, you need to make it :)

I will show you

LOG=/sdcard/scriptlog.log - to explain this line, LOG is a "variable" next to it is a destination.

busybox echo "write a comment here" | tee -a $LOG

You can use this line after every where you want to have output to a file. :)

Example:

LOG=/sdcard/scriptlog.log

busybox echo "Hello world"
busybox echo "Hello world is printed" | tee -a $LOG
busybox echo "Whats up???"
busybox echo "Whats up is printed" | tee -a $LOG

You will get a print on the terminal window and this lines, "new lines" which you see will make an output to a file. FIRST MAKE A FILE "scriptlog.log" on sdcard ;)

If you have more questions, ask :)
[Android General] MSF Jarvis:
Text logging is fine, but I want to log the output from the df command into a .log file....
[Android General] Paget96:
Ohh you mean that, simple :)

su
df > /sdcard/storage.log

for example
[Android General] MSF Jarvis:
Thanks a bunch, it works !!!![emoji1] [emoji1] [emoji1] [emoji1] [emoji1]
[Android General] Paget96:
No problem, to avoid Permission denied type

su

first.

Everything what you want to print to a file, use

thing > /output/file
[Android General] MSF Jarvis:
Yeah I do that on my Pico, but this one's non rooted(No use of rooting, no custom Roms, no custom recoveries, XPOSED doesn't work)
[Android General] Paget96:
Today, I will add more things.

How to make variables, how to use them trough the script, how to make logging trough the script and maybe something more, I will see :)

After all of that we will go to advanced stuff and system tweaking :)
[Android General] Paget96:
Ok mate :)

You can root it if you want with kingo root, there is an apk file, you don't need a pc to root it ;)
[Android General] MSF Jarvis:
Dying to see it[emoji16] [emoji16] [emoji16]

---------- Post added at 08:26 AM ---------- Previous post was at 08:25 AM ----------

I had rooted it that way, but I had to claim warranty due to a De-odexing gone bad, after that I didn't root it again.
[Android General] Paget96:
I just need better traffic here :D you know that is mine motivation :D I love to see peoples dedication :)
[Android General] MSF Jarvis:
I get mad scrolling through the pages on your L Speed Mod thread, there's phenomenal traffic there[emoji6]. Going off - topic here, but can you PM me a sort of rough tut on integrating L Speed Mod in a ROM??? I mean I want that the users of my ROM should have L Speed packaged by default onto the ROM rather than flashing it separately. The ROM has a clean init.d and SELinux set to permissive from the build.prop (PAC ROM KK).
[Android General] Paget96:
You can use it for sure, I'm giving permission to everyone who asked me and for sure credit me later on his thread :)

What to do inside zip there is system folder, everything from it must to be on your ROM, just copy&paste :) and after that, add stuff from mine updater-script to yours, that is implementation ;)

Simple as it sounds :)
[Android General] MSF Jarvis:
Don't worry about credits, I give credits for even a build.prop line copied from somewhere. I'll try the implementation as soon as the base CM build gets bug free and report to you.[emoji1] [emoji1] [emoji1] [emoji1]

This is my 100th post, [MENTION=5514152]Paget96[/MENTION], thanks for making me a senior member (sort of [emoji6] )...[emoji48] [emoji48] [emoji48]
[Android General] Paget96:
Ok mate ^~^

Now let's give better traffic to this thread :D
[Android General] MSF Jarvis:
I'll recommend it to my friends and users of my PAC ROM port.....

P.S. You won't need many recommendations, this guide's so awesome, people will know themselves.....
[Android General] Paget96:
Hah, thank you mate a lot ;)

I added how to use variables ;)
[Android General] Black_Eyes:
Everything is Java :D If you know it, you have command on Android :p
[Android General] Paget96:
I know a little bit ;)

I didn't find any guide for basic scripting stuff, then I decide to add it on xda ;)

For java it exists :)

Also better to know more things than one ^`^ heheh
[Android General] MSF Jarvis:
I'll try it out later and post screenshots, I'm eating lunch right now [emoji16] [emoji16] [emoji16]
[Android General] Paget96:
Hah, ook ;)

Bon appetite
[Android General] MSF Jarvis:
Thanks, can't go wrong with Moms food

[emoji6]. I'm done with eating, I'll try it now.

---------- Post added at 09:16 AM ---------- Previous post was at 09:02 AM ----------

Excitement + Typing = Typos ;);););) Look at the variable part again....
[Android General] Paget96:
What is a problem dude?? :)
[Android General] MSF Jarvis:
Nothing just saying. This is a problem :
[Android General] Paget96:
Use your previous knowledge :) that is the best way of learning, copy the code which I add to first post into a file, then execute it, and voila :D

Or if you want to do from terminal, you can't type that directly in it, because after you press enter you are starting with new segment :)

Write code in text editor, then copy whole text to terminal window, and it will work ;)
[Android General] MSF Jarvis:
I'll do that and get back with the screenshots.
[Android General] GreekDragon:
Gonna build my Dragon's script:D:D:D
[Android General] Paget96:
Ok dude ;)

Hehe little fireballs script :'D
[Android General] Paget96:
Added if, elif, else and examples how they works :)
[Android General] dxxvi:
How to download from https?

Since this thread is about busybox, I guess my question is not very off-topic. I can run "wget http://..." but not "wget https://..." (I can open that https link in firefox and then save the file, but wget is more convenient). I heard that busybox doesn't have openssl. Does anybody know how to download from https with links from a text file?
[Android General] Paget96:
With wget you cannot open https, I tried one time to implement auto download updates to L Speed mod, but it isn't possible.

Thank you :)

For downloading, you can try this

wget -i /path/of/a/file

Make sure that every link is in one line :)
[Android General] MSF Jarvis:
[MENTION=5514152]Paget96[/MENTION], whatever you post next time, try to put it in <CODE> tags rather than quote it. It's impossible to copy a snippet in Tapatalk....
[Android General] Senthil360:
Thanks for this amazing guide [MENTION=5514152]Paget96[/MENTION] , everything is linked in perfectly understandable manner ?

---------- Post added at 06:27 PM ---------- Previous post was at 06:24 PM ----------

Just one doubt,

Instead of using busybox in every line of command, I did #!/system/xbin/sh and typed the command directly

I mean,

echo "Android";

sleep 2;

echo " is";

sleep 2;

echo "awesome";

Can i proceed this way?
[Android General] Paget96:
No problem ;)

For sure that you can :D
[Android General] Paget96:
Tomorrow I will add things about kernel, virtual memory and file system tuning with the scripts and terminal emulator. :)

That will be on the second post :)

I will use code from mine L Speed mod and I will give an explanation for every single line :)
[Android General] rommy667:
Great thread thanks a lot :)
[Android General] Senthil360:
Eagerly waiting ?
[Android General] Paget96:
Thank you ^~^

Heheh :) soon ;)
[Android General] Paget96:
Post 2 updated, how to build a simple mod ^~^
[Android General] Senthil360:
[MENTION=5514152]Paget96[/MENTION] Huge thanks bro,amazing update to the guide.

Just one question regarding 2 properties :Dirty background ratio and dirty writeback centiscs

As far as i have understood these values are different parameters for he same function (writing back dirty_data) to be carried out, My question is is there a possibility of the dirty data starting to write out earlier before the specified dirty background ratio is reached because of the low value of dirty expire centisecs, if yes then is there any optimum value for centisecs.

I Hope my question is not stupid ?
[Android General] Paget96:
No prob ;)

Questions cannot be stupid, you can only get stupid answer :D yes different parameters for the same function, yes you can set parameters to dirty ratio write out earlier. But problem is that it make big drain on android ;)

Android default parameters for

busybox sysctl -e -w vm.dirty_expire_centisecs=200

busybox sysctl -e -w vm.dirty_writeback_centisecs=500

That is "optimum" :)
[Android General] Senthil360:
True :D and thanks once again for the reply bro..,

Can't wait for the next update ?, Maybe I'll start reading the L-Speed scripts now.(ROCK-L-ROLL)
[Android General] Paget96:
Thank you too ^~^

If you have somewhere share this thread ;)

Thank you
[Android General] LordArcadius:
Who's that?

Sent From dark_world through my Android One
[Android General] Paget96:
Everyone who want to learn ;)
[Android General] LordArcadius:
Ha ha!! Good!

Sent From dark_world through my Android One
[Android General] Paget96:
Guys, xda promoted me again ^~^ I'm so happy about this

http://www.xda-developers.com/xda-external-link/basic-scripting-busybox-command-tutorial/

see here ^~^

also leave comments below ^~^ Thank you all :D
[Android General] LordArcadius:
Congratulations Bro!!

Sent From dark_world through my Android One
[Android General] Paget96:
thank you a lot ^~^
[Android General] LordArcadius:
My Pleasure Bro

Sent From dark_world through my Android One
[Android General] Paget96:
Anyone who have a request?? :D
[Android General] MSF Jarvis:
I have a request. I thought of making a script for users who want to report bugs to their ROM devs or for an app or kernel dev. The script copies last_kmsg from /proc, saves a logcat and also partinfo using df. The problem is that last_kmsg doesn't copy out even with su access. The script is here :

I just want to know if there's a way to echo the contents of last_kmsg into a file.
[Android General] Paget96:
[MENTION=6552280]MSF Jarvis[/MENTION]

Instead of cp for last_kmsg

Use this

cat /proc/last_kmsg >> /sdcard/logs

Just free up your imagination ;D

Please feedback :)
[Android General] Senthil360:
Whatever option i select, i get (line 18 - eighteen) case unmatched error,What am i doing wrong?
[Android General] Paget96:
Add this to the end :)

Also this will help if wrong option is clicked

*) busybox clear;
busybox echo "#Exit,Invalid Option"
busybox sleep 1
esac
busybox echo ""
exit
[Android General] Senthil360:
Worked now,Thanks bro ?
[Android General] Paget96:
No problem, every time ;)

Just to explain this :)

You must to have an exit on the end ;)
[Android General] Paget96:
Guys see third post :D

You will be interested ;)

Make interesting things and I will promote them with your credits ;)