#!/bin/bash -e
# Get Python3 to understand we're always dealing with the desired locale.
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8

#echo 1 > /proc/sys/vm/compact_memory
#echo 3 > /proc/sys/vm/drop_caches

if [[ -f "/proc/asound/card0/pcm0p/sub0/prealloc" ]]
then
    echo -n "4096" > /proc/asound/card0/pcm0p/sub0/prealloc
fi

echo "performance" >/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo "performance" >/sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
echo "performance" >/sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
echo "performance" >/sys/devices/system/cpu/cpu3/cpufreq/scaling_governor

#systemctl disable getty@tty1.service

setserial /dev/ttyAMA0 low_latency
#systemctl stop serial-getty@ttyAMA0.service
#systemctl disable serial-getty@ttyAMA0.service

if [ -f /root/check_and_create_gr-1_data_partition.sh ]
then
    /root/check_and_create_gr-1_data_partition.sh
fi

cd /home/sysop/GR-1/grui
sh run.sh

#./grmain.exe &

#/usr/bin/nice -n -20 /usr/bin/ionice -c 1 -n 1 ./grmain.exe &

#cd /home/sysop/GR-1.src/grui
#python3 grmain.py >/tmp/grbla.txt 2>&1 &

exit 0
