~ubuntu-branches/ubuntu/precise/torque/precise-updates

« back to all changes in this revision

Viewing changes to src/server/pbsd_init.c

  • Committer: Bazaar Package Importer
  • Author(s): Dominique Belhachemi
  • Date: 2010-05-17 20:56:46 UTC
  • mfrom: (0.1.3 sid) (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20100517205646-yipvh4jq5n5n1kgo
Tags: 2.4.8+dfsg-5
install man pages together with their associated binaries (Closes: #581576)

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
* are permitted provided that all of the following conditions are met.
21
21
* After December 31, 2001, only conditions 3-6 must be met:
22
22
*
23
 
* 1. Commercial and/or non-commercial use of the Software is permitted
24
 
*    provided a current software registration is on file at www.OpenPBS.org.
25
 
*    If use of this software contributes to a publication, product, or
26
 
*    service, proper attribution must be given; see www.OpenPBS.org/credit.html
27
 
*
28
 
* 2. Redistribution in any form is only permitted for non-commercial,
29
 
*    non-profit purposes.  There can be no charge for the Software or any
30
 
*    software incorporating the Software.  Further, there can be no
31
 
*    expectation of revenue generated as a consequence of redistributing
32
 
*    the Software.
33
 
*
34
23
* 3. Any Redistribution of source code must retain the above copyright notice
35
24
*    and the acknowledgment contained in paragraph 6, this list of conditions
36
25
*    and the disclaimer contained in paragraph 7.
108
97
#include "server_limits.h"
109
98
#include "server.h"
110
99
#include "queue.h"
111
 
#include "job.h"
 
100
#include "pbs_job.h"
 
101
#include "resource.h"
112
102
#include "work_task.h"
113
103
#include "tracking.h"
114
104
#include "svrfunc.h"
118
108
#include "pbs_proto.h"
119
109
#include "batch_request.h"
120
110
#include "array.h"
 
111
#include "csv.h"
 
112
#include "pbs_nodes.h"
121
113
 
122
114
 
123
115
/*#ifndef SIGKILL*/
174
166
extern char *path_spool;
175
167
extern char *path_svrdb;
176
168
extern char *path_svrdb_new;
 
169
extern char *path_svrlog;
177
170
extern char *path_track;
178
171
extern char *path_nodes;
179
172
extern char *path_nodes_new;
180
173
extern char *path_nodestate;
181
174
extern char *path_nodenote;
182
175
extern char *path_nodenote_new;
 
176
extern char *path_checkpoint;
183
177
 
184
178
extern int  queue_rank;
185
179
extern char  server_name[];
195
189
extern tlist_head task_list_event;
196
190
extern time_t  time_now;
197
191
 
 
192
extern int a_opt_init;
 
193
 
198
194
extern int LOGLEVEL;
199
195
extern char *plogenv;
200
196
 
233
229
#define CHANGE_STATE 1
234
230
#define KEEP_STATE   0
235
231
 
 
232
/**
 
233
 * dynamic array, with utility functions for easy appending
 
234
*/
 
235
 
 
236
typedef struct darray_t {
 
237
  int Length;
 
238
  void **Data;
 
239
  int AppendIndex;
 
240
} darray_t;
 
241
 
 
242
 
 
243
 
 
244
/**
 
245
 * Initialize a dynamic array to a specific size
 
246
 * @param Array (O) Assumed to be uninitialized struct
 
247
 * @param InitialSize (I) raised to 0 if less than 0
 
248
 */
 
249
 
 
250
int DArrayInit(
 
251
 
 
252
  darray_t *Array,      /* I */
 
253
  int       InitialSize) /* I */
 
254
 
 
255
  {
 
256
  if (InitialSize <= 0)
 
257
    {
 
258
    Array->Length = 0;
 
259
    Array->Data = NULL;
 
260
    }
 
261
  else
 
262
    {
 
263
    Array->Length = InitialSize;
 
264
    Array->Data = (void **)malloc(sizeof(Array->Data[0]) * InitialSize);
 
265
 
 
266
    if (Array->Data == NULL)
 
267
      return(FAILURE);
 
268
    }
 
269
 
 
270
  Array->AppendIndex = 0;
 
271
  return(SUCCESS);
 
272
  } /*END DArrayInit */
 
273
 
 
274
 
 
275
 
 
276
/**
 
277
 * Free the resources associated with Array
 
278
 * It does NOT free any data stored in the array, just the array structure itself.
 
279
 * param Array (I)
 
280
 */
 
281
 
 
282
int DArrayFree(
 
283
 
 
284
  darray_t *Array) /* I */
 
285
 
 
286
  {
 
287
  free(Array->Data);
 
288
  Array->Data = NULL;
 
289
  Array->Length = 0;
 
290
  Array->AppendIndex = 0;
 
291
  return(SUCCESS);
 
292
  } /*END DArrayFree */
 
293
 
 
294
 
 
295
 
 
296
/**
 
297
 * Append Item onto the end of Array, resizing it if necessary 
 
298
 * @param Array (I/O)
 
299
 * @param Item (I)
 
300
 */
 
301
 
 
302
int DArrayAppend(
 
303
 
 
304
  darray_t *Array, /* I/O */
 
305
  void     *Item)  /* I */
 
306
 
 
307
  {
 
308
 
 
309
  if(Array->AppendIndex >= Array->Length)
 
310
    {
 
311
    int newLength = Array->Length * 2;
 
312
 
 
313
    if(newLength <= 10)
 
314
      newLength = 10;
 
315
 
 
316
    Array->Length = newLength;
 
317
    Array->Data = realloc(Array->Data,sizeof(Array->Data[0]) * Array->Length);
 
318
 
 
319
    if(Array->Data == NULL)
 
320
      {
 
321
      Array->Length = 0;
 
322
      Array->AppendIndex = 0;
 
323
      return(FAILURE);
 
324
      }
 
325
    }
 
326
 
 
327
  /*
 
328
  assert(Array->AppendIndex >= 0);
 
329
  assert(Array->AppendIndex < Array->Length);
 
330
   */
 
331
  Array->Data[Array->AppendIndex++] = Item;
 
332
  return(SUCCESS);
 
333
  } /* END DArrayAppend */
 
334
 
 
335
 
 
336
 
 
337
/**
 
338
 * Sort two job structs by their priority in ascending order
 
339
 * @param A (I)
 
340
 * @param B (I)
 
341
 */
 
342
 
 
343
static int SortPrioAscend(
 
344
 
 
345
  const void *A, /* I */
 
346
  const void *B) /* I */
 
347
 
 
348
  {
 
349
  job *pjob1 = *((job **)A);
 
350
  job *pjob2 = *((job **)B);
 
351
  int prio1 = pjob1->ji_wattr[(int)JOB_ATR_qrank].at_val.at_long;
 
352
  int prio2 = pjob2->ji_wattr[(int)JOB_ATR_qrank].at_val.at_long;
 
353
  return(prio1 - prio2);
 
354
  } /*END SortPrioAscend */
 
355
 
 
356
 
 
357
void  update_default_np()
 
358
{
 
359
  struct pbsnode *pnode;
 
360
  int i;
 
361
  long default_np;
 
362
  long npfreediff;
 
363
 
 
364
  default_np = server.sv_attr[(int)SRV_ATR_NPDefault].at_val.at_long;
 
365
 
 
366
 
 
367
  if(default_np > 0)
 
368
    {
 
369
    for(i = 0; i < svr_totnodes; i++)
 
370
      {
 
371
      pnode = pbsndlist[i];
 
372
 
 
373
       npfreediff = pnode->nd_nsn - pnode->nd_nsnfree;
 
374
       pnode->nd_nsn = default_np;
 
375
       pnode->nd_nsnfree = default_np - npfreediff;
 
376
 
 
377
      }
 
378
    }
 
379
 
 
380
  return;
 
381
}
 
382
 
236
383
/* Add the server names from /var/spool/torque/server_name to the trusted hosts list. */
237
 
void
238
 
add_server_names_to_acl_hosts(void)
 
384
 
 
385
void add_server_names_to_acl_hosts(void)
239
386
 
240
387
  {
241
388
  int n, list_len, rc;
271
418
      free_arst(&temp);
272
419
      }
273
420
    }
 
421
 
 
422
  return;
274
423
  }
