]> git.pld-linux.org Git - packages/dnsmasq.git/blame - dnsmasq.init
- updated
[packages/dnsmasq.git] / dnsmasq.init
CommitLineData
18014e23 1#!/bin/sh
2#
3# Startup script for the DNS caching server
4#
a865fc00 5# chkconfig: 345 14 89
18014e23 6# description: This script starts your DNS caching server
7# processname: dnsmasq
8# pidfile: /var/run/dnsmasq.pid
9
10# Set some frequently user variables
11SERVICE=dnsmasq
12LOCKFILE=/var/lock/subsys/$SERVICE
13MSG=$SERVICE
14CMD=$SERVICE
15
16# Source funtion library
17. /etc/rc.d/init.d/functions
18
19# Get network config
20. /etc/sysconfig/network
21
22# Check that networking is up
23if is_no "$NETWORKING"; then
ae7f99d1 24 msg_network_down $MSG
18014e23 25 exit 1
26fi
27
28MAILHOSTNAME=""
29RESOLV_CONF=""
30DHCP_LEASE="/var/lib/dhcp/dhcpd.leases"
31DOMAIN_SUFFIX=`dnsdomainname`
4932272b 32OPTIONS=""
18014e23 33
34# Get service config
35[ -f "/etc/sysconfig/$SERVICE" ] && . "/etc/sysconfig/$SERVICE"
36
37# Set proper options for dnsmasq
18014e23 38[ -n "$MAILHOSTNAME" ] && OPTIONS="$OPTIONS -m $MAILHOSTNAME"
39[ -n "$RESOLV_CONF" ] && OPTIONS="$OPTIONS -r $RESOLV_CONF"
40[ -n "$DHCP_LEASE" ] && OPTIONS="$OPTIONS -l $DHCP_LEASE"
41[ -n "$DOMAIN_SUFFIX" ] && OPTIONS="$OPTIONS -s $DOMAIN_SUFFIX"
42
43# See how we were called.
44case "$1" in
45 start)
46 if [ ! -f "$LOCKFILE" ]; then
47 msg_starting $MSG
ae7f99d1 48 daemon $CMD $OPTIONS
18014e23 49 RETVAL=$?
ae7f99d1 50 [ $RETVAL -eq 0 ] && touch $LOCKFILE
18014e23 51 else
ae7f99d1 52 msg_already_running $MSG
18014e23 53 exit 1
54 fi
ae7f99d1 55 ;;
18014e23 56 stop)
57 if [ -f "$LOCKFILE" ]; then
58 msg_stopping $MSG
ae7f99d1 59 killproc $CMD
18014e23 60 rm -f $LOCKFILE >/dev/null 2>&1
61 else
ae7f99d1 62 msg_not_running $MSG
18014e23 63 exit 1
ae7f99d1 64 fi
65 ;;
18014e23 66 status)
67 status $CMD
68 exit $?
69 ;;
70 restart|reload)
71 $0 stop
72 $0 start
73 ;;
74 *)
ae7f99d1 75 msg_usage "$0 {start|stop|restart|reload|status}"
76 exit 1
18014e23 77esac
78
79exit $RETVAL
This page took 0.109411 seconds and 4 git commands to generate.