updated auto-fix script and added 32-bit start script updated.
This commit is contained in:
parent
db1e5c02e5
commit
2344cedb0b
@ -13,6 +13,7 @@ NC='\033[0m' # No Color
|
|||||||
|
|
||||||
PI_32_DETECTED=false
|
PI_32_DETECTED=false
|
||||||
PI_64_DETECTED=false
|
PI_64_DETECTED=false
|
||||||
|
UPDATED_SETTINGS=false
|
||||||
|
|
||||||
# Function to update the script
|
# Function to update the script
|
||||||
initial_update() {
|
initial_update() {
|
||||||
@ -476,48 +477,55 @@ force_bootstrap() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
potentially_update_settings() {
|
potentially_update_settings() {
|
||||||
|
echo "${GREEN}Backing up settings to a timestamped backup file...${NC}"
|
||||||
echo "${GREEN}Backing up settings to backup-settings.json...${NC}"
|
|
||||||
echo "${YELLOW}Changing to qortal directory...${NC}"
|
echo "${YELLOW}Changing to qortal directory...${NC}"
|
||||||
cd "${HOME}/qortal"
|
cd "${HOME}/qortal"
|
||||||
cp settings.json backup-settings.json
|
if [ ${SETTINGS_UPDATED} ]; then
|
||||||
|
echo "${YELLOW} Settings already updated this run, no need to attempt again...${NC}"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
TIMESTAMP=$(date +%Y%m%d%H%M%S)
|
||||||
|
BACKUP_FILE="backup-settings-${TIMESTAMP}.json"
|
||||||
|
cp settings.json "${BACKUP_FILE}"
|
||||||
|
|
||||||
SETTINGS_FILE="settings.json"
|
SETTINGS_FILE="settings.json"
|
||||||
|
|
||||||
echo "${YELLOW}Checking for${NC} ${GREEN}archivingPause${NC} ${YELLOW}setting...${NC}"
|
echo "${YELLOW}Checking for${NC} ${GREEN}archivingPause${NC} ${YELLOW}setting...${NC}"
|
||||||
if grep -q '"archivingPause"' "${SETTINGS_FILE}"; then
|
if grep -q '"archivingPause"' "${SETTINGS_FILE}"; then
|
||||||
echo "${BLUE}archivingPause exists...${NC}${GREEN} updating value...${NC}"
|
echo "${BLUE}archivingPause exists...${NC}${GREEN} removing it...${NC}"
|
||||||
if command -v jq &> /dev/null; then
|
if command -v jq &> /dev/null; then
|
||||||
echo "${GREEN}jq exists,${NC}${YELLOW} using jq to modify setting...${NC}"
|
echo "${GREEN}jq exists,${NC}${YELLOW} using jq to modify setting...${NC}"
|
||||||
jq '.archivingPause = 999999999999' "${SETTINGS_FILE}" > "settings.tmp" && mv "settings.tmp" "${SETTINGS_FILE}"
|
jq 'del(.archivingPause)' "${SETTINGS_FILE}" > "settings.tmp"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo "${RED}jq edit failed${NC}, ${YELLOW}modifying with sed...${NC}"
|
mv "settings.tmp" "${SETTINGS_FILE}"
|
||||||
sed -i 's/"archivingPause"[[:space:]]*:[[:space:]]*[0-9]*/"archivingPause": 999999999999/' "${SETTINGS_FILE}"
|
SETTINGS_UPDATED=true
|
||||||
|
else
|
||||||
|
echo "${RED}jq edit failed, restoring backup...${NC}"
|
||||||
|
mv "${BACKUP_FILE}" "${SETTINGS_FILE}"
|
||||||
|
return 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "${BLUE}jq doesn't exist, modifying with sed...${NC}"
|
echo "${BLUE}jq doesn't exist, modifying with sed...${NC}"
|
||||||
sed -i 's/"archivingPause"[[:space:]]*:[[:space:]]*[0-9]*/"archivingPause": 999999999999/' "${SETTINGS_FILE}"
|
sed -i '/"archivingPause"[[:space:]]*:/d' "${SETTINGS_FILE}"
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "${BLUE}archivingPause doesn't exist, adding...${NC}"
|
|
||||||
if command -v jq &> /dev/null; then
|
|
||||||
echo "${BLUE}jq exists, adding with jq...${NC}"
|
|
||||||
jq '. + {archivingPause: 999999999999}' "${SETTINGS_FILE}" > "settings.tmp" && mv "settings.tmp" "${SETTINGS_FILE}"
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "${RED}jq edit failed, modifying with sed...${NC}"
|
echo "${RED}sed edit failed, restoring backup...${NC}"
|
||||||
sed -i 's/}$/,"archivingPause": 999999999999}/' "${SETTINGS_FILE}"
|
mv "${BACKUP_FILE}" "${SETTINGS_FILE}"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
SETTINGS_UPDATED=true
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "${BLUE}jq doesn't exist, adding with sed...${NC}"
|
echo "${BLUE}archivingPause does not exist, no changes needed...${NC}"
|
||||||
sed -i 's/}$/,"archivingPause": 999999999999}/' "${SETTINGS_FILE}"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "${GREEN}Settings modification complete.${NC}"
|
echo "${GREEN}Settings modification complete.${NC}"
|
||||||
cd "${HOME}"
|
cd "${HOME}"
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
update_script() {
|
update_script() {
|
||||||
echo "${YELLOW}Updating script to newest version and backing up old one...${NC}\n"
|
echo "${YELLOW}Updating script to newest version and backing up old one...${NC}\n"
|
||||||
mkdir -p "${HOME}/qortal/new-scripts/backups"
|
mkdir -p "${HOME}/qortal/new-scripts/backups"
|
||||||
|
65
start-32bit.sh
Normal file
65
start-32bit.sh
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# There's no need to run as root, so don't allow it, for security reasons
|
||||||
|
if [ "$USER" = "root" ]; then
|
||||||
|
echo "Please su to non-root user before running"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Validate Java is installed and the minimum version is available
|
||||||
|
MIN_JAVA_VER='11'
|
||||||
|
|
||||||
|
if command -v java > /dev/null 2>&1; then
|
||||||
|
# Example: openjdk version "11.0.6" 2020-01-14
|
||||||
|
version=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}' | cut -d'.' -f1,2)
|
||||||
|
if echo "${version}" "${MIN_JAVA_VER}" | awk '{ if ($2 > 0 && $1 >= $2) exit 0; else exit 1}'; then
|
||||||
|
echo 'Passed Java version check'
|
||||||
|
else
|
||||||
|
echo "Please upgrade your Java to version ${MIN_JAVA_VER} or greater"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Java is not available, please install Java ${MIN_JAVA_VER} or greater"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# No qortal.jar but we have a Maven built one?
|
||||||
|
# Be helpful and copy across to correct location
|
||||||
|
if [ ! -e qortal.jar -a -f target/qortal*.jar ]; then
|
||||||
|
echo "Copying Maven-built Qortal JAR to correct pathname"
|
||||||
|
cp target/qortal*.jar qortal.jar
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Limits Java JVM stack size and maximum heap usage.
|
||||||
|
# Comment out for bigger systems, e.g. non-routers
|
||||||
|
# or when API documentation is enabled
|
||||||
|
JVM_MEMORY_ARGS="-Xss1256k -Xms1750m -Xmx1750m"
|
||||||
|
#JVM_MEMORY_ARGS="
|
||||||
|
-Xms1750m \
|
||||||
|
-Xmx1750m \
|
||||||
|
-Xss1212k \
|
||||||
|
-XX:+HeapDumpOnOutOfMemoryError \
|
||||||
|
-XX:HeapDumpPath=./heapdump.hprof \
|
||||||
|
-XX:+UseG1GC \
|
||||||
|
-XX:MaxGCPauseMillis=300 \
|
||||||
|
-XX:InitiatingHeapOccupancyPercent=50 \
|
||||||
|
-XX:ParallelGCThreads=4 \
|
||||||
|
-XX:ConcGCThreads=2 \
|
||||||
|
-XX:G1HeapRegionSize=32m \
|
||||||
|
-XX:MaxTenuringThreshold=10 \
|
||||||
|
-XX:+AlwaysPreTouch
|
||||||
|
"
|
||||||
|
|
||||||
|
# Although java.net.preferIPv4Stack is supposed to be false
|
||||||
|
# by default in Java 11, on some platforms (e.g. FreeBSD 12),
|
||||||
|
# it is overridden to be true by default. Hence we explicitly
|
||||||
|
# set it to false to obtain desired behaviour.
|
||||||
|
nohup nice -n 15 java \
|
||||||
|
-Djava.net.preferIPv4Stack=false \
|
||||||
|
${JVM_MEMORY_ARGS} \
|
||||||
|
-jar qortal.jar \
|
||||||
|
1>run.log 2>&1 &
|
||||||
|
|
||||||
|
# Save backgrounded process's PID
|
||||||
|
echo $! > run.pid
|
||||||
|
echo qortal running as pid $!
|
@ -33,8 +33,8 @@ fi
|
|||||||
# Limits Java JVM stack size and maximum heap usage.
|
# Limits Java JVM stack size and maximum heap usage.
|
||||||
# Comment out for bigger systems, e.g. non-routers
|
# Comment out for bigger systems, e.g. non-routers
|
||||||
# or when API documentation is enabled
|
# or when API documentation is enabled
|
||||||
#JVM_MEMORY_ARGS="-XX:MaxRAMPercentage=60 -XX:+UseG1GC -Xss512k -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=./heapdump.hprof -Xlog:gc*:file=gc.log:time,uptime,level,tags"
|
JVM_MEMORY_ARGS="-XX:MaxRAMPercentage=80 -XX:+UseG1GC -Xss1024k"
|
||||||
JVM_MEMORY_ARGS="
|
#JVM_MEMORY_ARGS="
|
||||||
-Xms2600m \
|
-Xms2600m \
|
||||||
-Xmx2600m \
|
-Xmx2600m \
|
||||||
-Xss1024k \
|
-Xss1024k \
|
@ -33,8 +33,8 @@ fi
|
|||||||
# Limits Java JVM stack size and maximum heap usage.
|
# Limits Java JVM stack size and maximum heap usage.
|
||||||
# Comment out for bigger systems, e.g. non-routers
|
# Comment out for bigger systems, e.g. non-routers
|
||||||
# or when API documentation is enabled
|
# or when API documentation is enabled
|
||||||
#JVM_MEMORY_ARGS="-XX:MaxRAMPercentage=40 -XX:+UseG1GC -Xss512k -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=./heapdump.hprof"
|
JVM_MEMORY_ARGS="-XX:MaxRAMPercentage40 -XX:+UseG1GC -Xss512k"
|
||||||
JVM_MEMORY_ARGS="
|
#JVM_MEMORY_ARGS="
|
||||||
-Xms6000m \
|
-Xms6000m \
|
||||||
-Xmx6000m \
|
-Xmx6000m \
|
||||||
-Xss2048k \
|
-Xss2048k \
|
||||||
|
@ -34,8 +34,8 @@ fi
|
|||||||
# Comment out for bigger systems, e.g. non-routers
|
# Comment out for bigger systems, e.g. non-routers
|
||||||
# or when API documentation is enabled
|
# or when API documentation is enabled
|
||||||
# Uncomment (remove '#' sign) line below if your system has less than 12GB of RAM for optimal RAM defaults
|
# Uncomment (remove '#' sign) line below if your system has less than 12GB of RAM for optimal RAM defaults
|
||||||
#JVM_MEMORY_ARGS="-XX:MaxRAMPercentage=40 -XX:+UseG1GC -Xss512k -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=./heapdump.hprof"
|
JVM_MEMORY_ARGS="-XX:MaxRAMPercentage=40 -XX:+UseG1GC -Xss1024k"
|
||||||
JVM_MEMORY_ARGS="
|
#JVM_MEMORY_ARGS="
|
||||||
-Xms8000m \
|
-Xms8000m \
|
||||||
-Xmx8000m \
|
-Xmx8000m \
|
||||||
-Xss4096k \
|
-Xss4096k \
|
||||||
|
@ -33,8 +33,8 @@ fi
|
|||||||
# Limits Java JVM stack size and maximum heap usage.
|
# Limits Java JVM stack size and maximum heap usage.
|
||||||
# Comment out for bigger systems, e.g. non-routers
|
# Comment out for bigger systems, e.g. non-routers
|
||||||
# or when API documentation is enabled
|
# or when API documentation is enabled
|
||||||
#JVM_MEMORY_ARGS="-Xss1256k -Xms1750m -Xmx1750m"
|
JVM_MEMORY_ARGS="-Xss1256k -Xms1750m -Xmx1750m"
|
||||||
JVM_MEMORY_ARGS="
|
#JVM_MEMORY_ARGS="
|
||||||
-Xms1750m \
|
-Xms1750m \
|
||||||
-Xmx1750m \
|
-Xmx1750m \
|
||||||
-Xss1212k \
|
-Xss1212k \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user