Created
December 14, 2018 09:06
-
-
Save dmitryd/cfaa1b95815243a0dfbde534de76dd6e to your computer and use it in GitHub Desktop.
Toggles swap for the composer on Linux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/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