Preview mode that survives a reboot, and a fallback log that survives one too
This commit is contained in:
@@ -84,9 +84,11 @@ $scripts = rtrim(SCRIPTS_DIR, '/');
|
||||
$cmds = [
|
||||
'stop' => 'bash ' . escapeshellarg("$scripts/Fallback/fallback.sh") . ' --stop 2>&1',
|
||||
'stop_test' => 'bash ' . escapeshellarg("$scripts/Fallback/fallback_test.sh") . ' --stop 2>&1',
|
||||
// setsid so it outlives this request; own log so the page can show what the preview said.
|
||||
// setsid so it outlives this request. No redirect: fallback.sh writes its own persistent
|
||||
// log when stdout is not a terminal, so an ad-hoc preview and the array-start daemon leave
|
||||
// their record in the same file rather than one going to tmpfs and vanishing on reboot.
|
||||
'start_dry' => 'setsid bash ' . escapeshellarg("$scripts/Fallback/fallback.sh")
|
||||
. ' --dry-run --log > /tmp/varaverk/fallback_dryrun.log 2>&1 < /dev/null & echo started',
|
||||
. ' --dry-run --log > /dev/null 2>&1 < /dev/null & echo started',
|
||||
'clear_lock' => 'rm -f /tmp/unraid_locks/fallback.lock /tmp/unraid_locks/fallback_test.lock && echo cleared',
|
||||
];
|
||||
|
||||
@@ -119,8 +121,8 @@ if ($remoteDir === '') $remoteDir = '/boot/config/plugins/varaverk';
|
||||
$remoteCmds = [
|
||||
'stop' => "bash '$remoteDir/Fallback/fallback.sh' --stop 2>&1",
|
||||
'stop_test' => "bash '$remoteDir/Fallback/fallback_test.sh' --stop 2>&1",
|
||||
'start_dry' => "mkdir -p /tmp/varaverk; setsid bash '$remoteDir/Fallback/fallback.sh'"
|
||||
. " --dry-run --log > /tmp/varaverk/fallback_dryrun.log 2>&1 < /dev/null & echo started",
|
||||
'start_dry' => "setsid bash '$remoteDir/Fallback/fallback.sh'"
|
||||
. " --dry-run --log > /dev/null 2>&1 < /dev/null & echo started",
|
||||
'clear_lock' => 'rm -f /tmp/unraid_locks/fallback.lock /tmp/unraid_locks/fallback_test.lock && echo cleared',
|
||||
];
|
||||
|
||||
|
||||
@@ -353,6 +353,7 @@ function vv_fb_all(): array {
|
||||
'fb_enabled' => $fbEnabled,
|
||||
'partnership_enabled' => $ptEnabled,
|
||||
'fb_rsync_enabled' => $rsyncEnabled,
|
||||
'dry_run' => vv_fb_scalar($masterRaw, 'FALLBACK_DRY_RUN') === 'true',
|
||||
'handback_req' => $handbackReq,
|
||||
'check_interval' => $checkInterval,
|
||||
'suspend_after' => $suspendAfter,
|
||||
|
||||
@@ -237,6 +237,19 @@ if (vv_ai_ui_on()) vv_ai_chat_assets();
|
||||
</div>
|
||||
<div class="vv-fb-tog" id="vv-fb-rsync-tog" onclick="vvFbToggle(this,'FALLBACK_RSYNC_ENABLED')"></div>
|
||||
</div>
|
||||
|
||||
<hr class="vv-fb-sep">
|
||||
|
||||
<!-- Persistent preview. Distinct from the per-card "Start dry run" button: that launches one
|
||||
now, this decides what array_started.sh launches at every boot. Without it a preview lasts
|
||||
exactly until the next array start and is then silently replaced by the live daemon. -->
|
||||
<div class="vv-fb-ctrl-row">
|
||||
<div>
|
||||
<div class="vv-fb-ctrl-lbl">Preview mode <span style="font-size:9px;color:#4a9eff;border:1px solid #1e3a5a;background:#101a26;border-radius:3px;padding:1px 5px;margin-left:5px;">DRY RUN</span></div>
|
||||
<div class="vv-fb-ctrl-sub">Watch and report, change nothing — no containers, no DDNS, no notifications. Survives reboots, so a long observation run stays a preview.</div>
|
||||
</div>
|
||||
<div class="vv-fb-tog" id="vv-fb-dry-tog" onclick="vvFbToggle(this,'FALLBACK_DRY_RUN')"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Mesh verdict — one line answering "is this armed and is anything watching" before any detail -->
|
||||
@@ -712,6 +725,7 @@ function _setToggles(data) {
|
||||
['vv-fb-pt-tog', !!data.partnership_enabled],
|
||||
['vv-fb-en-tog', !!data.fb_enabled],
|
||||
['vv-fb-rsync-tog', !!data.fb_rsync_enabled],
|
||||
['vv-fb-dry-tog', !!data.dry_run],
|
||||
];
|
||||
pairs.forEach(([id, on]) => {
|
||||
const el = document.getElementById(id);
|
||||
|
||||
Reference in New Issue
Block a user