summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2013-08-08 15:26:37 (EDT)
committer P. J. McDermott <pjm@nac.net>2013-08-08 15:26:37 (EDT)
commit60ee13961584e957020d30daf287d03e55a50763 (patch)
treeb6058d13da6bc00efee4d61b635df2e1a0158701
parent6b4e7447cb8e8d4265c2c8d846ac39de449c1ab1 (diff)
Rewrite init scripts.
-rwxr-xr-xsrc.etc/init.d/hostname19
-rwxr-xr-xsrc.etc/init.d/httpd26
-rw-r--r--src.etc/init.d/klogd32
-rwxr-xr-xsrc.etc/init.d/mdev30
-rwxr-xr-xsrc.etc/init.d/networking37
-rwxr-xr-xsrc.etc/init.d/syslog34
-rwxr-xr-xsrc.etc/init.d/telnetd26
7 files changed, 150 insertions, 54 deletions
diff --git a/src.etc/init.d/hostname b/src.etc/init.d/hostname
index aec1102..f64407d 100755
--- a/src.etc/init.d/hostname
+++ b/src.etc/init.d/hostname
@@ -1,13 +1,24 @@
#!/bin/sh
+start()
+{
+ [ -f /etc/hostname ] && HOSTNAME="$(cat /etc/hostname)"
+ [ -z "${HOSTNAME}" ] && HOSTNAME="$(hostname)"
+ [ -z "${HOSTNAME}" ] && HOSTNAME='localhost'
+
+ printf 'Setting hostname to %s... ' "${HOSTNAME}"
+ hostname "${HOSTNAME}"
+ printf 'done.\n'
+}
+
case "${1}" in
start)
- printf 'Setting hostname... '
- [ -f /etc/hostname ] && hostname -F /etc/hostname || hostname none
- printf 'done.\n'
+ start
+ ;;
+ stop)
;;
*)
- printf 'Usage: %s start\n' "${0}" >&2
+ printf 'Usage: %s {start|stop}\n' "${0}" >&2
exit 1
;;
esac
diff --git a/src.etc/init.d/httpd b/src.etc/init.d/httpd
index 6a3045d..5f0106c 100755
--- a/src.etc/init.d/httpd
+++ b/src.etc/init.d/httpd
@@ -1,19 +1,29 @@
#!/bin/sh
+start()
+{
+ printf 'Starting httpd...'
+ start-stop-daemon -S -q -n httpd -x httpd -- -h /var/www
+ printf 'done.\n'
+}
+
+stop()
+{
+ printf 'Stopping httpd... '
+ start-stop-daemon -K -q -n httpd
+ printf 'done.\n'
+}
+
case "${1}" in
start)
- printf 'Starting httpd...'
- start-stop-daemon -S -q -n httpd -x httpd -- -h /var/www
- printf 'done.'
+ start
;;
stop)
- printf 'Stopping httpd... '
- start-stop-daemon -K -q -n httpd
- printf 'done.'
+ stop
;;
restart)
- "${0}" stop
- "${0}" start
+ stop
+ start
;;
*)
printf 'Usage: %s {start|stop|restart}\n' "${0}"
diff --git a/src.etc/init.d/klogd b/src.etc/init.d/klogd
new file mode 100644
index 0000000..dd9e10e
--- /dev/null
+++ b/src.etc/init.d/klogd
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+start()
+{
+ printf 'Starting klogd... '
+ start-stop-daemon -S -q -n klogd -x klogd
+ printf 'done.\n'
+}
+
+stop()
+{
+ printf '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}"
+ exit 1
+ ;;
+esac
diff --git a/src.etc/init.d/mdev b/src.etc/init.d/mdev
index 66070f8..aa5f618 100755
--- a/src.etc/init.d/mdev
+++ b/src.etc/init.d/mdev
@@ -1,19 +1,33 @@
#!/bin/sh
+start()
+{
+ printf 'Enabling device hotplugging... '
+ printf '/sbin/mdev\n' >/proc/sys/kernel/hotplug
+ mdev -s
+ printf 'done.\n'
+}
+
+stop()
+{
+ printf 'Disabling device hotplugging... '
+ printf '\n' >/proc/sys/kernel/hotplug
+ printf 'done.\n'
+}
+
case "${1}" in
start)
- printf 'Enabling device hotplugging... '
- echo '/sbin/mdev' > /proc/sys/kernel/hotplug
- mdev -s
- printf 'done.\n'
+ start
;;
stop)
- printf 'Disabling device hotplugging... '
- echo '' > /proc/sys/kernel/hotplug
- printf 'done.\n'
+ stop
+ ;;
+ restart)
+ stop
+ start
;;
*)
- printf 'Usage: %s {start|stop}\n' "${0}" >&2
+ 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 12fb513..66967f9 100755
--- a/src.etc/init.d/networking
+++ b/src.etc/init.d/networking
@@ -1,22 +1,37 @@
#!/bin/sh
+start()
+{
+ printf 'Configuring network interfaces... '
+ ifdown -a >/dev/null 2>&1
+ ifup -a
+ printf 'done.\n'
+}
+
+stop()
+{
+ printf 'Deconfiguring network interfaces... '
+ ifdown -a
+ printf 'done.\n'
+}
+
+restart()
+{
+ printf 'Reconfiguring network interfaces... '
+ ifdown -a
+ ifup -a
+ printf 'done.\n'
+}
+
case "${1}" in
start)
- printf 'Configuring network interfaces... '
- ifdown -a > /dev/null 2>&1
- ifup -a
- printf 'done.\n'
+ start
;;
stop)
- printf 'Deconfiguring network interfaces... '
- ifdown -a
- printf 'done.\n'
+ stop
;;
restart)
- printf 'Reconfiguring network interfaces... '
- ifdown -a
- ifup -a
- printf 'done.\n'
+ restart
;;
*)
printf 'Usage: %s {start|stop|restart}\n' "${0}" >&2
diff --git a/src.etc/init.d/syslog b/src.etc/init.d/syslog
index 082f9bf..3a3e980 100755
--- a/src.etc/init.d/syslog
+++ b/src.etc/init.d/syslog
@@ -2,27 +2,31 @@
SYSLOG_ROTATE_SIZE=65536
+start()
+{
+ printf 'Starting syslog... '
+ start-stop-daemon -S -q -n syslogd -x syslogd -- \
+ -s "${SYSLOG_ROTATE_SIZE}"
+ printf 'done.\n'
+}
+
+stop()
+{
+ printf 'Stopping syslog... '
+ start-stop-daemon -K -q -n syslogd
+ printf 'done.\n'
+}
+
case "${1}" in
start)
- printf 'Starting syslog... '
- start-stop-daemon -S -q -n syslogd -x syslogd -- \
- -s "${SYSLOG_ROTATE_SIZE}"
- printf 'done.'
- printf 'Starting klogd... '
- start-stop-daemon -S -q -n klogd -x klogd
- printf 'done.'
+ start
;;
stop)
- printf 'Stopping klogd... '
- start-stop-daemon -K -q -n klogd
- printf 'done.'
- printf 'Stopping syslog... '
- start-stop-daemon -K -q -n syslogd
- printf 'done.'
+ stop
;;
restart)
- "${0}" stop
- "${0}" start
+ stop
+ start
;;
*)
printf 'Usage: %s {start|stop|restart}\n' "${0}"
diff --git a/src.etc/init.d/telnetd b/src.etc/init.d/telnetd
index be9043b..b38a663 100755
--- a/src.etc/init.d/telnetd
+++ b/src.etc/init.d/telnetd
@@ -1,19 +1,29 @@
#!/bin/sh
+start()
+{
+ printf 'Starting telnetd...'
+ start-stop-daemon -S -q -n telnetd -x telnetd
+ printf 'done.\n'
+}
+
+stop()
+{
+ printf 'Stopping telnetd... '
+ start-stop-daemon -K -q -n telnetd
+ printf 'done.\n'
+}
+
case "${1}" in
start)
- printf 'Starting telnetd...'
- start-stop-daemon -S -q -n telnetd -x telnetd
- printf 'done.'
+ start
;;
stop)
- printf 'Stopping telnetd... '
- start-stop-daemon -K -q -n telnetd
- printf 'done.'
+ stop
;;
restart)
- "${0}" stop
- "${0}" start
+ stop
+ start
;;
*)
printf 'Usage: %s {start|stop|restart}\n' "${0}"