initscripts/etc/rc.d/init.d/localnet
2011-04-26 12:26:24 +02:00

43 lines
931 B
Bash
Executable File

#!/bin/sh
# localnet - Loopback device
# Based on localnet script from LFS-3.1 and earlier.
# Rewritten by Gerard Beekmans <gerard@linuxfromscratch.org>
. /etc/sysconfig/rc
. $rc_functions
[ -r /etc/sysconfig/network ] && . /etc/sysconfig/network
case "$1" in
start)
echo -n "Bringing up the loopback interface..."
ifconfig lo 127.0.0.1
[ $? -eq 0 ] && echo_success || echo_failure
echo
echo -n "Setting hostname to $HOSTNAME..."
hostname $HOSTNAME
[ $? -eq 0 ] && echo_success || echo_failure
echo
;;
stop)
echo -n "Bringing down the loopback interface..."
ifconfig lo down
[ $? -eq 0 ] && echo_success || echo_failure
echo
;;
restart)
$0 stop
sleep 1
$0 start
;;
status)
echo "Hostname is: $(hostname)"
ifconfig lo
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
;;
esac