Changeset 4851:d46b432ae11a in roaraudio


Ignore:
Timestamp:
04/09/11 22:08:18 (13 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

added support to run some script after complete shutdown

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • configure

    r4798 r4851  
    13431343test_lib_defmake ROAR_HAVE_H_FCNTL       %            fcntl.h       c          -- fcntl.h 
    13441344test_lib_defmake ROAR_HAVE_H_UNISTD      %            unistd.h      c          -- unistd.h 
     1345test_lib_defmake ROAR_HAVE_H_STDLIB      %            stdlib.h      c          -- stdlib.h 
    13451346test_lib_defmake ROAR_HAVE_H_SIGNAL      %            signal.h      c          -- signal.h 
    13461347test_lib_defmake ROAR_HAVE_H_POLL        %            poll.h        c          -- poll.h 
     
    15151516test_func_defmake ROAR_HAVE_POPEN     popen     'popen("", "")'              -- stdio.h 
    15161517test_func_defmake ROAR_HAVE_PCLOSE    pclose    'pclose(0)'                  -- stdio.h 
     1518test_func_defmake ROAR_HAVE_SYSTEM    system    'system("")'                 -- stdlib.h 
    15171519test_func_defmake ROAR_HAVE_GETSOCKNAME getsockname 'getsockname(0, 0, 0)'   -- sys/socket.h 
    15181520test_func_defmake ROAR_HAVE_GETPEERNAME getpeername 'getpeername(0, 0, 0)'   -- sys/socket.h 
  • roard/include/roard.h

    r4811 r4851  
    194194 size_t jumbo_mtu; 
    195195 int memlock_level; 
     196#ifdef ROAR_HAVE_SYSTEM 
     197 struct { 
     198  const char * post_shutdown; 
     199 } scripts; 
     200#endif 
    196201} * g_config; 
    197202 
  • roard/roard.c

    r4848 r4851  
    189189        " --log-syslog          - Log Warnings, Errors, ... to syslog\n" 
    190190#endif 
     191#ifdef ROAR_HAVE_SYSTEM 
     192        " --script-postdown S   - Run command lion S after complet shutdown.\n" 
     193#endif 
    191194       ); 
    192195 
     
    476479 
    477480 g_config->memlock_level = -1; 
     481 
     482#ifdef ROAR_HAVE_SYSTEM 
     483 g_config->scripts.post_shutdown = NULL; 
     484#endif 
    478485 
    479486 return 0; 
     
    20422049   ROAR_ERR("--log-syslog not supported"); 
    20432050#endif 
     2051  } else if ( strcmp(k, "--script-postdown") == 0 ) { 
     2052   _CKHAVEARGS(1); 
     2053#ifdef ROAR_HAVE_SYSTEM 
     2054   g_config->scripts.post_shutdown = argv[++i]; 
     2055#else 
     2056   ROAR_ERR("--script-postdown not supported"); 
     2057   i++; 
     2058#endif 
    20442059 
    20452060 
     
    29212936 roar_notify_core_free(NULL); 
    29222937 
     2938 ROAR_INFO("Shuting down complete", ROAR_DBG_INFO_INFO); 
     2939 
     2940 if ( g_config->scripts.post_shutdown != NULL ) 
     2941  system(g_config->scripts.post_shutdown); 
     2942 
    29232943 ROAR_INFO("Exiting, no error", ROAR_DBG_INFO_INFO); 
    29242944 return 0; 
     
    30083028 roar_notify_core_free(NULL); 
    30093029 
     3030 ROAR_INFO("Shuting down complete", ROAR_DBG_INFO_INFO); 
     3031 
     3032 if ( g_config->scripts.post_shutdown != NULL ) 
     3033  system(g_config->scripts.post_shutdown); 
     3034 
    30103035 ROAR_INFO("Exiting, no error", ROAR_DBG_INFO_INFO); 
    30113036 exit(0); 
Note: See TracChangeset for help on using the changeset viewer.