275
424
 
276
425
 
 
426
 
 
427
 
 
428
 
277
429
/*
278
430
 * This file contains the functions to initialize the PBS Batch Server.
279
431
 * The code is called once when the server is brought up.
284
436
  int type)  /* type of initialization   */
285
437
 
286
438
  {
287
 
  int a_opt = -1;
288
 
  int baselen;
 
439
  int baselen = 0;
289
440
  char basen[MAXPATHLEN+1];
290
441
 
291
442
  struct dirent *pdirent;
303
454
  pbs_queue *pque;
304
455
  char *psuffix;
305
456
  int  rc;
 
457
  int Index;
306
458
 
307
459
  struct stat statbuf;
308
460
  char *suffix_slash = "/";
492
644
 
493
645
  /* 2. set up the various paths and other global variables we need */
494
646
 
495
 
  path_priv      = build_path(path_home, PBS_SVR_PRIVATE, suffix_slash);
 
647
  if(path_priv == NULL)
 
648
    {
 
649
    path_priv      = build_path(path_home, PBS_SVR_PRIVATE, suffix_slash);
 
650
    }
496
651
 
497
652
  path_arrays  = build_path(path_priv, PBS_ARRAYDIR, suffix_slash);
498
653
 
504
659
 
505
660
  path_acct  = build_path(path_priv, PBS_ACCT,     suffix_slash);
506
661
 
507
 
  path_svrdb     = build_path(path_priv, PBS_SERVERDB, NULL);
 
662
  if(path_svrdb == NULL)
 
663
    {
 
664
    path_svrdb     = build_path(path_priv, PBS_SERVERDB, NULL);
 
665
    }
508
666
 
509
667
  path_svrdb_new = build_path(path_priv, PBS_SERVERDB, new_tag);
510
668
 
 
669
  path_svrlog = build_path(path_home, PBS_LOGFILES, suffix_slash);
 
670
 
511
671
  path_track  = build_path(path_priv, PBS_TRACKING, NULL);
512
672
 
513
673
  path_nodes  = build_path(path_priv, NODE_DESCRIP, NULL);
520
680
 
521
681
  path_nodenote_new = build_path(path_priv, NODE_NOTE, new_tag);
522
682
 
523
 
  init_resc_defs();
 
683
  path_checkpoint     = build_path(path_home, PBS_CHKPTDIR, suffix_slash);
 
684
 
 
685
  if (svr_resc_def == NULL)
 
686
    {
 
687
    init_resc_defs();
 
688
    }
524
689
 
525
690
#if !defined(DEBUG) && !defined(NO_SECURITY_CHECK)
526
691
 
563
728
 
564
729
  /* 3. Set default server attibutes values */
565
730
 
566
 
  if (server.sv_attr[(int)SRV_ATR_scheduling].at_flags & ATR_VFLAG_SET)
567
 
    {
568
 
    a_opt = server.sv_attr[(int)SRV_ATR_scheduling].at_val.at_long;
569
 
    }
570
 
 
571
731
  for (i = 0;i < SRV_ATR_LAST;i++)
572
732
    clear_attr(&server.sv_attr[i], &svr_attr_def[i]);
573
733
 
624
784
    {
625
785
    /* Open the server database (save file) and read it in */
626
786
 
627
 
    if ((rc != 0) || ((rc = svr_recov(path_svrdb)) == -1))
 
787
    if ((rc != 0) || ((rc = svr_recov(path_svrdb, FALSE)) == -1)) 
628
788
      {
629
789
      log_err(rc, "pbsd_init", msg_init_baddb);
630
790
 
674
834
 
675
835
  /* 7. Set up other server and global variables */
676
836
 
677
 
  if (a_opt != -1)
 
837
  if (a_opt_init != -1)
678
838
    {
679
839
    /* a_option was set, overrides saved value of scheduling attr */
680
840
 
681
 
    server.sv_attr[(int)SRV_ATR_scheduling].at_val.at_long = a_opt;
 
841
    server.sv_attr[(int)SRV_ATR_scheduling].at_val.at_long = a_opt_init;
682
842
    server.sv_attr[(int)SRV_ATR_scheduling].at_flags |=
683
843
      ATR_VFLAG_SET;
684
844
    }
695
855
    }
696
856
 
697
857
  add_server_names_to_acl_hosts();
 
858
  update_default_np();
698
859
 
699
860
  /*
700
861
   * 8. If not a "create" initialization, recover queues.
791
952
 
792
953
  while ((pdirent = readdir(dir)) != NULL)
793
954
    {
 
955
 
794
956
    if (chk_save_file(pdirent->d_name) == 0)
795
957
      {
796
958
      /* if not create or clean recovery, recover arrays */
797
959
 
798
960
      if ((type != RECOV_CREATE) && (type != RECOV_COLD))
799
961
        {
 
962
 
800
963
        /* skip files without the proper suffix */
801
964
        baselen = strlen(pdirent->d_name) - array_suf_len;
802
965
 
805
968
        if (strcmp(psuffix, ARRAY_FILE_SUFFIX))
806
969
          continue;
807
970
 
 
971
 
808
972
        pa = array_recov(pdirent->d_name);
809
973
 
810
974
        if (pa == NULL)
811
975
          {
812
976
          /* TODO GB */
813
977
 
814
 
          sprintf(log_buffer, 
 
978
          sprintf(log_buffer,
815
979
                  "could not recover array-struct from file %s--skipping",
816
980
                  pdirent->d_name);
817
981
 
818
982
          log_err(errno, "pbsd_init", log_buffer);
819
983
 
820
984
          continue;
 
985
 
821
986
          }
822
987
 
823
988
        pa->jobs_recovered = 0;
 
989
 
824
990
        }
825
991
      else
826
992
        {
827
993
        unlink(pdirent->d_name);
828
994
        }
 
995
 
829
996
      }
 
997
 
830
998
    }
831
999
 
832
1000
  closedir(dir);
872
1040
    }
873
1041
  else
874
1042
    {
 
1043
    darray_t Array;
 
1044
    DArrayInit(&Array,100);
875
1045
    /* Now, for each job found ... */
876
1046
 
877
1047
    while ((pdirent = readdir(dir)) != NULL)
893
1063
            }
894
1064
          else
895
1065
            {
896
 
            /* FIXME: what shoudl we do here?  we won't beable to finish 
 
1066
            /* FIXME: what should we do here?  we won't be able to finish 
897
1067
               cloning this array because the initial job file is missing */
898
1068
            }
899
1069
 
906
1076
 
907
1077
        if ((pjob = job_recov(pdirent->d_name)) != NULL)
908
1078
          {
909
 
          if (pjob->ji_qs.ji_substate == JOB_SUBSTATE_COMPLETE)
910
 
            {
911
 
            /* ignore/remove completed job */
912
 
 
913
 
            /* for some reason, if a completed job is recovered, and it is
914
 
             * forcibly purged with 'qdel -p', it will get deleted a 
915
 
             * second time resulting in a segfault */
916
 
 
917
 
            job_purge(pjob);
918
 
 
919
 
            continue;
920
 
            }
921
 
 
922
 
          if (pbsd_init_job(pjob, type) == FAILURE)
923
 
            {
924
 
            log_event(
925
 
              PBSEVENT_ERROR | PBSEVENT_SYSTEM | PBSEVENT_ADMIN | PBSEVENT_JOB | PBSEVENT_FORCE,
926
 
              PBS_EVENTCLASS_JOB,
927
 
              pdirent->d_name,
928
 
              msg_script_open);
929
 
 
930
 
            continue;
931
 
            }
932
 
 
933
 
          if ((type != RECOV_COLD) &&
934
 
              (type != RECOV_CREATE) &&
935
 
              (!(pjob->ji_wattr[(int)JOB_ATR_job_array_request].at_flags & ATR_VFLAG_SET)) &&
936
 
              (pjob->ji_qs.ji_svrflags & JOB_SVFLG_SCRIPT))
937
 
            {
938
 
            strcpy(basen, pdirent->d_name);
939
 
 
940
 
            psuffix = basen + baselen;
941
 
 
942
 
            strcpy(psuffix, JOB_SCRIPT_SUFFIX);
943
 
 
944
 
            if (chk_save_file(basen) != 0)
945
 
              {
946
 
              log_event(
947
 
                PBSEVENT_ERROR | PBSEVENT_SYSTEM | PBSEVENT_ADMIN | PBSEVENT_JOB | PBSEVENT_FORCE,
948
 
                PBS_EVENTCLASS_JOB,
949
 
                pjob->ji_qs.ji_jobid,
950
 
                msg_script_open);
951
 
 
952
 
              init_abt_job(pjob);
953
 
              }
 
1079
 
 
1080
          if (DArrayAppend(&Array,pjob) == FAILURE)
 
1081
            {
 
1082
            log_err(ENOMEM,"main","out of memory reloading jobs");
 
1083
            exit(-1);
 
1084
 
954
1085
            }
955
1086
          }
956
1087
        else
978
1109
            }
979
1110
          }
980
1111
        }
981
 
      }
 
1112
      }    /* END while ((pdirent = readdir(dir)) != NULL) */
982
1113
 
983
1114
    closedir(dir);
 
1115
    qsort(Array.Data,Array.AppendIndex,sizeof(Array.Data[0]),SortPrioAscend);
 
1116
 
 
1117
    for (Index = 0; Index < Array.AppendIndex; Index++)
 
1118
      {
 
1119
      job *pjob = (job *)Array.Data[Index];
 
1120
 
 
1121
      if (pbsd_init_job(pjob, type) == FAILURE)
 
1122
        {
 
1123
        log_event(
 
1124
          PBSEVENT_ERROR | PBSEVENT_SYSTEM | PBSEVENT_ADMIN | PBSEVENT_JOB | PBSEVENT_FORCE,
 
1125
          PBS_EVENTCLASS_JOB,
 
1126
          pjob->ji_qs.ji_jobid,
 
1127
          msg_script_open);
 
1128
 
 
1129
        continue;
 
1130
        }
 
1131
 
 
1132
      if ((type != RECOV_COLD) &&
 
1133
          (type != RECOV_CREATE) &&
 
1134
          (!(pjob->ji_wattr[(int)JOB_ATR_job_array_request].at_flags & ATR_VFLAG_SET)) &&
 
1135
          (pjob->ji_qs.ji_svrflags & JOB_SVFLG_SCRIPT))
 
1136
        {
 
1137
        strcpy(basen, pjob->ji_qs.ji_jobid);
 
1138
 
 
1139
        strcat(basen, JOB_SCRIPT_SUFFIX);
 
1140
 
 
1141
        if (chk_save_file(basen) != 0)
 
1142
          {
 
1143
          log_event(
 
1144
            PBSEVENT_ERROR | PBSEVENT_SYSTEM | PBSEVENT_ADMIN | PBSEVENT_JOB | PBSEVENT_FORCE,
 
1145
            PBS_EVENTCLASS_JOB,
 
1146
            pjob->ji_qs.ji_jobid,
 
1147
            msg_script_open);
 
1148
 
 
1149
          init_abt_job(pjob);
 
1150
          }
 
1151
        }
 
1152
      }
 
1153
 
 
1154
    DArrayFree(&Array);
984
1155
 
985
1156
    if ((had != server.sv_qs.sv_numjobs) &&
986
1157
        (type != RECOV_CREATE) &&
994
1165
      }
995
1166
 
996
1167
    sprintf(log_buffer, msg_init_exptjobs,
997
 
 
998
1168
            had, server.sv_qs.sv_numjobs);
999
1169
 
1000
1170
    log_event(
1036
1206
 
1037
1207
      if (pjob == NULL)
1038
1208
        {
1039
 
        /* TODO, we need to so something here, we can't finish cloning the array! */
 
1209
        /* TODO, we need to so something here, we can't finish cloning the 
 
1210
           array! */
1040
1211
 
1041
1212
        }
1042
1213
      else
1043
1214
        {
1044
1215
        /* TODO if num_cloned != num_recovered then something strange happend
1045
 
           it is possible num_recovered == num_cloned+1.  That means that the server
1046
 
           terminated after cloning a job but before updating the saved array_info struct.
1047
 
           we probably should delete that last job and start the cloning process off at
1048
 
           num_cloned */
 
1216
           it is possible num_recovered == num_cloned+1.  That means that the 
 
1217
           server terminated after cloning a job but before updating the saved 
 
1218
           array_info struct. we probably should delete that last job and start
 
1219
           the cloning process off at num_cloned. Someone must have been 
 
1220
           naughty and did a kill -9 on pbs_server  */
1049
1221
        wt = set_task(WORK_Timed, time_now + 1, job_clone_wt, (void*)pjob);
1050
1222
 
1051
1223
        }
1091
1263
 
1092
1264
#if !defined(DEBUG) && !defined(NO_SECURITY_CHECK)
1093
1265
 
1094
 
  if (chk_file_sec(path_track,0,0,S_IWGRP|S_IWOTH,0,EMsg) != 0)
 
1266
  if (chk_file_sec(path_track, 0, 0, S_IWGRP | S_IWOTH, 0, EMsg) != 0)
1095
1267
    {
1096
1268
    return(-1);
1097
1269
    }
1098
1270
 
1099
1271
#endif  /* not DEBUG and not NO_SECURITY_CHECK */
1100
1272
 
1101
 
  if (fstat(fd,&statbuf) < 0)
 
1273
  if (fstat(fd, &statbuf) < 0)
1102
1274
    {
1103
 
    log_err(errno,"pbs_init","unable to stat tracking file");
 
1275
    log_err(errno, "pbs_init", "unable to stat tracking file");
1104
1276
 
1105
1277
    return(-1);
1106
1278
    }
1126
1298
 
1127
1299
  /* NOTE:  tracking file records are optional */
1128
1300
 
1129
 
  i = read(fd,(char *)server.sv_track,server.sv_tracksize * sizeof(struct tracking));
 
1301
  i = read(fd, (char *)server.sv_track, server.sv_tracksize * sizeof(struct tracking));
1130
1302
 
1131
1303
  if (i < 0)
1132
1304
    {
1133
 
    log_err(errno,"pbs_init","unable to read tracksize from tracking file");
 
1305
    log_err(errno, "pbs_init", "unable to read tracksize from tracking file");
1134
1306
    }
1135
1307
 
1136
1308
  close(fd);
1139
1311
 
1140
1312
  /* set work task to periodically save the tracking records */
1141
1313
 
1142
 
  set_task(WORK_Timed,(long)(time_now + PBS_SAVE_TRACK_TM),track_save,0);
 
1314
  set_task(WORK_Timed, (long)(time_now + PBS_SAVE_TRACK_TM), track_save, 0);
1143
1315
 
1144
1316
  /* SUCCESS */
1145
1317
 
1327
1499
 
1328
1500
    case JOB_SUBSTATE_STAGEGO:
1329
1501
 
 
1502
    case JOB_SUBSTATE_CHKPTGO:
 
1503
 
 
1504
    case JOB_SUBSTATE_CHKPTCMP:
 
1505
 
1330
1506
    case JOB_SUBSTATE_HELD:
1331
1507
 
1332
1508
    case JOB_SUBSTATE_SYNCHOLD:
1399
1575
 
1400
1576
    case JOB_SUBSTATE_COMPLETE:
1401
1577
 
1402
 
      /* NOOP - completed jobs are already purged above */
1403
 
      /* for some reason, this doesn't actually work */
 
1578
      /* Completed jobs are no longer purged on startup */
1404
1579
 
1405
1580
      pwt = set_task(WORK_Immed, 0, on_job_exit, (void *)pjob);
1406
1581
 
1651
1826
        msg_daemonname,
1652
1827
        log_buffer);
1653
1828
#else
1654
 
      DBPRT(("catch_child caught pid %d\n", pid));
 
1829
      DBPRT(("catch_child caught pid %d\n", (int)pid));
1655
1830
#endif
1656
1831
      }
1657
1832
 
1682
1857
            msg_daemonname,
1683
1858
            log_buffer);
1684
1859
#else
1685
 
          DBPRT(("catch_child found work task found for pid %d\n", pid));
 
1860
          DBPRT(("catch_child found work task found for pid %d\n", (int)pid));
1686
1861
#endif
1687
1862
          }
1688
1863
 
1699
1874
 
1700
1875
      log_err(-1, "catch_child", log_buffer);
1701
1876
#else
1702
 
      DBPRT(("catch_child no work task found for pid %d\n", pid));
 
1877
      DBPRT(("catch_child no work task found for pid %d\n", (int)pid));
1703
1878
#endif
1704
1879
      }
1705
1880
    }    /* END while (1) */
1718
1893
check_children(void)
1719
1894
 
1720
1895
  {
1721
 
  if (LOGLEVEL >= 7)
1722
 
    {
1723
 
    log_record(
1724
 
      PBSEVENT_SYSTEM | PBSEVENT_FORCE,
1725
 
      PBS_EVENTCLASS_SERVER,
1726
 
      msg_daemonname,
1727
 
      "check_children called");
1728
 
    }
1729
1896
 
1730
1897
  catch_child(0);
1731
1898
 
2059
2226
 
2060
2227
  return;
2061
2228
  }
 
