Changeset 122 in bookmarks for trunk/bin/bkmkd


Ignore:
Timestamp:
03/03/16 12:58:02 (8 years ago)
Author:
peter
Message:

#7: Added an init mode to bkmkd.

Writes a new config file to the file given with the -f switch (defaults to "server.yml") and the built-in default settings. These settings can be overridden using the -D command line switch.

http://trac.echodin.net/ticket/7

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bin/bkmkd

    r118 r122  
    1818); 
    1919 
    20 my %run = ( 
    21     run     => \&run_server, 
    22     start   => \&start_server, 
    23     stop    => sub { signal_server('QUIT') }, 
    24     restart => sub { signal_server('HUP') }, 
    25 ); 
    26  
    2720my %default_config = ( 
    2821    server_root => cwd, 
     
    3124    error_log   => 'error', 
    3225    pid_file    => 'pid', 
     26); 
     27 
     28my %run = ( 
     29    init    => sub { 
     30        $CONFIG_FILE ||= 'server.yml'; 
     31        my $config = { 
     32            %default_config, 
     33            %DEFINES, 
     34        }; 
     35        print Dump($config) if $VERBOSE; 
     36        YAML::DumpFile($CONFIG_FILE, $config); 
     37        print "Wrote config to $CONFIG_FILE\n" if $VERBOSE; 
     38    }, 
     39    run     => \&run_server, 
     40    start   => \&start_server, 
     41    stop    => sub { signal_server('QUIT') }, 
     42    restart => sub { signal_server('HUP') }, 
    3343); 
    3444 
Note: See TracChangeset for help on using the changeset viewer.