mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-04-10 12:12:10 -07:00
Fix cron restart
This commit is contained in:
@@ -28,6 +28,8 @@ if (!is_dir($dbFolderPath)) {
|
|||||||
@mkdir($dbFolderPath, 0775, true);
|
@mkdir($dbFolderPath, 0775, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$dbFolderPath = rtrim($dbFolderPath, '/') . '/';
|
||||||
|
|
||||||
$DBFILE = rtrim($dbFolderPath, '/') . '/app.db';
|
$DBFILE = rtrim($dbFolderPath, '/') . '/app.db';
|
||||||
if (!file_exists($DBFILE) && file_exists($legacyDbPath)) {
|
if (!file_exists($DBFILE) && file_exists($legacyDbPath)) {
|
||||||
$DBFILE = $legacyDbPath;
|
$DBFILE = $legacyDbPath;
|
||||||
@@ -41,6 +43,8 @@ if (!is_dir($logFolderPath)) {
|
|||||||
@mkdir($logFolderPath, 0775, true);
|
@mkdir($logFolderPath, 0775, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$logFolderPath = rtrim($logFolderPath, '/') . '/';
|
||||||
|
|
||||||
$DBFILE_LOCKED_FILE = rtrim($logFolderPath, '/') . '/db_is_locked.log';
|
$DBFILE_LOCKED_FILE = rtrim($logFolderPath, '/') . '/db_is_locked.log';
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,10 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
export INSTALL_DIR=/app
|
|
||||||
|
|
||||||
|
# If cron_restart_backend exists in the file LOG_EXECUTION_QUEUE, then
|
||||||
|
# call the restart backend script and remove the line from the file
|
||||||
|
# and remove the entry
|
||||||
|
|
||||||
|
|
||||||
# Check if there are any entries with cron_restart_backend
|
|
||||||
if grep -q "cron_restart_backend" "${LOG_EXECUTION_QUEUE}"; then
|
if grep -q "cron_restart_backend" "${LOG_EXECUTION_QUEUE}"; then
|
||||||
killall python3
|
|
||||||
sleep 2
|
|
||||||
/services/start-backend.sh &
|
/services/start-backend.sh &
|
||||||
|
sed -i '/cron_restart_backend/d' "${LOG_EXECUTION_QUEUE}"
|
||||||
# Remove all lines containing cron_restart_backend from the log file
|
|
||||||
# Atomic replacement with temp file
|
|
||||||
grep -v "cron_restart_backend" "${LOG_EXECUTION_QUEUE}" > "${LOG_EXECUTION_QUEUE}.tmp" && \
|
|
||||||
mv "${LOG_EXECUTION_QUEUE}.tmp" "${LOG_EXECUTION_QUEUE}"
|
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -23,9 +23,9 @@ done
|
|||||||
trap cleanup EXIT
|
trap cleanup EXIT
|
||||||
trap forward_signal INT TERM
|
trap forward_signal INT TERM
|
||||||
|
|
||||||
echo "Starting /usr/sbin/crond -c \"${SYSTEM_SERVICES_CROND}\" -f -L \"${LOG_CROND}\" >>\"${LOG_CROND}\" 2>&1 &"
|
echo "Starting /usr/sbin/crond -c \"${SYSTEM_SERVICES_CROND}\" -f -l 1 -L \"${LOG_CROND}\" >>\"${LOG_CROND}\" 2>&1 &"
|
||||||
|
|
||||||
/usr/sbin/crond -c "${SYSTEM_SERVICES_CROND}" -f -L "${LOG_CROND}" >>"${LOG_CROND}" 2>&1 &
|
/usr/sbin/crond -c "${SYSTEM_SERVICES_CROND}" -f -l 1 -L "${LOG_CROND}" >>"${LOG_CROND}" 2>&1 &
|
||||||
crond_pid=$!
|
crond_pid=$!
|
||||||
|
|
||||||
wait "${crond_pid}"; status=$?
|
wait "${crond_pid}"; status=$?
|
||||||
|
|||||||
Reference in New Issue
Block a user