Changeset 4165
- Timestamp:
- 12/20/10 09:00:20 (13 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/oscam-http.c
r4163 r4165 2276 2276 else if (strcmp(getParam(params, "action"), "Restart") == 0) { 2277 2277 tpl_addVar(vars, 0, "STYLESHEET", CSS); 2278 tpl_printf(vars, 0, "REFRESHTIME", "%d", 1 );2278 tpl_printf(vars, 0, "REFRESHTIME", "%d", 10); 2279 2279 tpl_addVar(vars, 0, "REFRESHURL", "status.html"); 2280 2280 tpl_addVar(vars, 0, "REFRESH", tpl_getTpl(vars, "REFRESH")); 2281 tpl_printf(vars, 0, "SECONDS", "%d", 1 );2281 tpl_printf(vars, 0, "SECONDS", "%d", 10); 2282 2282 webif_write(tpl_getTpl(vars, "SHUTDOWN"), f); 2283 2283 running = 0; -
trunk/oscam.c
r4164 r4165 29 29 char cs_confdir[128]=CS_CONFDIR; 30 30 int cs_dblevel=0; // Debug Level (TODO !!) 31 #ifdef WEBIF 32 int cs_restart_mode=1; //Restartmode: 0=off, no restart fork, 1=(default)restart fork, restart by webif, 2=like=1, but also restart on segfaults 33 #endif 31 34 char cs_tmpdir[200]={0x00}; 32 35 pthread_mutex_t gethostbyname_lock; … … 279 282 fprintf(stderr, "\t 128 = DVBAPI logging\n"); 280 283 fprintf(stderr, "\t 255 = debug all\n"); 284 #ifdef WEBIF 285 fprintf(stderr, "\t-r : restart-level\n"); 286 fprintf(stderr, "\t 0 = disabled: restart request sets exitstatus=99\n"); 287 fprintf(stderr, "\t 1 = restart activated: webif can restart oscam (default)\n"); 288 fprintf(stderr, "\t 2 = like 1, but also restart on SEGFAULTS\n"); 289 #endif 281 290 fprintf(stderr, "\t-h : show this help\n"); 282 291 fprintf(stderr, "\n"); … … 575 584 576 585 NULLFREE(cl); 577 exit_oscam = sig; 586 587 if (!exit_oscam) 588 exit_oscam = sig?sig:1; 578 589 } 579 590 … … 3015 3026 } while (res!=pid); 3016 3027 3017 status = WEXITSTATUS(status); 3028 if (cs_restart_mode==2 && WIFSIGNALED(status) && WTERMSIG(status)==SIGSEGV) 3029 status=99; //restart on segfault! 3030 else 3031 status = WEXITSTATUS(status); 3018 3032 3019 3033 //status=99 restart oscam, all other->terminate … … 3047 3061 int fd_c2m=0; 3048 3062 3049 cfg = malloc(sizeof(struct s_config));3050 memset(cfg, 0, sizeof(struct s_config));3051 3052 3063 void (*mod_def[])(struct s_module *)= 3053 3064 { … … 3122 3133 }; 3123 3134 3124 while ((i=getopt(argc, argv, "bc:t:d: hm:x"))!=EOF)3135 while ((i=getopt(argc, argv, "bc:t:d:r:hm:x"))!=EOF) 3125 3136 { 3126 3137 switch(i) { … … 3134 3145 cs_dblevel=atoi(optarg); 3135 3146 break; 3147 case 'r': 3148 cs_restart_mode=atoi(optarg); 3149 break; 3136 3150 case 't': 3137 3151 mkdir(optarg, S_IRWXU); … … 3164 3178 3165 3179 #ifdef WEBIF 3166 restart_daemon(); 3167 #endif 3180 if (cs_restart_mode) 3181 restart_daemon(); 3182 #endif 3183 3184 cfg = malloc(sizeof(struct s_config)); 3185 memset(cfg, 0, sizeof(struct s_config)); 3168 3186 3169 3187 if (cs_confdir[strlen(cs_confdir)]!='/') strcat(cs_confdir, "/"); … … 3319 3337 } 3320 3338 3321 //can't kill? running endless... 3322 //struct s_client *cl; 3323 //for (cl=first_client->next;cl;cl=cl->next) 3324 // kill_thread(cl); 3339 struct s_client *cl; 3340 for (cl=first_client;cl->next;cl=cl->next) { 3341 if (cl->next->typ != 's') 3342 kill_thread(cl->next); 3343 } 3325 3344 3326 3345 #ifdef AZBOX
Note:
See TracChangeset
for help on using the changeset viewer.