commit efe529f24617c52a4ed2145efaf9db33c8a2c6f6 parent 7161edc222ae1b1a0a6a36881a7a94c5cb6de149 Author: Christoph Lohmann <20h@r-36.net> Date: Wed, 5 Feb 2014 18:53:56 +0100 Revamping svc. The changes include moving the main path to /bin/svc.d, due to all executables which should be in /bin. The second change is some more services and updates to services. Diffstat:
86 files changed, 439 insertions(+), 343 deletions(-)
diff --git a/LICENSE b/LICENSE @@ -1,6 +1,6 @@ MIT/X Consortium License -© 2012-13 Christoph Lohmann <20h@r-36.net> +© 2012-14 Christoph Lohmann <20h@r-36.net> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), diff --git a/README.md b/README.md @@ -7,45 +7,45 @@ The documentation is sparse due to it being in alpha stage. ## Installation % chmod 755 /bin/svc - % cp -rf svc / + % cp -rf svc.d /bin/svc.d ## Services ### Simplest case - % touch /svc/avail/somebin + % touch /bin/svc.d/avail/somebin % svc -s somebin -This will run »somebin« in the $PATH using the script in /svc/bare.sh. +This will run »somebin« in the $PATH using the script in /bin/svc.d/bare.sh. ### Some params - % touch /svc/avail/somebin - % echo 'PARAMS="-a"' > /svc/default/somebin + % touch /bin/svc.d/avail/somebin + % echo 'PARAMS="-a"' > /bin/svc.d/default/somebin % svc -s somebin -This will run »somebin -a« in the $PATH using the script /svc/bare.sh. +This will run »somebin -a« in the $PATH using the script /bin/svc.d/bare.sh. ### Own script - % cp /svc/bare.sh /svc/default/somebin - % $EDITOR /svc/default/somebin - % echo 'SOME_VAR="no"' > /svc/default/somebin + % cp /bin/svc.d/bare.sh /bin/svc.d/default/somebin + % $EDITOR /bin/svc.d/default/somebin + % echo 'SOME_VAR="no"' > /bin/svc.d/default/somebin % svc -s somebin -This will run »somebin« with the script at /svc/default/somebin using the -special variable from /svc/default/somebin. +This will run »somebin« with the script at /bin/svc.d/default/somebin using the +special variable from /bin/svc.d/default/somebin. ## svc(1) - % svc -a # list all links in /svc/run (all activated services) + % svc -a # list all links in /bin/svc.d/run (all activated services) % svc -a ser # activate service »ser« to be run on startup % svc -c # create the basic directories of svc (configure) % svc -d ser # deactivate service »ser« - % svc -k # kill all services linked to /svc/run + % svc -k # kill all services linked to /bin/svc.d/run % svc -k ser # kill the service »ser« - % svc -s # run all services linked to /svc/run + % svc -s # run all services linked to /bin/svc.d/run % svc -s ser # run service »ser« - % svc -l # list all services in /svc/avail + % svc -l # list all services in /bin/svc.d/avail % svc -r ser # restart service »ser« Have fun! diff --git a/bin/svc b/bin/svc @@ -3,9 +3,12 @@ # See LICENSE file for license details. # -BASEDIR="/svc" +BASEDIR="/bin/svc.d" BASENAME="$(basename $0)" +[ -d "$BASEDIR" ] || mkdir -p "$BASEDIR" +cd $BASEDIR + usage() { printf "usage: %s [-acdklrs] [service]\n" "$BASENAME" >&2 exit 1 @@ -21,11 +24,11 @@ runservice() { dir="$2" cmd="$3" - if [ $(stat -L -t "$BASEDIR/$dir/$service" | cut -d' ' -f 2) -eq 0 ]; + if [ $(stat -L -t "$dir/$service" | cut -d' ' -f 2) -eq 0 ]; then - "$BASEDIR/bare.sh" "$service" "$cmd" 2>&1 >/dev/null & + "./bare.sh" "$service" "$cmd" 2>&1 >/dev/null & else - "$BASEDIR/$dir/$service" "$cmd" 2>&1 >/dev/null & + "$dir/$service" "$cmd" 2>&1 >/dev/null & fi } @@ -35,8 +38,7 @@ doservice() { if [ -z "${service}" ]; then - cd $BASEDIR/run - services=$(ls -1 .) + services=$(ls -1 run) for s in ${services}; do runservice "$s" run "$cmd" @@ -44,7 +46,7 @@ doservice() { "$BASENAME" "$s" "$cmd" done else - if [ -x "$BASEDIR/avail/$service" ]; + if [ -x "avail/$service" ]; then runservice "$service" avail "$cmd" printf "%s: '%s' %s.\n" \ @@ -59,13 +61,13 @@ doservice() { case "$1" in -a) - if [ $# -gt 1 ] && [ -e "$BASEDIR/avail/$2" ]; + if [ $# -gt 1 ] && [ -e "avail/$2" ]; then - ln -sf "$BASEDIR/avail/$2" "$BASEDIR/run/$2" + ln -sf "../avail/$2" "run/$2" printf "%s: '%s' activated.\n" \ "$BASENAME" "$2" else - cd $BASEDIR/run + cd run ls . fi ;; @@ -76,9 +78,9 @@ case "$1" in [ -d "$BASEDIR/run" ] || mkdir -p "$BASEDIR/run" ;; -d) - if [ $# -gt 1 ] && [ -e "$BASEDIR/run/$2" ]; + if [ $# -gt 1 ] && [ -e "run/$2" ]; then - rm -f "$BASEDIR/run/$2" + rm -f "run/$2" printf "%s: '%s' deactivated.\n" \ "$BASENAME" "$2" else @@ -91,12 +93,13 @@ case "$1" in doservice "$1" "$2" ;; -l) - cd $BASEDIR/avail + cd avail ls . ;; -r) if [ $# -gt 1 ]; then + set -x svc -k "$2" svc -s "$2" else diff --git a/svc.d/avail/acpid b/svc.d/avail/acpid diff --git a/svc.d/avail/alsa b/svc.d/avail/alsa @@ -0,0 +1,33 @@ +#!/bin/sh + +SERVICE="alsa" + +[ -e "/etc/svc/default/$SERVICE" ] && . "/etc/svc/default/$SERVICE" + +PID=$(pidof -o %PPID $BIN) + +case $1 in + -s) + [ -e "$STATEFILE" ] || alsactl $PARAMS store + alsactl $PARAMS restore + + dfiles="/sys/modules/snd_ac97_codec/parameters/power_save + /sys/modules/snd_hda_intel/parameters/power_save" + for f in dfiles; + do + if [ -e $f ]; + then + echo $POWERSAVE > $f + [ -c /dev/dsp ] && echo 1 > /dev/dsp + fi + done + ;; + -k) + [ "$SAVEVOLUME" = "yes" ] && alsactl $PARAMS store + [ "$MUTEVOLUME" = "yes" ] && amixer -q set Master 0 mute + ;; + *) + echo "usage: $0 -s|-k" + exit 1 +esac + diff --git a/svc.d/avail/atd b/svc.d/avail/atd diff --git a/svc.d/avail/barebone b/svc.d/avail/barebone @@ -0,0 +1,22 @@ +#!/bin/sh + +SERVICE="barebone" + +[ -e "/etc/svc/default/$SERVICE" ] && . "/etc/svc/default/$SERVICE" + +BIN="/usr/bin/$SERVICE" + +PID=$(pidof -o %PPID $BIN) + +case $1 in + -s) + [ -z "$PID" ] && $BIN $PARAMS; + ;; + -k) + [ -n "$PID" ] && kill -9 $PID &> /dev/null; + ;; + *) + echo "usage: $0 -s|-k" + exit 1 +esac + diff --git a/svc.d/avail/crond b/svc.d/avail/crond diff --git a/svc.d/avail/cupsd b/svc.d/avail/cupsd diff --git a/svc.d/avail/dovecot b/svc.d/avail/dovecot diff --git a/svc.d/avail/fancontrol b/svc.d/avail/fancontrol @@ -0,0 +1,32 @@ +#!/bin/sh + +set -x + +SERVICE="fancontrol" + +[ -e "/etc/svc/default/$SERVICE" ] && . "/etc/svc/default/$SERVICE" + +BIN="/usr/sbin/$SERVICE" + +PID=$(pidof -o %PPID -x $BIN) + +case $1 in + -s) + [ -z "$PID" ] && { + rm /run/fancontrol.pid + $BIN $PARAMS + } + ;; + -k) + [ -n "$PID" ] && { + for p in $PID; + do + kill -9 $p &> /dev/null; + done + } + ;; + *) + echo "usage: $0 -s|-k" + exit 1 +esac + diff --git a/svc.d/avail/gpsd b/svc.d/avail/gpsd diff --git a/svc.d/avail/hostapd b/svc.d/avail/hostapd diff --git a/svc.d/avail/hwclock b/svc.d/avail/hwclock @@ -0,0 +1,15 @@ +#!/bin/sh + +. /svc/etc/default/hwclock + +case $1 in + -s) + ;; + -k) + hwclock --adjust $PARAMS + ;; + *) + echo "usage: $0 -s|-k" + exit 1 +esac + diff --git a/svc.d/avail/input-event-daemon b/svc.d/avail/input-event-daemon diff --git a/svc.d/avail/laptop-mode b/svc.d/avail/laptop-mode @@ -0,0 +1,24 @@ +#!/bin/sh + +SERVICE="laptop-mode" + +[ -e "/etc/svc/default/$SERVICE" ] && . "/etc/svc/default/$SERVICE" + +BIN="/usr/sbin/$SERVICE" + +case $1 in + -s) + [ ! -d /run/laptop-mode-tools ] && install -d /run/laptop-mode-tools + rm -f /run/laptop-mode-tools/* + touch /run/laptop-mode-tools/enabled + $BIN auto 2>&1 >/dev/null + ;; + -k) + rm -f /run/laptop-mode-tools/enabled + $BIN stop 2>&1 >/dev/null + ;; + *) + echo "usage: $0 -s|-k" + exit 1 +esac + diff --git a/svc.d/avail/nscd b/svc.d/avail/nscd @@ -0,0 +1,31 @@ +#!/bin/sh + +SERVICE="nscd" + +BIN="/bin/$SERVICE" + +PID=$(pidof -o %PPID $BIN) + +case $1 in + -s) + if [ -z $PID ]; + then + rm -f "/run/$SERVICE.pid" 2>&1 >/dev/null + mkdir -p /run/nscd /var/db/nscd + rm -f /run/nscd/* /var/db/nscd/* 2>&1 >/dev/null + + $BIN $PARAMS >/dev/null 2>&1; + fi + ;; + -k) + if [ -n $PID ]; + then + nscd -K 2>&1 >/dev/null + rm -f "/run/$SERVICE.pid" 2>&1 >/dev/null + fi + ;; + *) + echo "usage: $0 -s|-k" + exit 1 +esac + diff --git a/svc.d/avail/ntpd b/svc.d/avail/ntpd @@ -0,0 +1,32 @@ +#!/bin/sh + +SERVICE="ntpd" + +[ -e "/etc/svc/default/$SERVICE" ] && . "/etc/svc/default/$SERVICE" + +BIN="/bin/$SERVICE" + +PID=$(pidof -o %PPID $BIN) + +case $1 in + -s) + if [ -z "$PID" ]; + then + mkdir -p /run/openntpd >/dev/null 2>&1 + $BIN $PARAMS >/dev/null 2>&1 & + fi + ;; + -k) + if [ -n "$PID" ]; + then + for p in $PID; + do + kill -9 $p >/dev/null 2>&1 + done + fi + ;; + *) + echo "usage: $0 -s|-k" + exit 1 +esac + diff --git a/svc.d/avail/oscam b/svc.d/avail/oscam diff --git a/svc.d/avail/rfkill b/svc.d/avail/rfkill @@ -0,0 +1,23 @@ +#!/bin/sh + +. /etc/svc/default/rfkill + +case $1 in + -s) + for s in $BLOCK; + do + rfkill block $s + done + + for s in $UNBLOCK + do + rfkill unblock $s + done + ;; + -k) + ;; + *) + echo "usage: $0 -s|-k" + exit 1 +esac + diff --git a/svc.d/avail/rfkilld b/svc.d/avail/rfkilld diff --git a/svc.d/avail/sensors b/svc.d/avail/sensors @@ -0,0 +1,18 @@ +#!/bin/sh + +. /etc/svc/default/sensors + +case $1 in + -s) + for m in $HWMON_MODULES; + do + modprobe $m + done + ;; + -k) + ;; + *) + echo "usage: $0 -s|-k" + exit 1 +esac + diff --git a/svc.d/avail/sshd b/svc.d/avail/sshd @@ -0,0 +1,33 @@ +#!/bin/sh + +SERVICE="sshd" + +[ -e "/etc/svc/default/$SERVICE" ] && . "/etc/svc/default/$SERVICE" + +BIN="" +for p in /bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin; +do + if [ -x "$p/$SERVICE" ]; + then + BIN="$p/$SERVICE" + break + fi +done +[ -z "$BIN" ] && exit 1 + +PID=$(pidof -o %PPID $BIN) + +case $1 in + -s) + ssh-keygen -A + [ -d /var/empty ] || mkdir -p /var/empty + [ -z "$PID" ] && $BIN $PARAMS; + ;; + -k) + [ -n "$PID" ] && kill -9 $PID &> /dev/null; + ;; + *) + echo "usage: $0 -s|-k" + exit 1 +esac + diff --git a/svc.d/avail/syslog-ng b/svc.d/avail/syslog-ng diff --git a/svc.d/avail/thinkfan b/svc.d/avail/thinkfan @@ -0,0 +1,29 @@ +#!/bin/sh + +SERVICE="thinkfan" +BIN="/usr/bin/thinkfan" +PIDFILE="/var/run/thinkfan.pid" + +[ -e "/etc/svc/default/$SERVICE" ] && . "/etc/svc/default/$SERVICE" + +if [ -e "$PIDFILE" ]; +then + PID="$(cat "$PIDFILE")" +else + PID=$(pidof -o %PPID $BIN) +fi + +case $1 in + -s) + [ -e "$PIDFILE" ] && rm -f "$PIDFILE" && PID="" + [ -z "$PID" ] && $BIN $PARAMS >/dev/null 2>&1; + ;; + -k) + [ -n "$PID" ] && kill -HUP $PID &> /dev/null; + [ -e "$PIDFILE" ] && rm -f "$PIDFILE" + ;; + *) + echo "usage: $0 -s|-k" + exit 1 +esac + diff --git a/svc.d/avail/wireless-regdom b/svc.d/avail/wireless-regdom @@ -0,0 +1,15 @@ +#!/bin/sh + +. /etc/svc/default/wireless-regdom + +case $1 in + -s) + ;; + -k) + iw reg set $REGDOM + ;; + *) + echo "usage: $0 -s|-k" + exit 1 +esac + diff --git a/svc.d/bare.sh b/svc.d/bare.sh @@ -0,0 +1,37 @@ +#!/bin/sh + +[ $# -eq 0 ] && SERVICE="$0" + +if [ $# -gt 0 ]; +then + SERVICE="$1" + shift 1 +fi + +[ -e "/etc/svc/default/$SERVICE" ] && . "/etc/svc/default/$SERVICE" + +BIN="" +for p in /bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin; +do + if [ -x "$p/$SERVICE" ]; + then + BIN="$p/$SERVICE" + break + fi +done +[ -z "$BIN" ] && exit 1 + +PID=$(pidof -o %PPID $BIN) + +case $1 in + -s) + [ -z "$PID" ] && $BIN $PARAMS; + ;; + -k) + [ -n "$PID" ] && kill -9 $PID &> /dev/null; + ;; + *) + echo "usage: $0 -s|-k" + exit 1 +esac + diff --git a/svc.d/default/alsa b/svc.d/default/alsa @@ -0,0 +1,6 @@ +STATEFILE="/var/lib/alsa/asound.state" +PARAMS="" +SAVEVOLUME="yes" +MUTEVOLUME="no" +POWERSAVE=0 + diff --git a/svc.d/default/crond b/svc.d/default/crond @@ -0,0 +1,2 @@ +PARAMS="-s /etc/cron/cron.d -c /var/spool/cron -t /var/spool/cron -S -l info" + diff --git a/svc.d/default/dovecot b/svc.d/default/dovecot @@ -0,0 +1,2 @@ +PARAMS="-c /etc/dovecot/dovecot.conf" + diff --git a/svc.d/default/fancontrol b/svc.d/default/fancontrol @@ -0,0 +1,2 @@ +PARAMS="-D" + diff --git a/svc.d/default/gpsd b/svc.d/default/gpsd @@ -0,0 +1,2 @@ +PARAMS="-F /run/gpsd.sock /dev/ttyUSB0" + diff --git a/svc.d/default/hostapd b/svc.d/default/hostapd @@ -0,0 +1,2 @@ +PARAMS="-B /etc/hostapd/hostapd.conf" + diff --git a/svc.d/default/hwclock b/svc.d/default/hwclock @@ -0,0 +1,3 @@ +# --utc or --localtime +PARAMS="--utc" + diff --git a/svc.d/default/ntpd b/svc.d/default/ntpd @@ -0,0 +1,2 @@ +PARAMS="-s" + diff --git a/svc.d/default/oscam b/svc.d/default/oscam @@ -0,0 +1,2 @@ +PARAMS="-b -c /etc/oscam" + diff --git a/svc.d/default/rfkill b/svc.d/default/rfkill @@ -0,0 +1,3 @@ +BLOCK="wwan bluetooth" +UNBLOCK="wifi" + diff --git a/svc.d/default/sensors b/svc.d/default/sensors @@ -0,0 +1,5 @@ +# Get here the HWMON_MODULES from the generated lm_sensors file, which +# sensors-detect(8) generates. + +HWMON_MODULES="coretemp" + diff --git a/svc.d/default/wireless-regdom b/svc.d/default/wireless-regdom @@ -0,0 +1,2 @@ +REGDOM="de" + diff --git a/svc.d/run/acpid b/svc.d/run/acpid @@ -0,0 +1 @@ +../avail/acpid+ \ No newline at end of file diff --git a/svc.d/run/alsa b/svc.d/run/alsa @@ -0,0 +1 @@ +../avail/alsa+ \ No newline at end of file diff --git a/svc.d/run/atd b/svc.d/run/atd @@ -0,0 +1 @@ +../avail/atd+ \ No newline at end of file diff --git a/svc.d/run/crond b/svc.d/run/crond @@ -0,0 +1 @@ +../avail/crond+ \ No newline at end of file diff --git a/svc.d/run/dovecot b/svc.d/run/dovecot @@ -0,0 +1 @@ +../avail/dovecot+ \ No newline at end of file diff --git a/svc.d/run/gpsd b/svc.d/run/gpsd @@ -0,0 +1 @@ +../avail/gpsd+ \ No newline at end of file diff --git a/svc.d/run/hwclock b/svc.d/run/hwclock @@ -0,0 +1 @@ +../avail/hwclock+ \ No newline at end of file diff --git a/svc.d/run/laptop-mode b/svc.d/run/laptop-mode @@ -0,0 +1 @@ +../avail/laptop-mode+ \ No newline at end of file diff --git a/svc.d/run/nscd b/svc.d/run/nscd @@ -0,0 +1 @@ +../avail/nscd+ \ No newline at end of file diff --git a/svc.d/run/rfkill b/svc.d/run/rfkill @@ -0,0 +1 @@ +../avail/rfkill+ \ No newline at end of file diff --git a/svc.d/run/rfkilld b/svc.d/run/rfkilld @@ -0,0 +1 @@ +../avail/rfkilld+ \ No newline at end of file diff --git a/svc.d/run/sensors b/svc.d/run/sensors @@ -0,0 +1 @@ +../avail/sensors+ \ No newline at end of file diff --git a/svc.d/run/sshd b/svc.d/run/sshd @@ -0,0 +1 @@ +../avail/sshd+ \ No newline at end of file diff --git a/svc.d/run/syslog-ng b/svc.d/run/syslog-ng @@ -0,0 +1 @@ +../avail/syslog-ng+ \ No newline at end of file diff --git a/svc.d/run/wireless-regdom b/svc.d/run/wireless-regdom @@ -0,0 +1 @@ +../avail/wireless-regdom+ \ No newline at end of file diff --git a/svc/avail/acpid b/svc/avail/acpid diff --git a/svc/avail/alsa b/svc/avail/alsa @@ -1,33 +0,0 @@ -#!/bin/sh - -SERVICE="alsa" - -[ -e "/svc/default/$SERVICE" ] && . "/svc/default/$SERVICE" - -PID=$(pidof -o %PPID $BIN) - -case $1 in - -s) - [ -e "$STATEFILE" ] || alsactl $PARAMS store - alsactl $PARAMS restore - - dfiles="/sys/modules/snd_ac97_codec/parameters/power_save - /sys/modules/snd_hda_intel/parameters/power_save" - for f in dfiles; - do - if [ -e $f ]; - then - echo $POWERSAVE > $f - [ -c /dev/dsp ] && echo 1 > /dev/dsp - fi - done - ;; - -k) - [ "$SAVEVOLUME" = "yes" ] && alsactl $PARAMS store - [ "$MUTEVOLUME" = "yes" ] && amixer -q set Master 0 mute - ;; - *) - echo "usage: $0 -s|-k" - exit 1 -esac - diff --git a/svc/avail/atd b/svc/avail/atd diff --git a/svc/avail/barebone b/svc/avail/barebone @@ -1,22 +0,0 @@ -#!/bin/sh - -SERVICE="barebone" - -[ -e "/svc/default/$SERVICE" ] && . "/svc/default/$SERVICE" - -BIN="/usr/bin/$SERVICE" - -PID=$(pidof -o %PPID $BIN) - -case $1 in - -s) - [ -z "$PID" ] && $BIN $PARAMS; - ;; - -k) - [ -n "$PID" ] && kill -9 $PID &> /dev/null; - ;; - *) - echo "usage: $0 -s|-k" - exit 1 -esac - diff --git a/svc/avail/crond b/svc/avail/crond diff --git a/svc/avail/dovecot b/svc/avail/dovecot diff --git a/svc/avail/fancontrol b/svc/avail/fancontrol @@ -1,32 +0,0 @@ -#!/bin/sh - -set -x - -SERVICE="fancontrol" - -[ -e "/svc/default/$SERVICE" ] && . "/svc/default/$SERVICE" - -BIN="/usr/sbin/$SERVICE" - -PID=$(pidof -o %PPID -x $BIN) - -case $1 in - -s) - [ -z "$PID" ] && { - rm /run/fancontrol.pid - $BIN $PARAMS - } - ;; - -k) - [ -n "$PID" ] && { - for p in $PID; - do - kill -9 $p &> /dev/null; - done - } - ;; - *) - echo "usage: $0 -s|-k" - exit 1 -esac - diff --git a/svc/avail/gpsd b/svc/avail/gpsd diff --git a/svc/avail/hostapd b/svc/avail/hostapd diff --git a/svc/avail/hwclock b/svc/avail/hwclock @@ -1,15 +0,0 @@ -#!/bin/sh - -. /svc/default/hwclock - -case $1 in - -s) - ;; - -k) - hwclock --adjust $PARAMS - ;; - *) - echo "usage: $0 -s|-k" - exit 1 -esac - diff --git a/svc/avail/input-event-daemon b/svc/avail/input-event-daemon diff --git a/svc/avail/laptop-mode b/svc/avail/laptop-mode @@ -1,24 +0,0 @@ -#!/bin/sh - -SERVICE="laptop-mode" - -[ -e "/svc/default/$SERVICE" ] && . "/svc/default/$SERVICE" - -BIN="/usr/sbin/$SERVICE" - -case $1 in - -s) - [ ! -d /run/laptop-mode-tools ] && install -d /run/laptop-mode-tools - rm -f /run/laptop-mode-tools/* - touch /run/laptop-mode-tools/enabled - $BIN auto 2>&1 >/dev/null - ;; - -k) - rm -f /run/laptop-mode-tools/enabled - $BIN stop 2>&1 >/dev/null - ;; - *) - echo "usage: $0 -s|-k" - exit 1 -esac - diff --git a/svc/avail/nscd b/svc/avail/nscd @@ -1,31 +0,0 @@ -#!/bin/sh - -SERVICE="nscd" - -BIN="/usr/sbin/$SERVICE" - -PID=$(pidof -o %PPID $BIN) - -case $1 in - -s) - if [ -z $PID ]; - then - rm -f "/run/$SERVICE.pid" 2>&1 >/dev/null - mkdir -p /run/nscd /var/db/nscd - rm -f /run/nscd/* /var/db/nscd/* 2>&1 >/dev/null - - $BIN $PARAMS; - fi - ;; - -k) - if [ -n $PID ]; - then - nscd --shutdown 2>&1 >/dev/null - rm -f "/run/$SERVICE.pid" 2>&1 >/dev/null - fi - ;; - *) - echo "usage: $0 -s|-k" - exit 1 -esac - diff --git a/svc/avail/oscam b/svc/avail/oscam diff --git a/svc/avail/rfkill b/svc/avail/rfkill @@ -1,23 +0,0 @@ -#!/bin/sh - -. /svc/default/rfkill - -case $1 in - -s) - for s in $BLOCK; - do - rfkill block $s - done - - for s in $UNBLOCK - do - rfkill unblock $s - done - ;; - -k) - ;; - *) - echo "usage: $0 -s|-k" - exit 1 -esac - diff --git a/svc/avail/rfkilld b/svc/avail/rfkilld diff --git a/svc/avail/sensors b/svc/avail/sensors @@ -1,18 +0,0 @@ -#!/bin/sh - -. /svc/default/sensors - -case $1 in - -s) - for m in $HWMON_MODULES; - do - modprobe $m - done - ;; - -k) - ;; - *) - echo "usage: $0 -s|-k" - exit 1 -esac - diff --git a/svc/avail/sshd b/svc/avail/sshd @@ -1,33 +0,0 @@ -#!/bin/sh - -SERVICE="sshd" - -[ -e "/svc/default/$SERVICE" ] && . "/svc/default/$SERVICE" - -BIN="" -for p in /bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin; -do - if [ -x "$p/$SERVICE" ]; - then - BIN="$p/$SERVICE" - break - fi -done -[ -z "$BIN" ] && exit 1 - -PID=$(pidof -o %PPID $BIN) - -case $1 in - -s) - ssh-keygen -A - [ -d /var/empty ] || mkdir -p /var/empty - [ -z "$PID" ] && $BIN $PARAMS; - ;; - -k) - [ -n "$PID" ] && kill -9 $PID &> /dev/null; - ;; - *) - echo "usage: $0 -s|-k" - exit 1 -esac - diff --git a/svc/avail/syslog-ng b/svc/avail/syslog-ng diff --git a/svc/avail/wireless-regdom b/svc/avail/wireless-regdom @@ -1,15 +0,0 @@ -#!/bin/sh - -. /svc/default/wireless-regdom - -case $1 in - -s) - ;; - -k) - iw reg set $REGDOM - ;; - *) - echo "usage: $0 -s|-k" - exit 1 -esac - diff --git a/svc/bare.sh b/svc/bare.sh @@ -1,37 +0,0 @@ -#!/bin/sh - -[ $# -eq 0 ] && SERVICE="$0" - -if [ $# -gt 0 ]; -then - SERVICE="$1" - shift 1 -fi - -[ -e "/svc/default/$SERVICE" ] && . "/svc/default/$SERVICE" - -BIN="" -for p in /bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin; -do - if [ -x "$p/$SERVICE" ]; - then - BIN="$p/$SERVICE" - break - fi -done -[ -z "$BIN" ] && exit 1 - -PID=$(pidof -o %PPID $BIN) - -case $1 in - -s) - [ -z "$PID" ] && $BIN $PARAMS; - ;; - -k) - [ -n "$PID" ] && kill -9 $PID &> /dev/null; - ;; - *) - echo "usage: $0 -s|-k" - exit 1 -esac - diff --git a/svc/default/alsa b/svc/default/alsa @@ -1,6 +0,0 @@ -STATEFILE="/var/lib/alsa/asound.state" -PARAMS="" -SAVEVOLUME="yes" -MUTEVOLUME="no" -POWERSAVE=0 - diff --git a/svc/default/crond b/svc/default/crond @@ -1,2 +0,0 @@ -PARAMS="-s /cron/cron.d -c /cron/crontabs -t /cron/cronstamps -S -l info" - diff --git a/svc/default/dovecot b/svc/default/dovecot @@ -1,2 +0,0 @@ -PARAMS="-c /cfg/dovecot/dovecot.conf" - diff --git a/svc/default/fancontrol b/svc/default/fancontrol @@ -1,2 +0,0 @@ -PARAMS="-D" - diff --git a/svc/default/gpsd b/svc/default/gpsd @@ -1,2 +0,0 @@ -PARAMS="-F /run/gpsd.sock /dev/ttyUSB0" - diff --git a/svc/default/hostapd b/svc/default/hostapd @@ -1,2 +0,0 @@ -PARAMS="-B /cfg/hostapd/hostapd.conf" - diff --git a/svc/default/hwclock b/svc/default/hwclock @@ -1,3 +0,0 @@ -# --utc or --localtime -PARAMS="--utc" - diff --git a/svc/default/oscam b/svc/default/oscam @@ -1,2 +0,0 @@ -PARAMS="-b -c /cfg/oscam" - diff --git a/svc/default/rfkill b/svc/default/rfkill @@ -1,3 +0,0 @@ -BLOCK="wwan bluetooth" -UNBLOCK="wifi" - diff --git a/svc/default/sensors b/svc/default/sensors @@ -1,5 +0,0 @@ -# Get here the HWMON_MODULES from the generated lm_sensors file, which -# sensors-detect(8) generates. - -HWMON_MODULES="coretemp" - diff --git a/svc/default/wireless-regdom b/svc/default/wireless-regdom @@ -1,2 +0,0 @@ -REGDOM="de" -