Files
perl-Proc-Daemon/perl-Proc-Daemon.spec

119 lines
3.3 KiB
RPMSpec
Raw Normal View History

#
# spec file for package perl-Proc-Daemon (Version 0.10)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: perl-Proc-Daemon
Version: 0.10
Release: 1
License: GPL+ or Artistic
%define cpan_name Proc-Daemon
Summary: Proc::Daemon Perl module
Url: http://search.cpan.org/dist/Proc-Daemon/
Group: Development/Libraries/Perl
Source: http://www.cpan.org/authors/id/D/DE/DETI/Proc/%{cpan_name}-%{version}.tar.gz
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: perl
BuildRequires: perl-macros
BuildRequires: perl(ExtUtils::MakeMaker)
BuildRequires: perl(POSIX)
Requires: perl(POSIX)
%{perl_requires}
%description
This module can be used by a Perl program to initialize itself as a daemon
or to execute ('exec') a system command as daemon. You can also check the
status of the daemon (alive or dead) and you can kill the daemon.
A daemon is a process that runs in the background with no controlling
terminal. Generally servers (like FTP, HTTP and SIP servers) run as daemon
processes. Do not make the mistake to think that a daemon is a server. ;-)
Proc::Daemon does the following:
* 1
The script forks a child.
* 2
The child changes the current working directory to the value of
'work_dir'.
* 3
The child clears the file creation mask.
* 4
The child becomes a session leader, which detaches the program from the
controlling terminal.
* 5
The child forks another child (the final daemon process). This prevents
the potential of acquiring a controlling terminal at all and detaches the
daemon completely from the first parent.
* 6
The second child closes all open file descriptors.
* 7
The second child opens STDIN, STDOUT and STDERR to the location defined
in the constructor ('new').
* 8
The second child returns to the calling script, or the program defined in
'exec_command' is executed and the second child never returns.
* 9
The first child transfers the PID of the second child (daemon) to the
parent and exits. Additionally the PID of the daemon process can be
written into a file if 'pid_file' is defined.
NOTE: Because of the second fork the daemon will not be a session-leader
and therefore Signals will not be send to other members of his process
group. If you need the functionality of a session-leader you may want to
call POSIX::setsid() manually at your daemon.
%prep
%setup -q -n %{cpan_name}-%{version}
%build
%{__perl} Makefile.PL INSTALLDIRS=vendor
%{__make} %{?_smp_mflags}
%check
%{__make} test
%install
%perl_make_install
%perl_process_packlist
%perl_gen_filelist
%clean
%{__rm} -rf %{buildroot}
%files -f %{name}.files
%defattr(-,root,root,755)
%doc Changes README
%changelog