--- asterisk/asterisk.c 2004-11-11 07:43:18.000000000 -0700 +++ asterisk.new/asterisk.c 2004-11-15 10:59:32.000000000 -0700 @@ -78,6 +78,7 @@ int option_cache_record_files = 0; int option_overrideconfig = 0; int option_reconnect = 0; +int option_system_when_booted = 0; int fully_booted = 0; char record_cache_dir[AST_CACHE_DIR_LEN] = AST_TMP_DIR; @@ -1483,6 +1484,7 @@ printf(" -t Record soundfiles in /tmp and move them where they belong after they are done.\n"); printf(" -v Increase verbosity (multiple v's = more verbose)\n"); printf(" -x Execute command (only valid with -r)\n"); + printf(" -e Execute shell command when fully booted\n"); printf("\n"); return 0; } @@ -1575,7 +1577,7 @@ char filename[80] = ""; char hostname[256]; char tmp[80]; - char * xarg = NULL; + char * xarg = NULL, *system_booted_arg = NULL; int x; FILE *f; sigset_t sigs; @@ -1615,7 +1617,7 @@ } */ /* Check for options */ - while((c=getopt(argc, argv, "thfdvVqprRgcinx:U:G:C:")) != -1) { + while((c=getopt(argc, argv, "thfdvVqprRgcinx:U:G:C:e:")) != -1) { switch(c) { case 'd': option_debug++; @@ -1679,6 +1681,10 @@ case 'G': rungroup = optarg; break; + case 'e': + option_system_when_booted++; + system_booted_arg = optarg; + break; case '?': exit(1); } @@ -1880,6 +1886,11 @@ if (option_nofork) consolethread = pthread_self(); fully_booted = 1; + + /* options for doing things when fully booted */ + if (option_system_when_booted) + ast_safe_system((char *)system_booted_arg); /* flying blind: not checking return code here */ + pthread_sigmask(SIG_UNBLOCK, &sigs, NULL); #ifdef __AST_DEBUG_MALLOC __ast_mm_init();