403Webshell
Server IP : 54.37.205.81  /  Your IP : 216.73.216.76
Web Server : nginx/1.22.1
System : Linux vps-249481fa 6.1.0-50-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.176-1 (2026-07-02) x86_64
User : debian ( 1000)
PHP Version : 8.2.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /opt/ccp-ots-gateway/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/ccp-ots-gateway/ots_cron_refresh.sh
#!/usr/bin/env bash
set -euo pipefail

OTS_BIN="/home/debian/.local/bin/ots"
BASE="/var/lib/ccp-ots"
STATUS_DIR="$BASE/status"
LOG="/var/log/ccp-ots/cron.log"

mkdir -p "$STATUS_DIR"
touch "$LOG"

# evita esecuzioni sovrapposte
LOCK="/tmp/ccp-ots-cron.lock"
exec 9>"$LOCK"
flock -n 9 || exit 0

echo "[$(date -u +'%F %T')] start" >> "$LOG"

shopt -s nullglob
for otsfile in "$BASE"/*.txt.ots; do
  txtfile="${otsfile%.ots}"
  hash="$(basename "$txtfile" .txt)"

  # upgrade (non fallire se ancora non c'รจ nulla da upgrade)
  "$OTS_BIN" upgrade "$otsfile" >> "$LOG" 2>&1 || true

  # verify
  out="$("$OTS_BIN" verify "$otsfile" 2>&1 || true)"

  status="pending"
  if echo "$out" | grep -Eqi "Success|Verified"; then
    status="anchored"
  fi

  # salva status JSON
  ts="$(date -u +'%FT%TZ')"
  printf '{\"sha256\":\"%s\",\"status\":\"%s\",\"checked_at\":\"%s\"}\n' "$hash" "$status" "$ts" > "$STATUS_DIR/$hash.json"
done

echo "[$(date -u +'%F %T')] end" >> "$LOG"

Youez - 2016 - github.com/yon3zu
LinuXploit