# Apply sysctl settings, including files in /etc/sysctl.d
apply_sysctl() {
- local file
- for file in /etc/sysctl.d/*.conf; do
- test -f "$file" && sysctl -q -e -p "$file"
- done
- sysctl -q -e -p /etc/sysctl.conf
+ sysctl -q -e --system
}
if is_yes "$FASTRC" || is_yes "$IN_SHUTDOWN"; then
# Remove pid file if any.
if [ "$notset" = "1" ]; then
- rm -f /var/run/${base}.pid
+ if [ -f "${pidfile}" ] ; then
+ rm -f "$pidfile"
+ else
+ rm -f /var/run/${base}.pid
+ fi
fi
return $result
# module is needed (ie. is requested, is available and isn't loaded already)
is_module() {
+ # fail if /sbin/lsmod does not exists (ex. in containers)
+ [ -x /sbin/lsmod ] || return 1
+
# module name without .o at end
if ! lsmod | grep -q "$1"; then
if ls -1R /lib/modules/$(uname -r)/ 2> /dev/null | grep -q "^${1}.\(\|k\)o\(\|.gz\)"; then