IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 19877


Ignore:
Timestamp:
Oct 2, 2008, 5:27:59 PM (18 years ago)
Author:
jhoblitt
Message:

add --user and --group options to nebdiskd to select the user/group that daemon will run as

Location:
trunk/Nebulous-Server
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous-Server/Changes

    r19797 r19877  
    1414      on hung NFS mounts
    1515    - document neb-voladd --host option
     16    - add --user and --group options to nebdiskd to select the user/group that
     17      daemon will run as
    1618
    17190.15 Thu Sep 11 13:00:59 HST 2008
  • trunk/Nebulous-Server/bin/nebdiskd

    r19871 r19877  
    33# Copyright (C) 2007  Joshua Hoblitt
    44#
    5 # $Id: nebdiskd,v 1.9 2008-10-03 00:41:55 jhoblitt Exp $
     5# $Id: nebdiskd,v 1.10 2008-10-03 03:27:59 jhoblitt Exp $
    66
    77use strict;
     
    2222use Pod::Usage qw( pod2usage );
    2323
    24 my ($debug, $db, $dbhost, $dbuser, $dbpass, $pidfile, $stop, $restart, $verbose);
     24my (
     25    $debug,
     26    $db,
     27    $dbhost,
     28    $dbuser,
     29    $dbpass,
     30    $pidfile,
     31    $stop,
     32    $restart,
     33    $verbose,
     34    $user,
     35    $group,
     36);
     37
    2538GetOptions(
    26     'db|d=s'    => \$db,
    27     'debug'     => \$debug,
    28     'host|h=s'  => \$dbhost,
    29     'pass|p=s'  => \$dbpass,
    30     'pidfile=s' => \$pidfile,
    31     'restart|r' => \$restart,
    32     'stop|s'    => \$stop,
    33     'user|u=s'  => \$dbuser,
    34     'verbose|v' => \$verbose,
     39    'dbhost|h=s'    => \$dbhost,
     40    'dbpass|p=s'    => \$dbpass,
     41    'dbuser|u=s'    => \$dbuser,
     42    'db|D=s'        => \$db,
     43    'debug|d'       => \$debug,
     44    'group|g=s'     => \$group,
     45    'pidfile=s'     => \$pidfile,
     46    'restart|r'     => \$restart,
     47    'stop|s'        => \$stop,
     48    'user=s'        => \$user,
     49    'verbose|v'     => \$verbose,
    3550) || pod2usage( 2 );
    3651
     
    4055my $c = read_rcfile($rcfile);
    4156
    42 $db     ||= $c->get_db      || $ENV{'NEB_DB'};
    43 $dbhost ||= $c->get_dbhost  || $ENV{'NEB_DBHOST'} || 'localhost';
    44 $dbuser ||= $c->get_dbuser  || $ENV{'NEB_USER'};
    45 $dbpass ||= $c->get_dbpass  || $ENV{'NEB_PASS'};
    46 $pidfile ||= $c->get_pidfile || "/var/tmp/nebdiskd";
     57$db         ||= $c->get_db      || $ENV{'NEB_DB'};
     58$dbhost     ||= $c->get_dbhost  || $ENV{'NEB_DBHOST'} || 'localhost';
     59$dbuser     ||= $c->get_dbuser  || $ENV{'NEB_USER'};
     60$dbpass     ||= $c->get_dbpass  || $ENV{'NEB_PASS'};
     61$pidfile    ||= $c->get_pidfile || "/var/tmp/nebdiskd";
     62$user       ||= $c->get_user    || $<; # user
     63$group      ||= $c->get_group   || $); # group
     64
    4765my $mounts = $c->get_mounts;
    4866my $poll_interval = $c->get_poll_interval || 5;
     
    6684
    6785daemonize(
    68     $<,     # User
    69     $),     # Group
     86    $user,     # User
     87    $group,    # Group,
    7088    $pidfile,  # PID file
    7189) unless $debug;
Note: See TracChangeset for help on using the changeset viewer.