Update auto-fix-qortal.sh

added check for GUI-based machine, if GUI machine then the system will only run auto-fix via GUI so users can see it. Then it will modify the existing cron entry to remove the auto-fix-startup and add the auto-fix-visible entry in startup applications for GUI.
This commit is contained in:
crowetic 2023-05-24 19:09:37 -07:00 committed by GitHub
parent 15ea106549
commit b9eb7f74d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,8 +12,10 @@ WHITE='\033[0;37m' # White
NC='\033[0m' # No Color
echo "${CYAN} checking internet connection ${NC}\n"
INTERNET_STATUS="UNKNOWN"
TIMESTAMP=`date +%s`
ping -c 1 -W 0.7 8.8.4.4 > /dev/null 2>&1
if [ $? -eq 0 ] ; then
if [ "$INTERNET_STATUS" != "UP" ]; then
@ -36,6 +38,7 @@ TIMESTAMP=`date +%s`
totalm=$(free -m | awk '/^Mem:/{print $2}')
echo "${CYAN} Checking system RAM ... $totalm System RAM ... Configuring system for optimal RAM settings...${NC}\n"
if [ "$totalm" -le 6000 ]; then
echo "${WHITE} Machine has less than 6GB of RAM, Downloading correct start script for your configuration...${NC}\n"
@ -47,6 +50,11 @@ echo "${CYAN} Checking system RAM ... $totalm System RAM ... Configuring system
curl -L -O https://raw.githubusercontent.com/Qortal/qortal/master/start.sh && mv start.sh ~/qortal/start.sh && chmod +x ~/qortal/start.sh
fi
echo "${PURPLE} Checking hash of qortal.jar on liocal machine VS newest released qortal.jar on github ${NC}\n"
cd ~/qortal
@ -80,7 +88,7 @@ if [ "$LOCAL" = "$REMOTE" ]; then
chmod +x auto-fix-qortal.sh
cd
cp ~/qortal/new-scripts/auto-fix-qortal.sh .
exit 1
else
@ -104,3 +112,21 @@ else
cd
cp ~/qortal/new-scripts/auto-fix-qortal.sh .
fi
if command -v gnome-terminal >/dev/null 2>&1 ; then
echo "${CYAN} Setting up auto-fix-visible on GUI-based system... first, creating new crontab entry without auto-fix-startup... ${NC}\n"
sleep 2
curl -L -O https://raw.githubusercontent.com/crowetic/QORTector-scripts/main/auto-fix-GUI-cron && crontab auto-fix-GUI-cron && rm auto-fix-GUI-cron
echo "${CYAN} Setting up new ${NC}\n ${WHITE} 'auto-fix-qortal-GUI.desktop' ${NC}\n ${CYAN} file for GUI-based machines to run 7 min after startup in a visual fashion. Entry in 'startup' will be called ${NC}\n ${WHITE} 'auto-fix-visible' ${NC}\n"
curl -L -O https://raw.githubusercontent.com/crowetic/QORTector-scripts/main/auto-fix-qortal-GUI.desktop && mv auto-fix-qortal-GUI.desktop ~/.config/autostart
echo "${CYAN} Your machine will now run 'auto-fix-qortal.sh' script in a fashion you can SEE, 7 MIN AFTER YOU REBOOT your machine. The normal 'background' process for auto-fix-qortal will continue as normal.${NC}\n"
exit 1
else echo "${CYAN} Non-GUI system detected, skipping 'auto-fix-visible' setup ${NC}\n"
fi
sleep 10
exit 1