/[packages]/cauldron/pxe/current/SOURCES/pxe
ViewVC logotype

Contents of /cauldron/pxe/current/SOURCES/pxe

Parent Directory Parent Directory | Revision Log Revision Log


Revision 49059 - (show annotations) (download)
Tue Feb 8 16:41:51 2011 UTC (13 years, 2 months ago) by ennael
File size: 2401 byte(s)
imported package pxe
1 #!/bin/bash
2 #
3 # Startup script handle the initialisation of PXE daemon
4 #
5 # chkconfig: 345 80 54
6 #
7 # description: A Preboot Execution Environment (PXE) Server. This
8 # server will allow you to network boot other PXE based machines.
9 #
10 # Script Authors: Erwan Velu <erwan@mandrakesoft.com>
11 # Antoine Ginies <aginies@mandrakesoft.com>
12 #
13 # Based on init script for pxe of Intel
14 #
15 #
16 # config: /etc/pxe.conf
17 #
18 ### BEGIN INIT INFO
19 # Provides: pxe
20 # Required-Start: dhcpd
21 # Required-Stop: dhcpd
22 # Default-Start: 3 4 5
23 # Short-Description: PXE daemon
24 # Description: A Preboot Execution Environment (PXE) Server. This server
25 # will allow you to network boot other PXE based machines.
26 ### END INIT INFO
27
28 # Source function library.
29 . /etc/rc.d/init.d/functions
30
31 PXE_CONF=/etc/pxe.conf
32 PXE_BIN=/usr/sbin/pxe
33 PXE_PID=/tmp/pxe.pid
34 LOCKFILE=/var/lock/subsys/pxe
35
36 RETVAL=0
37 #
38 # See how we were called.
39 #
40 case "$1" in
41 start)
42 if [ "$(pidof dhcpd)" = "" ]; then
43 gprintf "Dhcp server is not running on this machine !\n"
44 gprintf "Be sure that a valid PXE Dhcp server is running on your network\n"
45 fi
46
47 if [ ! -f ${PXE_CONF} ]; then
48 gprintf "${PXE_CONF} is not present !\n"
49 exit -1
50 fi
51
52 if [ ! -x ${PXE_BIN} ]; then
53 gprintf "${PXE_BIN} is not executable !\n"
54 exit -1
55 fi
56
57 # Looking for interface used for pxe service
58 INTERFACE=$(grep "interface=" ${PXE_CONF} | cut -d "=" -f 2);
59
60 # Check if pxe is already running
61 if [ "$(pidof pxe)" = "" ]; then
62 rm -rf $LOCKFILE
63 rm -rf $PXE_PID
64 route add -host 255.255.255.255 $INTERFACE 1>/dev/null 2>/dev/null
65 route add -net 224.0.0.0 netmask 224.0.0.0 $INTERFACE 1>/dev/null 2>/dev/null
66 echo -n 'Starting PXE server'
67 daemon ${PXE_BIN} -c ${PXE_CONF}
68 RETVAL=$?
69 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/pxe
70 echo
71 else
72 echo -n 'PXE server already started !'
73 echo
74 fi
75 ;;
76 stop)
77 #action "Stopping pxe daemon: "
78 route del 255.255.255.255 2>/dev/null
79 route del -net 224.0.0.0/3 2>/dev/null
80 echo -n 'Stopping PXE server'
81 killproc ${PXE_BIN}
82 rm -f ${PXE_PID}
83 RETVAL=$?
84 [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/pxe
85 echo
86 ;;
87 reload|restart)
88 $0 stop
89 $0 start
90 RETVAL=$?
91 ;;
92 status)
93 status ${PXE_BIN}
94 RETVAL=$?
95 ;;
96 *)
97 gprintf "Usage: /etc/rc.d/init.d/pxe {start|stop|restart|reload|status}\n"
98 exit 1
99 esac
100
101 exit $RETVAL

  ViewVC Help
Powered by ViewVC 1.1.30