Bug 221815 - run-parts will wait for processes put in background
run-parts will wait for processes put in background
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: crontabs (Show other bugs)
5
All Linux
medium Severity low
: ---
: ---
Assigned To: Marcela Mašláňová
Brock Organ
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-01-08 04:10 EST by Dan Fruehauf
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-01-18 08:26:01 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
a patch for run-parts to not wait for background processes (388 bytes, patch)
2007-01-08 04:10 EST, Dan Fruehauf
no flags Details | Diff

  None (edit)
Description Dan Fruehauf 2007-01-08 04:10:47 EST
Description of problem:
When running run-parts, it'll instantiate an awk program, this is all good and
ok, until you start to do some real things.
Assumine you have a script such as this :

example.sh :
#!/bin/bash
echo "hello"
sleep 10 &

And you would run :
./example.sh

It won't wait for the 'sleep 10 &' statement as it will be put in background.

But if you'd run :
./example.sh | awk '{print $1}'

You'd expect it to still quit immediately, but it doesn't, and I believe here
this is some normal awk behavior - I'm not reporting a bug on awk.

Problem comes when you'd use /usr/bin/run-parts, which does use awk to process
some output from the program, and just as well can cause any cronjob putting
some stuff in the background to halt, and wait.
Personally I witnessed it when combining a restart of mailman with run-parts,
which uses the 'daemon' function to run stuff in background - the result - the
cronjob would halt forever.

Some steps to reproduce, because I must provide it :
1. Create a new directory, say X for instance, and a script in it including the
lines :
#!/bin/bash
sleep 10 &

2. /usr/bin/run-parts X

Actual results:
It takes 10 seconds to complete.

Expected results:
Should complete immediately.

Additional info:
I'm including a patch, if what I'm describing is desired behavior, then a fix
should be done to the mailman service, or perhaps to the 'daemon' function.
Comment 1 Dan Fruehauf 2007-01-08 04:10:48 EST
Created attachment 145037 [details]
a patch for run-parts to not wait for background processes
Comment 2 Marcela Mašláňová 2007-01-18 08:26:01 EST
Hello,
thanks for report.

I don't think it's a bug but behaviour of bash/awk. It's a problem of correct
scripts for operation such these.

Note You need to log in before you can comment on or make changes to this bug.