Skip to main content

Cleanup and Maintenance

Use this when disk space is running low or when you need to regularly clear logs/temporary files.

Cleanup in Container Mode (2026.05+)

In container mode, the logrotate inside the image (cronie + /etc/cron.daily/logrotate) automatically cleans up logs: daily / size>100M / 14-day gzip retention (for all 8 component logs). The UI "Temporary Cleanup" button uses a signal file (/etc/kopens/host-action.request {"action":"tempClean"}) → host's kopens-host-action.path triggers /data1/pp-temp/* clearing and container restart.

Docker image garbage collection: a weekly cron installed by install.sh (/etc/cron.weekly/plantpulse-cleanup) automatically removes images older than 30 days / dangling layers / journald entries older than 30 days.


1. clean.sh — Delete Logs / Temporary Files in Bulk​

$PE_HOME/bin/clean.sh

Cleanup targets (does not touch DB / user data — safe):

  • server/logs/* (Tomcat)
  • db/logs/* (Cassandra log — sstable data remains intact)
  • mqtt/log/*
  • timeseries/*/log/*
  • cache/log/*
  • node/log/*
  • /tmp/*
/tmp/* Bulk Cleanup — Removes Other Users' Temporary Files Too

clean.sh also clears system-wide /tmp. This removes temporary files from ssh session sockets / systemd-private / X11 / journal as well. Use with caution except on a gateway machine operated by a single user.


2. node-cleanup.sh — Reclaim Cassandra Disk Space​

$PE_HOME/bin/node-cleanup.sh

To perform:

  • nodetool clearsnapshot --all — Reclaim disk space from outdated snapshots
  • nodetool cleanup — Remove unused sstables after token range changes

Normally, start.sh is automatically called in the background, but you can run it manually once more when disk space is low.

Takes a few minutes (proportional to the amount of sstables). Causes some I/O load — recommended during periods of low collection traffic.


3. Addressing Disk Exhaustion (Full Procedure)​

# 1. 무엇이 차지 중?
df -h
du -sh $PE_HOME/*/log/* /data1/* 2>/dev/null | sort -h | tail -20

# 2. 로그 / 임시 파일 정리
$PE_HOME/bin/clean.sh

# 3. Cassandra 디스크 회수
$PE_HOME/bin/node-cleanup.sh

# 4. 오래된 백업 정리 (30 일 이상)
find /data1/pp-backup -maxdepth 1 -type d -mtime +30 -exec rm -rf {} +

# 5. (옵션) Docker 이미지 / 컨테이너 정리
docker system prune -af

# 6. 결과 확인
df -h

4. Common Pitfalls​

SymptomCause / Resolution
ssh suddenly disconnects after clean.shThe /tmp/* ssh socket was also deleted — reconnect via a new session
Disk space not reclaimed even after node-cleanup.shsstable compaction in progress. Check progress with nodetool compactionstats
find /data1/pp-backup -mtime +30 shows 0 itemsBackups only exist for the last 30 days. Adjust the retention (e.g., -mtime +14)

5. Further Reading​