Skip to content

Instantly share code, notes, and snippets.

@uyorum
Last active January 7, 2024 14:06
Show Gist options
  • Save uyorum/735f396d0229ebfc80546deead7f19df to your computer and use it in GitHub Desktop.
Save uyorum/735f396d0229ebfc80546deead7f19df to your computer and use it in GitHub Desktop.
Enable read-only sdcard on Octopi
#!/bin/bash
set -eu
echo "Stopping log emiting services..."
systemctl stop syslog.socket
systemctl stop rsyslog
systemctl stop octoprint
systemctl stop klipper
echo "Removing log files..."
find /var/log -type f -regextype posix-egrep -regex '.*\.[0-9]+(\.gz)?'
find /var/log -type f -exec truncate -s 0 {} \;
truncate -s 0 /tmp/klippy.log
find /home/pi/.octoprint/logs -type f -regextype posix-egrep -regex '.*\.log\..+' -delete
find /home/pi/.octoprint/logs -type f -exec truncate -s 0 {} \;
echo "Enabling read-only SDcard..."
raspi-config nonint enable_overlayfs
echo "Finish. Reboot to apply"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment