Skip to content

Instantly share code, notes, and snippets.

@dmitryd
Created December 14, 2018 09:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmitryd/cfaa1b95815243a0dfbde534de76dd6e to your computer and use it in GitHub Desktop.
Save dmitryd/cfaa1b95815243a0dfbde534de76dd6e to your computer and use it in GitHub Desktop.
Toggles swap for the composer on Linux
#/bin/bash
# Must be run as root!
# Source: https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors
if [ -f /var/swap.1 ] ; then
/sbin/swapoff /var/swap.1
rm /var/swap.1
echo "Swap is off"
else
/bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
/sbin/mkswap /var/swap.1
/sbin/swapon /var/swap.1
echo "Swap is on"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment