crossroads

Git mirror of https://crossroads.e-tunity.com/
git clone git://git.finwo.net/app/crossroads
Log | Files | Refs

sysrun.c (775B)


      1 /*************************************************************************
      2  * This file is part of Crosroads 1.23, a load balancer and fail over
      3  * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL.
      4  * Visit http://crossroads.e-tunity.com for information.
      5  *************************************************************************/
      6 #include "crossroads.h"
      7 
      8 void sysrun (char const *cmd) {
      9     char *expanded;
     10     int ret;
     11     
     12     if (!cmd)
     13 	return;
     14     expanded = str_expand_format (cmd);
     15     msg ("Service %s: running command: '%s'", activeservice->name, expanded);
     16     uid_assume();    
     17     if ( (ret = system (expanded)) )
     18 	warning ("Service %s: command '%s' returned %d",
     19 		 activeservice->name, expanded, ret);
     20     uid_restore();
     21     free (expanded);
     22 }