Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"I will make no bargains with terrorist hardware." -- Peter da Silva


aus+uk / uk.comp.os.linux / Process Duplication Within for Loop

SubjectAuthor
o Process Duplication Within for LoopJava Jive

1
Process Duplication Within for Loop

<229388451@f1.n221.z2.fidonet.fi>

  copy mid

https://www.novabbs.com/aus+uk/article-flat.php?id=276&group=uk.comp.os.linux#276

  copy link   Newsgroups: uk.comp.os.linux
Path: i2pn2.org!i2pn.org!aioe.org!gp956LlpOagiJ1e33vgjfg.user.46.165.242.75.POSTED!not-for-mail
From: Java.J...@f1.n221.z2.fidonet.fi (Java Jive)
Newsgroups: uk.comp.os.linux
Subject: Process Duplication Within for Loop
Date: Sat, 24 Jul 2021 14:40:08 +0200
Organization: rbb soupgate
Message-ID: <229388451@f1.n221.z2.fidonet.fi>
Mime-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="56116"; posting-host="gp956LlpOagiJ1e33vgjfg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
X-Notice: Filtered by postfilter v. 0.9.2
X-Comment-To: All
X-MailConverter: SoupGate-OS/2 v1.20
 by: Java Jive - Sat, 24 Jul 2021 12:40 UTC

I have the following piece of code creating an rsync process launched in
the early hours of every morning to sync a NAS from another upstream. I
have only included the business part of the file, the beginning of it is
to do with setting up the variable values used in these lines. As you
will note, there are two debugging statements trapping the output of ps ...

# Debug Line 1:
ps | grep -v grep | grep tutsync.sh > $HD/rsync.log
echo "Syncing the following shares with rsync: ${SHARES}" >> $HD/rsync.log
for SHARE in ${SHARES}
do
# Debug Line 2:
ps | grep -v grep | grep tutsync.sh >> $HD/rsync.log
echo "nice -n ${NICE} rsync ${OPTIONS}
${SOURCE}/${SHARE}/ ${BU}/${SHARE}/"
nice -n ${NICE} rsync ${OPTIONS} ${SOURCE}/${SHARE}/
${BU}/${SHARE}/
done | grep -v '/$' >> $HD/rsync.log 2>&1

..... because, when run, the process appears to duplicate itself within
the for loop - not only does the tutsync.sh process itself get
duplicated, but also the rsync process it launches as well, as can be
proven by launching with a trailing & and running a similar command from
the shell:

~ # cat $HD/rsync.log
32453 root 2720 S /bin/sh /opt/share/bin/tutsync.sh
Syncing the following shares with rsync: A List Of Shares
32453 root 2720 S /bin/sh /opt/share/bin/tutsync.sh
32458 root 2720 S /bin/sh /opt/share/bin/tutsync.sh
receiving incremental file list
etc

~ # pf rsync
9680 root 1972 S /opt/bin/rsync --ipv4 --daemon
--config=/etc/rsyncd.conf
32467 root 2908 R N rsync -Drltugpv --exclude=*.flv
--exclude=*.partial.* --exclude=*.part --exclude=**/.streams
32468 root 49772 S N rsync -Drltugpv --exclude=*.flv
--exclude=*.partial.* --exclude=*.part --exclude=**/.streams

What is going on, why are the processes duplicating themselves?

--

Fake news kills!

I may be contacted via the contact address given on my website:
www.macfh.co.uk

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor