Files
status-react/scripts/inotify_fix.sh
T

23 lines
700 B
Bash
Raw Normal View History

2019-11-29 11:20:08 +01:00
#!/usr/bin/env bash
# If this is not run on some machines react-native builds fail.
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
2020-02-19 14:15:28 +01:00
source "${GIT_ROOT}/scripts/colors.sh"
2019-11-29 11:20:08 +01:00
2020-02-19 14:15:28 +01:00
if [[ "$(uname -s)" != Linux ]]; then
2019-11-29 11:20:08 +01:00
echo "inotify fix not applicable on non-linux OS"
2020-02-19 14:15:28 +01:00
exit
2019-11-29 11:20:08 +01:00
fi
watches=$(cat /proc/sys/fs/inotify/max_user_watches)
required_watches=524288
if [ $watches -lt $required_watches ]; then
2020-02-19 14:15:28 +01:00
echo -e "${YLW}fs.inotify.max_user_watches limit is too low ($watches). Increasing it.${RST}"
echo "fs.inotify.max_user_watches = $required_watches" | sudo tee -a /etc/sysctl.conf
2019-11-29 11:20:08 +01:00
sudo sysctl -p
2020-02-19 14:15:28 +01:00
else
echo -e "${GRN}fs.inotify.max_user_watches limit is high enough.${RST}"
2019-11-29 11:20:08 +01:00
fi