Skip to content

Instantly share code, notes, and snippets.

@Rockstar04
Created December 11, 2018 14:47
Show Gist options
  • Save Rockstar04/fed7a3a4cce1b3f0b04654f605469739 to your computer and use it in GitHub Desktop.
Save Rockstar04/fed7a3a4cce1b3f0b04654f605469739 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# This file will create a cronjob that flushes kernel caches
# This is intended for with in VMs that support memory ballooning
# and will allow the hypervisor to reclaim memory
cat << 'EOF' >> /etc/cron.hourly/shrink_mem
#!/usr/bin/env bash
sync
echo 3 > /proc/sys/vm/drop_caches
EOF
chmod +x /etc/cron.hourly/shrink_mem
/etc/cron.hourly/shrink_mem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment