Skip to content

Commit

Permalink
core-services/sysctl: drop sysctl(8) --system requirement.
Browse files Browse the repository at this point in the history
Use sysctl -p everywhere: works with procps-ng and busybox (and probably
others as well).
  • Loading branch information
Juan RP committed Sep 5, 2015
1 parent ef157a5 commit 5f719f1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ difference that I'm trying to avoid the bash dependency.

- A POSIX shell
- A POSIX awk
- procps-ng (needs pkill -s0,1 and sysctl --system)
- procps-ng (needs pkill -s0,1)
- runit

### How to use it
Expand Down
28 changes: 11 additions & 17 deletions core-services/08-sysctl.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
# vim: set ts=4 sw=4 et:

if [ -x /sbin/sysctl -o -x /bin/sysctl ]; then
msg "Loading sysctl(8) settings...\n"
msg "Loading sysctl(8) settings..."
for i in /run/sysctl.d/*.conf \
/etc/sysctl.d/*.conf \
/usr/local/lib/sysctl.d/*.conf \
/usr/lib/sysctl.d/*.conf \
/etc/sysctl.conf; do

if sysctl -V >/dev/null 2>&1; then
sysctl --system
else
# Fallback for busybox sysctl
for i in /run/sysctl.d/*.conf \
/etc/sysctl.d/*.conf \
/usr/local/lib/sysctl.d/*.conf \
/usr/lib/sysctl.d/*.conf \
/etc/sysctl.conf; do

if [ -e "$i" ]; then
printf '* Applying %s ...\n' "$i"
sysctl -p "$i"
fi
done
fi
if [ -e "$i" ]; then
printf '* Applying %s ...\n' "$i"
sysctl -p "$i"
fi
done
fi

0 comments on commit 5f719f1

Please sign in to comment.