Cleanup / Housekeeping (clean.sh / node-cleanup.sh)
Use these when disk space runs low or when you want to periodically clear out logs and temporary files.
In container mode, the logrotate inside the image (cronie + /etc/cron.daily/logrotate) handles cleanup automatically on a daily / size>100M /
14-day gzip basis (for all 8 component logs). The UI "Temporary cleanup" button writes a signal file
(/etc/kopens/host-action.request {"action":"tempClean"}) → kopens-host-action.path on the host
clears /data1/pp-temp/* and restarts the containers.
Docker image garbage collection: the weekly cron installed by install.sh (/etc/cron.weekly/plantpulse-cleanup)
automatically cleans up images older than 30 days, dangling layers, and journald entries older than 30 days.
1. clean.sh — Bulk deletion of logs / temporary files
$PE_HOME/bin/clean.sh
What gets deleted (DB and user data are left untouched — safe):
server/logs/*(Tomcat)db/logs/*(Cassandra log — sstable data is preserved)mqtt/log/*timeseries/*/log/*cache/log/*node/log/*/tmp/*
/tmp/* bulk deletion — other users' temporary files go tooclean.sh also clears the system-wide /tmp. ssh session sockets, systemd-private, X11, and journal temporary files disappear along with it. Use with care on anything other than a single-operator gateway machine.
2. node-cleanup.sh — Reclaiming Cassandra disk space
$PE_HOME/bin/node-cleanup.sh
What it does:
nodetool clearsnapshot --all— reclaims disk space from old snapshotsnodetool cleanup— removes sstables left unused after a token range change
Normally start.sh invokes these automatically in the background, but you can run them manually one more time when disk space is low.
Takes minutes (proportional to the amount of sstables). It creates some I/O load — best run during a period of light collection traffic.
3. Responding to low disk space (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
| Symptom | Cause / Resolution |
|---|---|
ssh drops suddenly after clean.sh | The ssh socket under /tmp/* was deleted too — reconnect with a new session |
Disk space still not reclaimed after node-cleanup.sh | sstable compaction is still pending. Check progress with nodetool compactionstats |
find /data1/pp-backup -mtime +30 returns 0 results | Backups exist only within the last 30 days. Adjust the period (-mtime +14, etc.) |
5. Learn more
- Backup automation + retention period: Backup (
backup.sh) - Disk diagnostics: Diagnostics / Inspection