#!/usr/bin/env perl

use strict;
use warnings;
use System::InitD::GenInit;

my $geninit = System::InitD::GenInit->new();

$geninit->run();


exit 0;

__END__

=head1 NAME

geninitd

=head1 DESCRIPTION

Simple utility for init.d scripts creation.

It produces scripts like:

    #!/usr/bin/env perl
    # created by: noxx
    # check_whois: 
    #
    # chkconfig:    345 88 13
    # description:  whois server
    #
    ### BEGIN INIT INFO
    # Provides:          
    # Required-Start:
    # Required-Stop:
    # Should-Start:
    # Should-Stop:
    # Default-Start:     2 3 4 5
    # Default-Stop:      0 1 6
    # Short-Description: Start and stop whois daemon
    # Description:       
    ### END INIT INFO

    # This script generated by geninit tool

    use strict;
    use warnings;

    use System::InitD::Runner;

    # Config
    # path to pidfile here:
    my $PID             = '/var/run/whois/whois.pid';
    # start command here:
    my $START_COMMAND   = 'perl /www/srs/script/whois_async/whois_daemon.pl --user apache --group apache --port 4343 --daemonize --pid  $PID';
    # EXACT process name here:
    my $PROCESS_NAME    = 'whois_daemon_master';
    my $USAGE           = 'start|stop|usage|status';

    # Run
    my $runner = System::InitD::Runner->new(
        usage               =>  $USAGE,
        # proces name here:
        process_name        =>  $PROCESS_NAME,
        # start cmd here
        start               =>  $START_COMMAND,
        restart_timeout     =>  5,
        pid_file            =>  $PID,
    );

    $runner->run();

    1;



=head1 SYNOPSIS

B<--os>

Operating system. Script will be generated for it. Debian format by default.

B<--author>

Script's author, used for description.

B<--target>

Target file. If not, last parameter,

B<--pid-file> B<--pid_file>

Pid file of script, used for monitoring.

B<--process-name> B<--process_name>

B<Exact> process name of script in the ps output. Used for monitoring and manipulation.

B<--start-cmd> B<--start_cmd>

Start command

B<--service>

Service name. For example, my_cool_daemon.

=cut
