Changeset 11240

Show
Ignore:
Timestamp:
08/19/08 15:55:59 (5 months ago)
Author:
/C=ES/O=Warp Networks S.L./CN=ejhernandez@…
Message:

Manage runnerd process in remote service regen configuration refs #1103

Location:
branches/remote-services/ebox/src
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • branches/remote-services/ebox/src/EBox/RemoteServices.pm

    r11237 r11240  
    3535use EBox::Gettext; 
    3636use EBox::Global; 
     37use EBox::Service; 
    3738use EBox::Sudo; 
    3839 
    3940# Constants 
    40 use constant SERV_DIR      => EBox::Config::conf() . 'remoteservices/'; 
    41 use constant CA_DIR        => SERV_DIR . 'ssl-ca/'; 
    42 use constant SUBS_DIR      => SERV_DIR . 'subscription/'; 
    43 use constant WS_DISPATCHER => __PACKAGE__ . '::WSDispatcher'; 
     41use constant SERV_DIR        => EBox::Config::conf() . 'remoteservices/'; 
     42use constant CA_DIR          => SERV_DIR . 'ssl-ca/'; 
     43use constant SUBS_DIR        => SERV_DIR . 'subscription/'; 
     44use constant WS_DISPATCHER   => __PACKAGE__ . '::WSDispatcher'; 
     45use constant RUNNERD_SERVICE => 'ebox.runnerd'; 
    4446 
    4547# Group: Protected methods 
     
    99101 
    100102      $self->_confSOAPService(); 
     103      $self->_doDaemon(); 
    101104 
    102105      return; 
     
    112115sub _stopService 
    113116{ 
    114  
     117    my ($self) = @_; 
     118 
     119    EBox::Service::manage(RUNNERD_SERVICE, 'stop'); 
    115120} 
    116121 
     
    267272} 
    268273 
     274# Start/stop/restart runnerd daemon 
     275sub _doDaemon 
     276{ 
     277    my ($self) = @_; 
     278 
     279    if ( $self->eBoxSubscribed() ) { 
     280        if ( EBox::Service::running(RUNNERD_SERVICE) ) { 
     281            EBox::Service::manage(RUNNERD_SERVICE, 'restart'); 
     282        } else { 
     283            EBox::Service::manage(RUNNERD_SERVICE, 'start'); 
     284        } 
     285    } else { 
     286        EBox::Service::manage(RUNNERD_SERVICE, 'stop'); 
     287    } 
     288} 
     289 
    269290# Return the allowed prefix to send jobs 
    270291sub _allowedPrefix 
  • branches/remote-services/ebox/src/libexec/ebox-runnerd

    r11239 r11240  
    77use Linux::Inotify2; 
    88use POSIX qw(SIG_IGN SIGHUP); 
     9use Pod::Usage; 
    910 
    1011use constant JOBS_DIR      => EBox::Config::conf() . 'remoteservices/jobs/'; 
     
    122123 
    123124# Get arguments 
    124 my ($foreground) = (0); 
    125 my $result = GetOptions( 'foreground' => \$foreground ); 
     125my ($usage, $foreground) = (0, 0); 
     126my $correct = GetOptions( 
     127    'foreground' => \$foreground, 
     128    'usage|help' => \$usage 
     129   ); 
     130 
     131if ( $usage or (not $correct)) { 
     132    pod2usage(1); 
     133} 
    126134 
    127135EBox::init(); 
     
    158166 
    1591671; 
     168 
     169__END__ 
     170 
     171=head1 NAME 
     172 
     173ebox-runnerd - Daemon intended to run scripts which is placed under a 
     174               fixed directory which is watched by the daemon 
     175 
     176=head1 SYNOPSIS 
     177 
     178ebox-runnerd [--usage|help] [--foreground] 
     179 
     180 Options: 
     181    --foreground  Flag to indicate if daemon must be launched in foreground 
     182                  Default value: false 
     183    --usage|help  Print this help and exit 
     184 
     185=cut