From: <ef...@us...> - 2007-03-18 12:30:52
|
Revision: 744 http://svn.sourceforge.net/ganglia/?rev=744&view=rev Author: efocht Date: 2007-03-18 05:14:33 -0700 (Sun, 18 Mar 2007) Log Message: ----------- Renamed pcp to gexec-pcp (and the daemon, too) in order to avoid yet another name conflict: with Performance Co-Pilot, distributed as package pcp on SLES10. Added --daemon option (and code). Replaced init script with one that works for other distros than Redhat and Fedora. Updated version to 0.3.5. Modified Paths: -------------- trunk/gexec/pcp/Makefile.am trunk/gexec/pcp/configure.ac trunk/gexec/pcp/pcpd.c trunk/gexec/pcp/pcpd_options.c trunk/gexec/pcp/pcpd_options.h Added Paths: ----------- trunk/gexec/pcp/config/gexec-pcpd.in trunk/gexec/pcp/gexec-pcp.spec.in Removed Paths: ------------- trunk/gexec/pcp/config/pcpd.in trunk/gexec/pcp/mkinstalldirs trunk/gexec/pcp/pcp.spec.in Modified: trunk/gexec/pcp/Makefile.am =================================================================== --- trunk/gexec/pcp/Makefile.am 2007-03-18 12:03:37 UTC (rev 743) +++ trunk/gexec/pcp/Makefile.am 2007-03-18 12:14:33 UTC (rev 744) @@ -1,28 +1,28 @@ CFLAGS = -O2 -Wall -D_REENTRANT -g INCLUDES = -I. -bin_PROGRAMS = pcp -sbin_PROGRAMS = pcpd +bin_PROGRAMS = gexec-pcp +sbin_PROGRAMS = gexec-pcpd lib_LIBRARIES = libpcp.a include_HEADERS = pcp_lib.h -pcp_SOURCES = pcp.c pcp.h pcp_options.c pcp_options.h msg.h -pcpd_SOURCES = pcpd.c pcpd.h pcpd_options.c pcpd_options.h msg.h +gexec_pcp_SOURCES = pcp.c pcp.h pcp_options.c pcp_options.h msg.h +gexec_pcpd_SOURCES = pcpd.c pcpd.h pcpd_options.c pcpd_options.h msg.h libpcp_a_SOURCES = pcp_lib.c pcp_lib.h -pcp_LDADD = -lpthread -lssl -lcrypto -lpcp -le -lauth -pcpd_LDADD = -lpthread -lssl -lcrypto -le -lauth +gexec_pcp_LDADD = -lpthread -lssl -lcrypto -lpcp -le -lauth +gexec_pcpd_LDADD = -lpthread -lssl -lcrypto -le -lauth -pcp_LDFLAGS = -L. -pcpd_LDFLAGS = -L. +gexec_pcp_LDFLAGS = -L. +gexec_pcpd_LDFLAGS = -L. -EXTRA_DIST = config/pcpd.in pcp.spec +EXTRA_DIST = config/gexec-pcpd.in gexec-pcp.spec install-data-local: $(EXTRA_DIST) - $(INSTALL_SCRIPT) config/pcpd /etc/init.d/pcpd + $(INSTALL_SCRIPT) config/gexec-pcpd /etc/init.d/gexec-pcpd uninstall-local: $(EXTRA_DIST) - if [ -f /etc/init.d/pcpd ]; then \ - /etc/init.d/pcpd stop ; \ - rm -f /etc/init.d/pcpd ; \ + if [ -f /etc/init.d/gexec-pcpd ]; then \ + /etc/init.d/gexec-pcpd stop ; \ + rm -f /etc/init.d/gexec-pcpd ; \ fi Added: trunk/gexec/pcp/config/gexec-pcpd.in =================================================================== --- trunk/gexec/pcp/config/gexec-pcpd.in (rev 0) +++ trunk/gexec/pcp/config/gexec-pcpd.in 2007-03-18 12:14:33 UTC (rev 744) @@ -0,0 +1,89 @@ +#!/bin/bash +# +# chkconfig: 2345 20 80 +# description: gexec-pcpd startup script +# +# 1. This file should be installed as /etc/init.d/gexec-pcpd +# +# 2. Start jobmond with: +# +# /etc/init.d/gexec-pcpd start +# +# Source function library. +[ -f /etc/rc.d/init.d/functions ] && . /etc/rc.d/init.d/functions + +FULLPATH=@prefix@/sbin/gexec-pcpd +BASE=`basename $FULLPATH` +pidfile=/var/run/$BASE.pid + +runpid() { + local pid + pid=`pidof -o $$ -o $PPID $BASE` + echo $pid > $pidfile +} + +running() { + local pid running + if [ -f $pidfile ]; then + pid=`cat $pidfile` + running=`ps -wwe -o cmd $pid | grep -c $FULLPATH` + [ $running -eq 0 ] && pid="" + else + pid=`pidof -o $$ -o $PPID $BASE` + fi + echo $pid +} + +RETVAL=0 +case "$1" in + start) + echo -n "Starting $BASE: " + pid=`running` + if [ -n "$pid" ]; then + echo " ... process already running on $pid" + exit 1 + fi + $FULLPATH -d + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$BASE + [ $RETVAL -eq 0 ] && runpid + ;; + stop) + echo -n "Shutting down $BASE: " + pid=`running` + [ -n "$pid" ] && kill $pid + RETVAL=$? + [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$BASE $pidfile + [ $RETVAL -eq 0 ] || echo " ... failed" + echo + ;; + status) + if [ -f $pidfile ]; then + pid=`running` + if [ -n "$pid" ]; then + echo "$BASE (pid $pid) is running ..." + exit 0 + else + echo "$BASE is dead but pidfile exists" + exit 1 + fi + else + if [ -f /var/lock/subsys/$BASE ]; then + echo "$BASE is dead but subsystem is locked" + exit 2 + fi + fi + echo "$BASE is stopped" + exit 3 + ;; + restart) + $0 stop + $0 start + ;; + *) + echo "Usage: $0 {start|stop|status}" + exit 1 + ;; +esac +exit $RETVAL Deleted: trunk/gexec/pcp/config/pcpd.in =================================================================== --- trunk/gexec/pcp/config/pcpd.in 2007-03-18 12:03:37 UTC (rev 743) +++ trunk/gexec/pcp/config/pcpd.in 2007-03-18 12:14:33 UTC (rev 744) @@ -1,49 +0,0 @@ -#!/bin/bash -# -# chkconfig: 2345 20 80 -# description: pcpd startup script -# -# 1. This file should be installed as /etc/init.d/pcpd -# -# 2. Start pcpd with: -# -# /etc/init.d/pcpd start -# -# Source function library. -[ -f /etc/rc.d/init.d/functions ] || exit 0 -. /etc/rc.d/init.d/functions - -RETVAL=0 - -# -# The pathname substitution in daemon command assumes prefix and -# exec_prefix are same. This is the default, unless the user requests -# otherwise. -# -case "$1" in - start) - echo -n "Starting pcpd: " - daemon @prefix@/sbin/pcpd </dev/null >/dev/null 2>&1 & - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && touch /var/lock/subsys/pcpd - ;; - stop) - echo -n "Shutting down pcpd: " - killproc pcpd - RETVAL=$? - [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/pcpd - echo - ;; - status) - status pcpd - ;; - restart) - $0 stop - $0 start - ;; - *) - echo "Usage: $0 {start|stop}" - exit 1 - ;; -esac Modified: trunk/gexec/pcp/configure.ac =================================================================== --- trunk/gexec/pcp/configure.ac 2007-03-18 12:03:37 UTC (rev 743) +++ trunk/gexec/pcp/configure.ac 2007-03-18 12:14:33 UTC (rev 744) @@ -6,7 +6,7 @@ dnl dnl Sets PACKAGE and VERSION defines dnl -AM_INIT_AUTOMAKE(pcp,0.3.4) +AM_INIT_AUTOMAKE(gexec-pcp,0.3.5) dnl dnl Creates config.h file with #defines instead of passing to compiler. @@ -68,10 +68,6 @@ dnl Generate Makefiles (and other files) with substitutions. dnl AC_OUTPUT(Makefile \ - config/pcpd \ - pcp.spec) + config/gexec-pcpd \ + gexec-pcp.spec) - - - - Added: trunk/gexec/pcp/gexec-pcp.spec.in =================================================================== --- trunk/gexec/pcp/gexec-pcp.spec.in (rev 0) +++ trunk/gexec/pcp/gexec-pcp.spec.in 2007-03-18 12:14:33 UTC (rev 744) @@ -0,0 +1,63 @@ +Summary: pcp (parallel, pipelined file distribution) +Name: @PACKAGE@ +Version: @VERSION@ +Release: 4 +License: GPL +Group: System Environment/Daemons +Source: @PACKAGE@-@VERSION@.tar.gz +Requires: authd +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot + +%description +pcp (parallel, pipelined file distribution) + +%prep +%setup + +%build +%configure +make ROOT="$RPM_BUILD_ROOT" RPM_OPT_FLAGS="$RPM_OPT_FLAGS" + +%install +make DESTDIR="$RPM_BUILD_ROOT" install +install -D -m 755 config/gexec-pcpd $RPM_BUILD_ROOT/etc/init.d/gexec-pcpd + +%clean + +%files +%defattr(-, root, root) +/usr/sbin/gexec-pcpd +/usr/bin/gexec-pcp +/usr/%{_lib}/libpcp.a +/usr/include/pcp_lib.h +/etc/init.d/gexec-pcpd + +%post +if [ "$1" = 1 ]; then + /etc/init.d/gexec-pcpd restart + chkconfig --add gexec-pcpd +fi + +%preun +if [ "$1" = 0 ]; then + /etc/init.d/gexec-pcpd stop + chkconfig --del gexec-pcpd +fi + +%postun +if [ "$1" = 1 ]; then + /etc/init.d/gexec-pcpd restart +fi + +## +## CHANGELOG +## + +%changelog +* Fri Mar 09 2007 Erich Focht +- renamed to gexec-pcp in order to avoid conflict with performance co-pilot + rpm +* Thu Dec 07 2006 Erich Focht +- changed from xinetd to init.d daemon +- version update to 0.3.3-3 + Deleted: trunk/gexec/pcp/mkinstalldirs =================================================================== --- trunk/gexec/pcp/mkinstalldirs 2007-03-18 12:03:37 UTC (rev 743) +++ trunk/gexec/pcp/mkinstalldirs 2007-03-18 12:14:33 UTC (rev 744) @@ -1,40 +0,0 @@ -#! /bin/sh -# mkinstalldirs --- make directory hierarchy -# Author: Noah Friedman <fri...@pr...> -# Created: 1993-05-16 -# Public domain - -# $Id: mkinstalldirs,v 1.1.1.1 2002/02/28 06:34:59 plink Exp $ - -errstatus=0 - -for file -do - set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` - shift - - pathcomp= - for d - do - pathcomp="$pathcomp$d" - case "$pathcomp" in - -* ) pathcomp=./$pathcomp ;; - esac - - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" - - mkdir "$pathcomp" || lasterr=$? - - if test ! -d "$pathcomp"; then - errstatus=$lasterr - fi - fi - - pathcomp="$pathcomp/" - done -done - -exit $errstatus - -# mkinstalldirs ends here Deleted: trunk/gexec/pcp/pcp.spec.in =================================================================== --- trunk/gexec/pcp/pcp.spec.in 2007-03-18 12:03:37 UTC (rev 743) +++ trunk/gexec/pcp/pcp.spec.in 2007-03-18 12:14:33 UTC (rev 744) @@ -1,60 +0,0 @@ -Summary: pcp (parallel, pipelined file distribution) -Name: @PACKAGE@ -Version: @VERSION@ -Release: 4 -License: GPL -Group: System Environment/Daemons -Source: @PACKAGE@-@VERSION@.tar.gz -Requires: authd -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot - -%description -pcp (parallel, pipelined file distribution) - -%prep -%setup - -%build -%configure -make ROOT="$RPM_BUILD_ROOT" RPM_OPT_FLAGS="$RPM_OPT_FLAGS" - -%install -make DESTDIR="$RPM_BUILD_ROOT" install -install -D -m 755 config/pcpd $RPM_BUILD_ROOT/etc/init.d/pcpd - -%clean - -%files -%defattr(-, root, root) -/usr/sbin/pcpd -/usr/bin/pcp -/usr/%{_lib}/libpcp.a -/usr/include/pcp_lib.h -/etc/init.d/pcpd - -%post -if [ "$1" = 1 ]; then - /etc/init.d/pcpd restart - chkconfig --add pcpd -fi - -%preun -if [ "$1" = 0 ]; then - /etc/init.d/pcpd stop - chkconfig --del pcpd -fi - -%postun -if [ "$1" = 1 ]; then - /etc/init.d/pcpd restart -fi - -## -## CHANGELOG -## - -%changelog -* Thu Dec 07 2006 Erich Focht -- changed from xinetd to init.d daemon -- version update to 0.3.3-3 - Modified: trunk/gexec/pcp/pcpd.c =================================================================== --- trunk/gexec/pcp/pcpd.c 2007-03-18 12:03:37 UTC (rev 743) +++ trunk/gexec/pcp/pcpd.c 2007-03-18 12:14:33 UTC (rev 744) @@ -912,9 +912,11 @@ args->opts = &opts; pcpd_thr(args); xfree(args); + } else { + if (opts.daemon) + daemon(0, 0); + pcpd_standalone(&opts); } - else - pcpd_standalone(&opts); return 0; } Modified: trunk/gexec/pcp/pcpd_options.c =================================================================== --- trunk/gexec/pcp/pcpd_options.c 2007-03-18 12:03:37 UTC (rev 743) +++ trunk/gexec/pcp/pcpd_options.c 2007-03-18 12:14:33 UTC (rev 744) @@ -71,6 +71,7 @@ void pcpd_options_init(pcpd_options *opts) { opts->inetd = 0; + opts->daemon = 0; opts->port = PCP_DEF_PORT; } @@ -82,12 +83,13 @@ { { "help", no_argument, NULL, 'h' }, { "inetd", no_argument, NULL, 'i' }, + { "daemon", no_argument, NULL, 'd' }, { "version", no_argument, NULL, 'V' }, { "port", required_argument, NULL, 'P' }, { 0, 0, 0, 0 } }; - while ((c = getopt_long (argc, argv, "hiVP:", long_options, + while ((c = getopt_long (argc, argv, "hidVP:", long_options, (int *)0)) != EOF) { switch (c) { @@ -99,6 +101,10 @@ opts->inetd = 1; break; + case 'd': + opts->daemon = 1; + break; + case 'V': print_version(); exit(0); Modified: trunk/gexec/pcp/pcpd_options.h =================================================================== --- trunk/gexec/pcp/pcpd_options.h 2007-03-18 12:03:37 UTC (rev 743) +++ trunk/gexec/pcp/pcpd_options.h 2007-03-18 12:14:33 UTC (rev 744) @@ -22,6 +22,7 @@ typedef struct { int inetd; int port; + int daemon; } pcpd_options; void pcpd_options_init(pcpd_options *opts); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |