View previous topic :: View next topic |
Author |
Message |
umopdn
Joined: 25 Oct 2008 Posts: 2
|
Posted: Sat Oct 25, 2008 8:41 am Post subject: miniupnpd + rhel |
|
|
Hi.
I am in the process of setting up miniupnpd on my CentOS 5.2 installation.
The supplied init.d scripts for lsb-linux do not work on RHEL due to a difference in redhat-lsb structures.
So i'm going ahead and making a init.d script that's RHEL friendly (at least i hope), i'll post again when it's done and working on my box.
--- EDIT [New Info] ---
Oh, by the way, RHEL iptables-devel package doesnt seem to come with libiptc by default either.
So what you need to do is determine the exact version of iptables you have installed:
rpm -q iptables
rpm -q iptables-devel
Then download the source from netfilter.org, and copy the include/libiptc directory to your /usr/include/libiptc directory (create it if it's not there).
This will get miniupnpd to compile properly with make -f Makefile.linux on RHEL. _________________ -- umop apisdn |
|
Back to top |
|
 |
umopdn
Joined: 25 Oct 2008 Posts: 2
|
Posted: Sat Oct 25, 2008 10:56 am Post subject: 100% working on CentOS 5.2 (2.6) |
|
|
Ok, so here's the script I've made for RHEL. You can add it to chkconfig with the following command assuming the scripts location is /etc/init.d/miniupnpd :
Code: | # chkconfig --add miniupnpd |
Once this is added into chkconfig, you can now control it with the service syntax:
Code: | # service miniupnpd {start|stop|restart|status} |
I've also went ahead and made the init script take in some variables from /etc/sysconfig/miniupnpd, you can review the script to see what they are:
Code: |
#!/bin/sh
#
# "$Id: miniupnpd.init.d.rhel,v 1.00 2008/10/25 03:16:12 pmcgee Exp $"
#
# Startup/Shutdown/Restart script for miniupnpd daemon (init.d)
# on Red Hat Enterprise Linux
#
# Linux chkconfig stuff:
#
# chkconfig: 2345 90 30
# description: startup/shutdown/reset script for miniupnpd \
# on Red Hat Enterprise Linux
#
# processname: miniupnpd
# pidfile: /var/run/miniupnpd.pid
# configpath: /etc/miniupnpd/
# configfile: miniupnpd.conf
# Source function library.
. /etc/init.d/functions
# Include user config file if available
if [ -f /etc/sysconfig/miniupnpd ]; then
. /etc/sysconfig/miniupnpd
fi
# assign default values if nothing specific in /etc/sysconfig/miniupnpd
prog=${BINARY-"miniupnpd"}
binpath=${BINPATH-"/usr/sbin/"}
pidfile=$"${PIDPATH-"/var/run/"}$prog.pid"
configpath=${CONFIGPATH-"/etc/miniupnpd/"}
configfile=${CONFIGFILE-"miniupnpd.conf"}
iptinit=${IPTABLES_INIT-"iptables_init.sh"}
iptrm=${IPTABLES_REMOVE-"iptables_removeall.sh"}
iptshow=${IPTABLES_SHOW-"iptables_display.sh"}
ARGS=$"-f $configpath$configfile"
PROG=$"$binpath$prog"
IPT_INIT=$"$configpath$iptinit"
IPT_DELE=$"$configpath$iptrm"
IPT_SHOW=$"$configpath$iptshow"
RETVAL=0
start() {
echo -n $"Starting miniupnpd ($PROG): "
$IPT_INIT > /dev/null 2>&1
$PROG $ARGS && success || failure
RETVAL=$?
echo
}
stop() {
echo -n $"Stopping miniupnpd ($PROG): "
if [ -n "`pidfileofproc $PROG`" ] ; then
killproc $PROG
else
failure $"Stopping miniupnpd ($PROG)"
fi
RETVAL=$?
$IPT_DELE > /dev/null 2>&1
echo
}
mystatus() {
status $PROG
RETVAL=$?
echo
echo -n "Dumping IPTABLES Information: "
if [ -f $IPT_SHOW ]; then
echo
$IPT_SHOW
else
failure $"IP Tables display script not found"
fi
echo
}
# Parse CLI arguments
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload|force-reload)
stop
sleep 2
start
;;
status)
mystatus
;;
*)
echo $"Usage: $0 {start|stop|restart|status}"
RETVAL=1
esac
exit $RETVAL
|
I've tested this on my machine and it's working perfectly even on boot!
Machine: Linux samurai 2.6.18-92.el5 #1 SMP Tue Jun 10 18:49:47 EDT 2008 i686 athlon i386 GNU/Linux
OS: CentOS 5.2
Let me know if there are any issues with it.
One last note; the script makes use of the script iptables_display.sh which is not normally copied with the Makefile's install routine. To get this functionality you may want to copy that file over to the config directory. _________________ -- umop apisdn |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
© 2007 Thomas Bernard, author of MiniUPNP.
|