[Need help on shell script] - Galaxy Ace S5830 General

Can anyone tell me how to add lines in one file by another bash file?
I make a script to change governors and frequency but I need to make the setting set on boot (But I dun want use 3rd party app like SetCPU).
So I need to add these lines to init.d folder's file :
Code:
#!/system/bin/bash (and i add line but this is by default?)
echo "interactiveX" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor (if the next time i chg setting , will this line be deleted or there will be another line with new setting?)
echo "800000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo "245670" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
so what command should i use to add these line ?

Code:
#!/system/bin/sh

an0nym0us_ said:
Code:
#!/system/bin/sh
Click to expand...
Click to collapse
thanks for your reply but i dont really understand...
those '800000' , '245670' and 'interactiveX' are just some example
i mean i want to write this:
echo "800000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
in init.d folder's file by other file

this file is in /system/bin
so i can access and chg my cpu setting by typing 'cpuclock'
there for i need a command to add line to init.d in order to set on boot
Code:
echo " Change CPU Governor Profile "
echo ""
echo ""
echo " Current Governor: "
echo "$CUR_GOV"
echo ""
$sleep
echo " Available Governors: "
echo "$AVAIL_GOV"
echo ""
$sleep
echo " Insert your desired governor: "
echo -n " Your Governor: ";read GOV
echo $GOV > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
[COLOR="Red"][so now i change my current governor,but the governor will be reset to default(ondemand) after next reboot]
[all i want is , while echoing current governor , i need to add one line to init.d there too , but i don know how :(][/COLOR]
echo " Complete "
echo ""
$sleep
echo -e " Current Governor: "
echo ""
echo ""
$sleep
echo -n " Press Enter Key To Continue... ";
read enterKey
opt=0;;

asd

Related

[Q] adding governors to the init.d scripts

I have a question about adding different governors to the init.d scripts?
Is it possible to just add governors to the init.d script even though it is not in the kernel itself?
For example adding this:
echo "800000" > /sys/devices/system/cpu/cpufreq/smartass/awake_ideal_freq;
echo "200000" > /sys/devices/system/cpu/cpufreq/smartass/sleep_ideal_freq;
echo "800000" > /sys/devices/system/cpu/cpufreq/smartass/sleep_wakeup_freq
echo "75" > /sys/devices/system/cpu/cpufreq/smartass/max_cpu_load;
echo "45" > /sys/devices/system/cpu/cpufreq/smartass/min_cpu_load;
echo "0" > /sys/devices/system/cpu/cpufreq/smartass/ramp_up_step;
echo "0" > /sys/devices/system/cpu/cpufreq/smartass/ramp_down_step;
echo "24000" > /sys/devices/system/cpu/cpufreq/smartass/up_rate_us
echo "99000" > /sys/devices/system/cpu/cpufreq/smartass/down_rate_us
Even though the kernel doe's not have smartass folder?
Will this run properly?

[SOLVED]Ondemand tweaks using init.d script

I want to edit some ondemand values and I have a script but when I run it in script manager it shows errors.
My Q is what commands do I have to add for it to work?
This was my original post regarding the Q,please refer here for more details: http://forum.xda-developers.com/showthread.php?t=1815616
Here's what I have:
#!/system/bin/sh
echo 85 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
echo 2 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
echo 50000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/powersave_bias
So many devs and no one can help.. Whats Q&A good for?
EDIT---
Solved by myself

tweak set governor

i try to change cpu governor with init.d script like this
Code:
#!/system/bin/sh
#start logging.
(
echo "logging started on `date`"
echo "Salty tweak success loaded.:)"
chmod 777 /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo "conservative" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
chmod 777 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo "1008000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
chmod 777 /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo "245760" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
#finish logging.
) 2>&1 | tee /data/salty.log
but cpu not changed even i has reboot my device
it has to ecexute manualy by open that with rootexplorer or script manager
how to make that script run automaticly every device rebooting???
what i have to do???
i using kernel with init.d suport and conservative governor scale on it

[SOLVED] wipe dalvik cache & reboot once a week

Please is there anyway to make a flashable script or cron script that will make @zeppelinrox Sclean script (clear dalvik cache & reboot) to run once each week from the xbin or bin folder?
slimcyril said:
Please is there anyway to make a flashable script or cron script that will make @zeppelinrox Sclean script (clear dalvik cache & reboot) to run once each week from the xbin or bin folder?
Click to expand...
Click to collapse
there should be a way but to make things easier just do it in your recovery. that sounds better for me
reyscott1968 said:
there should be a way but to make things easier just do it in your recovery. that sounds better for me
Click to expand...
Click to collapse
I know it could be done in the recovery & some apps like lucky patcher could also do it but I just want to automate it to be executed at the same time & day each week so I don't have to worry about doing it manually
slimcyril said:
I know it could be done in the recovery & some apps like lucky patcher could also do it but I just want to automate it to be executed at the same & day each week so I don't have to worry about doing it manually
Click to expand...
Click to collapse
i dnt mind spending few minutes every week for this task. and this is my own opinion tho
Lol I understand you @reyscott1968 I have a script that's called xposed log cleaner that clears all xposed logs every 5hrs & it made life very easy so I don't have to do it anymore. Here's a copy of the the script I have in my xbin that I need to be executed once a week at same day & time;
#!/system/bin/sh
#
# SuperClean & ReStart Script (Wipe Dalvik Cache & Reboot) created by zeppelinrox.
#
line=================================================
clear
echo ""
echo $line
echo " -=SuperClean & ReStart=- by -=zeppelinrox=-"
echo $line
echo ""
sleep 1
id=`id`; id=`echo ${id#*=}`; id=`echo ${id%%\(*}`; id=`echo ${id%% *}`
if [ "$id" != "0" ] && [ "$id" != "root" ]; then
sleep 2
echo " You are NOT running this script as root..."
echo ""
sleep 3
echo $line
echo " ...No SuperUser for you!!"
echo $line
echo ""
sleep 3
echo " ...Please Run as Root and try again..."
echo ""
echo $line
echo ""
sleep 3
exit 69
fi
echo " Commencing SuperClean & ReStart!"
echo ""
sleep 2
for cachedir in /*/dalvik-*; do rm -r /$cachedir/* 2>/dev/null; done
echo " All cleaned up and ready to..."
echo ""
sleep 2
echo $line
echo " !!POOF!!"
echo $line
echo ""
sleep 2
busybox sync
if [ -f "/proc/sys/kernel/sysrq" ]; then
echo 1 > /proc/sys/kernel/sysrq 2>/dev/null
echo b > /proc/sysrq-trigger 2>/dev/null
fi
echo " If it don't go poofie, just reboot manually!"
echo ""
reboot; busybox reboot
echo " ==========================="
echo " ) SuperClean Completed! ("
echo " ==========================="
echo ""
exit 0
http://forum.xda-developers.com/showthread.php?t=2700146

Underclocking app for SD 625

What good app you preffer for underclocking SD625? I want an app thar can underclock and if posible undervolt CPU and turn off some cpu cores. I have RR 5.8.5 with Electrablue 7 kernel.
If you are after an app, then Kernel Adiutor should do some of what you want.
However, if you want full manual control, then you can run commands from a root terminal, or use a script - eg
Code:
# reduce max freq to 1.68ghz
echo "1689600" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
# reduce cores running foreground operations
echo "0-3" > /dev/cpuset/foreground/cpus # default=0-6
echo "0-3" > /dev/cpuset/foreground/boost/cpus # default=0-6
# reduce cores running background operations
echo "0" > /dev/cpuset/background/cpus # default=0-1
echo "0-1" > /dev/cpuset/system-background/cpus # default=0-3
# turn off the last 4 cores
echo "0" > /sys/devices/system/cpu/cpu7/online
echo "0" > /sys/devices/system/cpu/cpu6/online
echo "0" > /sys/devices/system/cpu/cpu5/online
echo "0" > /sys/devices/system/cpu/cpu4/online
DarthJabba9 said:
If you are after an app, then Kernel Adiutor should do some of what you want.
However, if you want full manual control, then you can run commands from a root terminal, or use a script - eg
Code:
# reduce max freq to 1.68ghz
echo "1689600" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
# reduce cores running foreground operations
echo "0-3" > /dev/cpuset/foreground/cpus # default=0-6
echo "0-3" > /dev/cpuset/foreground/boost/cpus # default=0-6
# reduce cores running background operations
echo "0" > /dev/cpuset/background/cpus # default=0-1
echo "0-1" > /dev/cpuset/system-background/cpus # default=0-3
# turn off the last 4 cores
echo "0" > /sys/devices/system/cpu/cpu7/online
echo "0" > /sys/devices/system/cpu/cpu6/online
echo "0" > /sys/devices/system/cpu/cpu5/online
echo "0" > /sys/devices/system/cpu/cpu4/online
Click to expand...
Click to collapse
Very nice commands, these remain after reboot?
Do you know the command for checking current cpu speed and current number of cores online? Or better, one command to show all running cores with their speed.
nikkky said:
Very nice commands, these remain after reboot?
Do you know the command for checking current cpu speed and current number of cores online? Or better, one command to show all running cores with their speed.
Click to expand...
Click to collapse
The commands are not persistent. If you want them to be applied automatically after reboots, you need to put them in a script that is executed via init.d (see https://forum.xda-developers.com/re...o-initd-ad-blocking-bad-audio-videos-t3626661).
To see the values, simply run "cat" on each of the files being written to in the above examples - eg
Code:
cat /sys/devices/system/cpu/cpu7/online
DarthJabba9 said:
The commands are not persistent. If you want them to be applied automatically after reboots, you need to put them in a script that is executed via init.d (see https://forum.xda-developers.com/re...o-initd-ad-blocking-bad-audio-videos-t3626661).
To see the values, simply run "cat" on each of the files being written to in the above examples - eg
Code:
cat /sys/devices/system/cpu/cpu7/online
Click to expand...
Click to collapse
Do you know the command for changing governors?
nikkky said:
Do you know the command for changing governors?
Click to expand...
Click to collapse
Unfortunately, no.
DarthJabba9 said:
If you are after an app, then Kernel Adiutor should do some of what you want.
However, if you want full manual control, then you can run commands from a root terminal, or use a script - eg
Code:
# reduce max freq to 1.68ghz
echo "1689600" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
# reduce cores running foreground operations
echo "0-3" > /dev/cpuset/foreground/cpus # default=0-6
echo "0-3" > /dev/cpuset/foreground/boost/cpus # default=0-6
# reduce cores running background operations
echo "0" > /dev/cpuset/background/cpus # default=0-1
echo "0-1" > /dev/cpuset/system-background/cpus # default=0-3
# turn off the last 4 cores
echo "0" > /sys/devices/system/cpu/cpu7/online
echo "0" > /sys/devices/system/cpu/cpu6/online
echo "0" > /sys/devices/system/cpu/cpu5/online
echo "0" > /sys/devices/system/cpu/cpu4/online
Click to expand...
Click to collapse
When I try for example echo "0" > /sys/devices/system/cpu/cpu6/online I got permission denied. I used Material Terminal app.
Edit:
It worked by tiping su before, to convert $ to # for becoming root.
nikkky said:
Edit:
It worked by tiping su before, to convert $ to # for becoming root.
Click to expand...
Click to collapse
Yes. Running the "su" command is what converts your terminal session into a root terminal session

Categories

Resources