Search the FAQ Archives

3 - A - B - C - D - E - F - G - H - I - J - K - L - M
N - O - P - Q - R - S - T - U - V - W - X - Y - Z
faqs.org - Internet FAQ Archives

INN FAQ Part 2/9: Specific notes for specific operating systems
Section - (2.1) BASH tips

( Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Part8 - Part9 - Single Page )
[ Usenet FAQs | Web FAQs | Documents | RFC Index | Business Photos and Profiles ]


Top Document: INN FAQ Part 2/9: Specific notes for specific operating systems
Previous Document: Table Of Contents for Part 2/9
Next Document: (2.2) GNUS tips
See reader questions & answers on this topic! - Help others by sharing your knowledge
If you are using a Unix who's /bin/sh is a hardlink to
bash, you'll find problems using nntpsend.  nntpsend uses
a variable named PPID, which is a read-only variable in BASH.

You'll get errors that look like this:
sh: PPID: read-only variable

You can fix it using the the following patch:


*** nntpsend~   Thu Aug 12 03:36:16 1993
--- nntpsend    Sat Oct 23 15:54:11 1993
***************
*** 1,4 ****
! #! /bin/sh
  ##  $Revision: 2.34 $
  ##  Send news via NNTP by running several innxmit processes in the background.
  ##  Usage:
--- 1,4 ----
! #!/usr/local/bin/bash
  ##  $Revision: 2.34 $
  ##  Send news via NNTP by running several innxmit processes in the background.
  ##  Usage:
***************
*** 130,140 ****
      chmod 0660 ${LOG}
      exec >>${LOG} 2>&1
  fi
! PPID=$$
! echo "${PROGNAME}: [${PPID}] start"
  
  ##  Set up environment.
! export BATCH PROGNAME PPID INNFLAGS
  
  ##  Loop over all sites.
  cat ${INPUT} | while read SITE HOST MAXSIZE FLAGS; do
--- 130,140 ----
      chmod 0660 ${LOG}
      exec >>${LOG} 2>&1
  fi
! CPID=$$
! echo "${PROGNAME}: [${CPID}] start"
  
  ##  Set up environment.
! export BATCH PROGNAME CPID INNFLAGS
  
  ##  Loop over all sites.
  cat ${INPUT} | while read SITE HOST MAXSIZE FLAGS; do
***************
*** 240,246 ****
      fi
  
      ##  Start sending this site in the background.
!     export SITE HOST LOCKS BATCHFILE PROGNAME PPID SIZE TMPDIR
      sh -c '
        BATCHFILE=${HOST}.nntp
        LOCK=${LOCKS}/LOCK.${HOST}
--- 240,246 ----
      fi
  
      ##  Start sending this site in the background.
!     export SITE HOST LOCKS BATCHFILE PROGNAME CPID SIZE TMPDIR
      sh -c '
        BATCHFILE=${HOST}.nntp
        LOCK=${LOCKS}/LOCK.${HOST}
***************
*** 247,253 ****
        trap "rm -f ${LOCK} ; exit 1" 1 2 3 15
        shlock -p $$ -f ${LOCK} || {
            WHY="`cat ${LOCK}`"
!           echo "${PROGNAME}: [${PPID}:$$] ${HOST} locked ${WHY} `date`"
            exit
        }
        if [ -f ${SITE}.work ] ; then
--- 247,253 ----
        trap "rm -f ${LOCK} ; exit 1" 1 2 3 15
        shlock -p $$ -f ${LOCK} || {
            WHY="`cat ${LOCK}`"
!           echo "${PROGNAME}: [${CPID}:$$] ${HOST} locked ${WHY} `date`"
            exit
        }
        if [ -f ${SITE}.work ] ; then
***************
*** 254,259 ****
--- 254,260 ----
            cat ${SITE}.work >>${BATCHFILE}
            rm -f ${SITE}.work
        fi
+       if [ -s ${SITE} ] ; then
        mv ${SITE} ${SITE}.work
        if ctlinnd -s -t30 flush ${SITE} ; then
            cat ${SITE}.work >>${BATCHFILE}
***************
*** 260,273 ****
            rm -f ${SITE}.work
            test -n "${SIZE}" && shrinkfile -s${SIZE} -v ${BATCHFILE}
            if [ -s ${BATCHFILE} ] ; then
!               echo "${PROGNAME}: [${PPID}:$$] begin ${HOST} `date`"
!               echo "${PROGNAME}: [${PPID}:$$] innxmit ${INNFLAGS} ${HOST} ..."
                eval innxmit ${INNFLAGS} ${HOST} ${BATCH}/${BATCHFILE}
!               echo "${PROGNAME}: [${PPID}:$$] end ${HOST} `date`"
            else
                rm -f ${BATCHFILE}
            fi
        fi
        rm -f ${LOCK}
      ' &
      sleep 5
--- 261,275 ----
            rm -f ${SITE}.work
            test -n "${SIZE}" && shrinkfile -s${SIZE} -v ${BATCHFILE}
            if [ -s ${BATCHFILE} ] ; then
!               echo "${PROGNAME}: [${CPID}:$$] begin ${HOST} `date`"
!               echo "${PROGNAME}: [${CPID}:$$] innxmit ${INNFLAGS} ${HOST} ..."
                eval innxmit ${INNFLAGS} ${HOST} ${BATCH}/${BATCHFILE}
!               echo "${PROGNAME}: [${CPID}:$$] end ${HOST} `date`"
            else
                rm -f ${BATCHFILE}
            fi
        fi
+       fi
        rm -f ${LOCK}
      ' &
      sleep 5
***************
*** 275,278 ****
  
  wait
  rm -f ${INPUT}
! echo "${PROGNAME}: [${PPID}] stop"
--- 277,280 ----
  
  wait
  rm -f ${INPUT}
! echo "${PROGNAME}: [${CPID}] stop"

User Contributions:

Comment about this article, ask questions, or add new information about this topic:

CAPTCHA




Top Document: INN FAQ Part 2/9: Specific notes for specific operating systems
Previous Document: Table Of Contents for Part 2/9
Next Document: (2.2) GNUS tips

Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Part8 - Part9 - Single Page

[ Usenet FAQs | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
hwr@pilhuhn.de (Heiko W.Rupp)





Last Update November 21 2011 @ 01:00 PM