How to automatically run jetson_clocks.sh on TX2 at startup

Hi:
How to automatically run jetson_clocks.sh on TX2 at startup
I tried to write a script “InitFreq.sh” at /home/nvidia/ like this
#!bin/bash
echo “nvidia” | sudo -S ./jetson_clocks.sh

And then I run the script in the terminal, it does raise cpu and gpu clock.

But when I add the script in /etc/rc.loacl like
sh /home/nvidia/InitFreq.sh
exit 0

it don’t work anyway.

FYI, my testing is on R28.1.

I don’t know why rc.local wouldn’t work, but you are right. I see the fan pwm maxes out, but MinFreq and CurrentFreq never change. I am thinking perhaps the kernel is not yet at a stage where these can be changed.

To test one possibility I added “sleep 3” prior to calling jetson_clocks.sh in rc.local. This didn’t do it, so I used “sleep 10” instead. This worked.

Perhaps someone from NVIDIA could mention if there is something in “/sys” which could be used to determine when the min/max/current CPU core frequencies become available to modify through “/sys”. Instead of pausing for 10 seconds perhaps something which forks and pauses until this is ready would be more reliable.

haha, Thanks.
I do as your says , add “sleep 10” before "sh /home/nvidia/InitFreq.sh " in /etc/rc.loacl and then reboot .
It does raise cpu and gpu clock.

hi hellomicheal,
Can you tell me the content of jetson_clocks.sh and InitFreq.sh ?
Thank you very much!

jetson_clocks.sh is a script, when you install the JetPace finish it will be the path of : /home/nvidia/
and InitFrq.sh is a script write by myself , here is the InitFrq.sh content :
#! /bin/bash
echo “nvidia” | sudo -S ./home/nvidia/jetson_clocks.sh

hi hellomicheal,

Thank you very much for your reply.
My jetson_clocks.sh firstly run check_uptime() which will continue running the following program when the value of “/proc/uptime” is greater than 90.
Can I commit out the check_uptime in the function of main?

check_uptime()
{

if [ -e “/proc/uptime” ]; then
uptime=cat /proc/uptime | cut -d '.' -f1

if [ $((uptime)) -lt 90 ]; then
    printf "Error: Please run the script after $((90 - uptime)) Seconds, \

\notherwise ubuntu init script may override the clock settings!\n"
exit -1
fi
else
printf “Warning: Could not check system uptime. Please make sure that you run the script 90 Seconds after bootup,
\notherwise ubuntu init script may override the clock settings!\n”
fi
}

main ()
{
check_uptime

[ whoami != root ] && echo Error: Run this script($0) as a root user && exit 1

do_cpu
do_hotplug
do_clusterswitch
do_gpu
do_emc
do_fan
}
main $@[b][/b]