Skip to content

Instantly share code, notes, and snippets.

@Gronis
Created November 1, 2022 23:13
Show Gist options
  • Save Gronis/eb8b0e0cf7f4eaf2f4560038672f50c1 to your computer and use it in GitHub Desktop.
Save Gronis/eb8b0e0cf7f4eaf2f4560038672f50c1 to your computer and use it in GitHub Desktop.
Reboot if system has less than 64MB of system memory left. Useful when running RAM filesystem and reboots can be used for cleanup. Put in cron
#!/usr/bin/env bash
bash -c "[ $(cat /proc/meminfo | grep MemAvailable | awk '{ printf("%d", $2 < 65536) }') == '1' ] && reboot"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment