Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 924592

Summary: rhn_check fails with remote command running in background
Product: [Community] Spacewalk Reporter: Mikhail <legal90>
Component: ClientsAssignee: Milan Zázrivec <mzazrivec>
Status: CLOSED NOTABUG QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: high Docs Contact:
Priority: unspecified    
Version: 1.9   
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-03-22 07:56:43 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1484117    

Description Mikhail 2013-03-22 07:22:52 UTC
Description of problem:
Remote command ending with '&' do not fork out from rhn_check process. Command is running successfilly but it doesn't return the promt to parrent process. So, rhn_check still waiting the end of execution, like as '&' is absent.

Steps to Reproduce:
1. create remote command ending with '&' (for running in background)
2. run rhn_check on client machine
3.
  
Actual results:

Summary: 	Run an arbitrary script scheduled by spaceadmin
Details: 	This action will be executed after 03/22/13 9:41:00 AM MSK.

This action's status is: Failed.
The client picked up this action on 03/22/13 9:43:55 AM MSK.
The client completed this action on 03/22/13 9:45:59 AM MSK.
Client execution returned "Script killed, timeout of 120 seconds exceeded" (code 1)


Run as: root:root
Timeout: 120 seconds

#!/bin/sh
(tail -f /var/log/somelogfile > /tmp/dest_file) &


Start Date: 2013-03-22 00:00:00
End Date: 2013-03-22 00:00:00
Return Code: 0
Raw Output: view/download raw script output
Filtered Output:


Expected results:
rhn_check shouldn't wait the end of execution of remote command running in background (like as it happens with manual command execution in bash)

Additional info:
# rhn_check -vvv
<...>
D: do_call script.run(45, {'username': 'root', 'groupname': 'root', 'now': '2013-03-22 10:43:55', 'timeout': 120, 'script': '#!/bin/sh\n(tail -f /var/log/somelogfile > /tmp/dest_file) &'}){'cache_only': None}
D: Sending back response(1, 'Script killed, timeout of 120 seconds exceeded', {'output': '', 'base64enc': 1, 'process_end': '2013-03-22 10:45:57', 'return_code': 0, 'process_start': '2013-03-22 10:43:55'})
D: do_call packages.checkNeedUpdate('rhnsd=1',){}
<...>

Comment 1 Milan Zázrivec 2013-03-22 07:56:43 UTC
This is supposed to work this way.

When executing remote command, Spacewalk needs to know the result of
the action -- this is so that it can actually display whether or not
was the action successful.

If you need to execute a remote command which would have to stay running
on the machine, the remote process needs to be daemonized.

Comment 2 Eric Herget 2017-09-28 18:08:20 UTC
This BZ closed some time during 2.5, 2.6 or 2.7.  Adding to 2.7 tracking bug.