2229
 
 
2230
 
 
2231
 
 
2232
 
 
2233
/*
 
2234
 * This just reads in the server attributes from the server db.
 
2235
 */
 
2236
 
 
2237
int get_svr_attr(
 
2238
 
 
2239
  int type)             /* type of initialization   */
 
2240
 
 
2241
  {
 
2242
  static char id[] = "get_svr_attr";
 
2243
  int    rc;
 
2244
  char  *suffix_slash = "/";
 
2245
  
 
2246
  if (type != RECOV_CREATE) 
 
2247
    {
 
2248
    /* Open the server database (save file) and read it in */
 
2249
 
 
2250
    if(path_priv == NULL)
 
2251
      {
 
2252
      path_priv = build_path(path_home, PBS_SVR_PRIVATE, suffix_slash);
 
2253
      }
 
2254
    if(path_svrdb == NULL)
 
2255
      {
 
2256
      path_svrdb     = build_path(path_priv, PBS_SERVERDB, NULL);
 
2257
      }
 
2258
 
 
2259
    if (svr_resc_def == NULL)
 
2260
      {
 
2261
      init_resc_defs();
 
2262
      }
 
2263
 
 
2264
    if (((rc = chk_save_file(path_svrdb))!= 0) || ((rc = svr_recov(path_svrdb, TRUE)) == -1)) 
 
2265
      {
 
2266
      log_err(rc, id ,msg_init_baddb);
 
2267
 
 
2268
      return(-1);
 
2269
      }
 
2270
 
 
2271
    } 
 
2272
 
 
2273
  return(0);
 
2274
  }  /* END get_svr_attr() */
 
2275