plc-checkweigher 1.37.4 → 1.37.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/setup.sh +29 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plc-checkweigher",
3
- "version": "1.37.4",
3
+ "version": "1.37.6",
4
4
  "description": "One-command installer for the PLC Check-Weigher system on Raspberry Pi (PREEMPT_RT kernel, Python stack, WiFi, SMB, systemd RT services)",
5
5
  "scripts": {
6
6
  "postinstall": "node bin/cli.js"
package/setup.sh CHANGED
@@ -496,9 +496,38 @@ EOF
496
496
  chown "${PI_USER}:${PI_USER}" "${INSTALL_DIR}/plc_selfheal.service"
497
497
  ok "plc_selfheal.service (auto-repair · cores 0-2 · Nice=10)"
498
498
 
499
+ # ── Report cleanup timer (daily 02:00 — zip + SMB push + delete >10d files) ─
500
+ cat > /etc/systemd/system/plc_cleanup.service << 'EOF'
501
+ [Unit]
502
+ Description=PLC Report Cleanup — zip + delete files older than 10 days, push backup to SMB
503
+ After=network-online.target
504
+ Wants=network-online.target
505
+
506
+ [Service]
507
+ Type=oneshot
508
+ User=root
509
+ ExecStart=/home/pi/plc_env/bin/python3 /home/pi/plc_checkweigher/report_cleanup.py
510
+ StandardOutput=journal
511
+ StandardError=journal
512
+ EOF
513
+
514
+ cat > /etc/systemd/system/plc_cleanup.timer << 'EOF'
515
+ [Unit]
516
+ Description=PLC Report Cleanup — daily at 02:00
517
+
518
+ [Timer]
519
+ OnCalendar=*-*-* 02:00:00
520
+ Persistent=true
521
+
522
+ [Install]
523
+ WantedBy=timers.target
524
+ EOF
525
+
499
526
  systemctl daemon-reload
500
527
  systemctl enable plc_watcher.service plc_web.service plc_selfheal.service
528
+ systemctl enable plc_cleanup.timer
501
529
  ok "All services enabled — start automatically after reboot"
530
+ ok "plc_cleanup.timer (daily 02:00 — archive + delete reports >10 days)"
502
531
 
503
532
  cp /etc/systemd/system/plc_watcher.service "${INSTALL_DIR}/plc_watcher.service"
504
533
  chown "${PI_USER}:${PI_USER}" "${INSTALL_DIR}/plc_watcher.service"