source: trunk/patches/trqauth_syslog.patch @ 61

Last change on this file since 61 was 61, checked in by bas, 12 years ago

added a new pam_pbssimpleauth patch for torque 4
added trqauth_syslog.patch

init.d start trqauthd daemon in --background else package installer hangs

File size: 1.9 KB
  • trq_auth_daemon.c

     
    3636    /* Currently this only display's the port for the trq server
    3737     * from the lib_ifl.h file or server_name file (The same way
    3838     * the client utilities determine the pbs_server port)
    39      */
    40     printf("hostname: %s\n", tmp_name);
     39    */
     40    if (debug_mode == TRUE)
     41      {
     42      printf("pbs_server: %s\n", tmp_name);
     43      }
     44    else
     45      {
     46      openlog("trqauthd", LOG_PID | LOG_NOWAIT, LOG_DAEMON);
     47      syslog(LOG_INFO, "pbs_server : %s\n", tmp_name);
     48      closelog();
     49      }
    4150    *ip = tmp_name;
    4251    PBS_get_server(tmp_name, (unsigned int *)t_port);
    4352    if (*t_port == 0)
     
    6170    char **sign_key)
    6271  {
    6372  int rc = PBSE_NONE;
    64   fprintf(stderr, "pbs_server port is: %d\n", t_server_port);
     73
     74  if (debug_mode == TRUE)
     75    {
     76    fprintf(stderr, "pbs_server port is: %d\n", t_server_port);
     77    }
     78  else
     79    {
     80    openlog("trqauthd", LOG_PID | LOG_NOWAIT, LOG_DAEMON);
     81    syslog(LOG_INFO, "pbs_server port is : %d\n", t_server_port);
     82    closelog();
     83    }
     84
    6585  return rc;
    6686  }
    6787
     
    88108
    89109  if (getenv("PBSDEBUG") != NULL)
    90110    debug_mode = TRUE;
     111
    91112  if (debug_mode == FALSE)
    92113    {
    93114    pid = fork();
     
    104125      }
    105126    else
    106127      {
    107       fprintf(stderr, "trqauthd daemonized - port %d\n", server_port);
     128      openlog("trqauthd", LOG_PID | LOG_NOWAIT, LOG_DAEMON);
     129      syslog(LOG_INFO, "daemonized - port: %d\n", server_port);
     130      closelog();
     131
    108132      /* If I made it here I am the child */
    109133      fclose(stdin);
    110134      fclose(stdout);
    111135      fclose(stderr);
     136
    112137      /* We closed 0 (stdin), 1 (stdout), and 2 (stderr). fopen should give us
    113138         0, 1 and 2 in that order. this is a UNIX practice */
    114139      (void)fopen("/dev/null", "r");
Note: See TracBrowser for help on using the repository browser.