Bug 835947 - [RFE] rlDaemonize - daemonize a given command
Summary: [RFE] rlDaemonize - daemonize a given command
Keywords:
Status: ASSIGNED
Alias: None
Product: Fedora
Classification: Fedora
Component: beakerlib
Version: rawhide
Hardware: Unspecified
OS: Unspecified
low
medium
Target Milestone: ---
Assignee: Dalibor Pospíšil
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: Release
Depends On:
Blocks: 1333921
TreeView+ depends on / blocked
 
Reported: 2012-06-27 15:42 UTC by Jiri Jaburek
Modified: 2017-11-27 15:46 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)
[PATCH] daemonize.py: added, backend for rlDaemonize (6.29 KB, patch)
2012-06-27 15:42 UTC, Jiri Jaburek
no flags Details | Diff

Description Jiri Jaburek 2012-06-27 15:42:08 UTC
Created attachment 594819 [details]
[PATCH] daemonize.py: added, backend for rlDaemonize

Usage:
  rlDaemonize [options] "command arg1 arg2 arg3"

rlDaemonize is a python script able to fork / fully daemonize any given command. It uses fork and execvp, it is therefore able to easily use commands in PATH.

Bash "jobs" are not well suited for daemonization - they are overly verbose when spawning / terminating a job (which is a problem with thousands of jobs) and they don't support full daemonization (double fork, setsid, ...) when it's needed. Furthermore, syntax to achieve more complex scenario (ie. pidfile + run as another user + redirect stdio) is very complex.

Common use case for rlDaemonize would be spawning ie. systemtap as daemon, with stdio redirected to log file(s).


The main (python) part with input sanity checks is finished, attached as a patch against latest beakerlib/master, however the bash wrapper part is missing, since I'm unsure how it should be done.
Note that daemonize.py expects command for daemonization with all its arguments as a single command line argument, just like the rlRun function.


$ ./daemonize.py --help
Usage: daemonize.py [options] COMMAND

Options:
  -h, --help            show this help message and exit
  --alias=NAME          specify custom argv[0]
  --background          background (fork) only, nothing else
  --su=USER:GROUP       run daemon under another user
  --ioredir=IN,OUT,ERR  redirect std{in,out,err} of the daemon to files
  --pidfile=FILE        write daemon pid to a file

Comment 1 Dalibor Pospíšil 2017-11-16 15:13:08 UTC
There's no demand for this feature from other side. We lean to not include it.
How important this feature is? Would it make sence to distribute it via a library?

Comment 2 Jiri Jaburek 2017-11-27 12:32:37 UTC
(In reply to Dalibor Pospíšil from comment #1)
> There's no demand for this feature from other side. We lean to not include
> it.
> How important this feature is? Would it make sence to distribute it via a
> library?

This is a bug from 2012, more than 5 years ago. I have no idea what the importance of this feature is now, in 2017.


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