diff options
author | P. J. McDermott <pj@pehjota.net> | 2014-06-02 20:02:43 (EDT) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2014-06-02 20:02:43 (EDT) |
commit | 62cf01e0161259ac9762125e89e1051008c2203c (patch) | |
tree | 3a8f379cc6e01a63ad67b6eb256731d11259ac5f | |
parent | 171da615c4d8d51ed5f4f2e445d6e19fc15c6f9a (diff) |
Convert some service scripts to /etc/rc.common.
-rwxr-xr-x | src.etc/init.d/hostname | 27 | ||||
-rwxr-xr-x | src.etc/init.d/httpd | 25 | ||||
-rwxr-xr-x | src.etc/init.d/klogd | 25 | ||||
-rwxr-xr-x | src.etc/init.d/mdev | 35 | ||||
-rwxr-xr-x | src.etc/init.d/networking | 27 | ||||
-rwxr-xr-x | src.etc/init.d/syslog | 25 | ||||
-rwxr-xr-x | src.etc/init.d/telnetd | 25 |
7 files changed, 28 insertions, 161 deletions
diff --git a/src.etc/init.d/hostname b/src.etc/init.d/hostname index f64407d..2a6ffac 100755 --- a/src.etc/init.d/hostname +++ b/src.etc/init.d/hostname @@ -1,24 +1,13 @@ -#!/bin/sh +#!/bin/sh /etc/rc.common start() { - [ -f /etc/hostname ] && HOSTNAME="$(cat /etc/hostname)" - [ -z "${HOSTNAME}" ] && HOSTNAME="$(hostname)" - [ -z "${HOSTNAME}" ] && HOSTNAME='localhost' + local hostname= - printf 'Setting hostname to %s... ' "${HOSTNAME}" - hostname "${HOSTNAME}" - printf 'done.\n' -} + [ -f /etc/hostname ] && hostname="$(cat /etc/hostname)" + [ -z "${hostname}" ] && hostname="$(hostname)" + [ -z "${hostname}" ] && hostname='localhost' -case "${1}" in - start) - start - ;; - stop) - ;; - *) - printf 'Usage: %s {start|stop}\n' "${0}" >&2 - exit 1 - ;; -esac + log 'Setting hostname to %s' "${hostname}" + hostname "${hostname}" +} diff --git a/src.etc/init.d/httpd b/src.etc/init.d/httpd index 1dc0d28..1207dfb 100755 --- a/src.etc/init.d/httpd +++ b/src.etc/init.d/httpd @@ -1,32 +1,13 @@ -#!/bin/sh +#!/bin/sh /etc/rc.common start() { - printf 'Starting httpd... ' + log 'Starting httpd' start-stop-daemon -S -q -n httpd -x /usr/sbin/httpd -- -h /var/www - printf 'done.\n' } stop() { - printf 'Stopping httpd... ' + log 'Stopping httpd' start-stop-daemon -K -q -n httpd - printf 'done.\n' } - -case "${1}" in - start) - start - ;; - stop) - stop - ;; - restart) - stop - start - ;; - *) - printf 'Usage: %s {start|stop|restart}\n' "${0}" >&2 - exit 1 - ;; -esac diff --git a/src.etc/init.d/klogd b/src.etc/init.d/klogd index 5a00ab9..c385d14 100755 --- a/src.etc/init.d/klogd +++ b/src.etc/init.d/klogd @@ -1,32 +1,13 @@ -#!/bin/sh +#!/bin/sh /etc/rc.common start() { - printf 'Starting klogd... ' + log 'Starting klogd' start-stop-daemon -S -q -n klogd -x /sbin/klogd - printf 'done.\n' } stop() { - printf 'Stopping klogd... ' + log 'Stopping klogd' start-stop-daemon -K -q -n klogd - printf 'done.\n' } - -case "${1}" in - start) - start - ;; - stop) - stop - ;; - restart) - stop - start - ;; - *) - printf 'Usage: %s {start|stop|restart}\n' "${0}" >&2 - exit 1 - ;; -esac diff --git a/src.etc/init.d/mdev b/src.etc/init.d/mdev index 8052c3b..79fbafd 100755 --- a/src.etc/init.d/mdev +++ b/src.etc/init.d/mdev @@ -1,53 +1,26 @@ -#!/bin/sh +#!/bin/sh /etc/rc.common start() { - printf 'Enabling device hotplugging... ' - + log 'Enabling device hotplugging' if ! mount | grep -Fq ' /dev '; then mount -t tmpfs -o noexec,nosuid,mode=0755 tmpfs /dev fi - printf '/sbin/mdev\n' >/proc/sys/kernel/hotplug mdev -s - - printf 'done.\n' } stop() { - printf 'Disabling device hotplugging... ' - + log 'Disabling device hotplugging' printf '\n' >/proc/sys/kernel/hotplug - if mount | grep -Fq ' /dev '; then umount /dev fi - - printf 'done.\n' } restart() { - printf 'Recanning devices... ' - + log 'Recanning devices' mdev -s - - printf 'done.\n' } - -case "${1}" in - start) - start - ;; - stop) - stop - ;; - restart) - restart - ;; - *) - printf 'Usage: %s {start|stop|restart}\n' "${0}" >&2 - exit 1 - ;; -esac diff --git a/src.etc/init.d/networking b/src.etc/init.d/networking index 66967f9..f53899f 100755 --- a/src.etc/init.d/networking +++ b/src.etc/init.d/networking @@ -1,40 +1,21 @@ -#!/bin/sh +#!/bin/sh /etc/rc.common start() { - printf 'Configuring network interfaces... ' + log 'Configuring network interfaces' ifdown -a >/dev/null 2>&1 ifup -a - printf 'done.\n' } stop() { - printf 'Deconfiguring network interfaces... ' + log 'Deconfiguring network interfaces' ifdown -a - printf 'done.\n' } restart() { - printf 'Reconfiguring network interfaces... ' + log 'Reconfiguring network interfaces' ifdown -a ifup -a - printf 'done.\n' } - -case "${1}" in - start) - start - ;; - stop) - stop - ;; - restart) - restart - ;; - *) - printf 'Usage: %s {start|stop|restart}\n' "${0}" >&2 - exit 1 - ;; -esac diff --git a/src.etc/init.d/syslog b/src.etc/init.d/syslog index 7d274ce..b39562f 100755 --- a/src.etc/init.d/syslog +++ b/src.etc/init.d/syslog @@ -1,35 +1,16 @@ -#!/bin/sh +#!/bin/sh /etc/rc.common SYSLOG_ROTATE_SIZE=65536 start() { - printf 'Starting syslog... ' + log 'Starting syslog' start-stop-daemon -S -q -n syslogd -x /sbin/syslogd -- \ -s "${SYSLOG_ROTATE_SIZE}" - printf 'done.\n' } stop() { - printf 'Stopping syslog... ' + log 'Stopping syslog' start-stop-daemon -K -q -n syslogd - printf 'done.\n' } - -case "${1}" in - start) - start - ;; - stop) - stop - ;; - restart) - stop - start - ;; - *) - printf 'Usage: %s {start|stop|restart}\n' "${0}" >&2 - exit 1 - ;; -esac diff --git a/src.etc/init.d/telnetd b/src.etc/init.d/telnetd index 0f51046..562e1d6 100755 --- a/src.etc/init.d/telnetd +++ b/src.etc/init.d/telnetd @@ -1,32 +1,13 @@ -#!/bin/sh +#!/bin/sh /etc/rc.common start() { - printf 'Starting telnetd... ' + log 'Starting telnetd' start-stop-daemon -S -q -n telnetd -x /usr/sbin/telnetd - printf 'done.\n' } stop() { - printf 'Stopping telnetd... ' + log 'Stopping telnetd' start-stop-daemon -K -q -n telnetd - printf 'done.\n' } - -case "${1}" in - start) - start - ;; - stop) - stop - ;; - restart) - stop - start - ;; - *) - printf 'Usage: %s {start|stop|restart}\n' "${0}" >&2 - exit 1 - ;; -esac |