void start_final_installation( void ) { gtk_frame_set_label( GTK_FRAME( body_frame), "Installation step - 5/5 ( managing source files )" ); gtk_button_set_label( GTK_BUTTON( cancel_button), "Finish" ); gtk_widget_set_sensitive( GTK_WIDGET( cancel_button), FALSE ); pattern_label = gtk_label_new( "" ); gtk_container_add( GTK_CONTAINER( body_frame), pattern_label ); gtk_widget_show_all( main_window ); fd = popen( "whoami", "r" ); fscanf( fd, "%s", system_user_name ); pclose(fd); create_directories(); create_files(); manage_files(); }
/* Real monitord global */ void Monitord() { time_t tm; struct tm *p; int today = 0; int thismonth = 0; int thisyear = 0; char str[OS_SIZE_1024 +1]; /* Waiting a few seconds to settle */ sleep(10); memset(str, '\0', OS_SIZE_1024 +1); /* Getting currently time before starting */ tm = time(NULL); p = localtime(&tm); today = p->tm_mday; thismonth = p->tm_mon; thisyear = p->tm_year+1900; /* Connecting to the message queue * Exit if it fails. */ if((mond.a_queue = StartMQ(DEFAULTQUEUE,WRITE)) < 0) { ErrorExit(QUEUE_FATAL, ARGV0, DEFAULTQUEUE); } /* Sending startup message */ snprintf(str, OS_SIZE_1024 -1, OS_AD_STARTED); if(SendMSG(mond.a_queue, str, ARGV0, LOCALFILE_MQ) < 0) { merror(QUEUE_SEND, ARGV0); } /* Main monitor loop */ while(1) { tm = time(NULL); p = localtime(&tm); /* Checking unavailable agents */ if(mond.monitor_agents) { monitor_agents(); } /* Day changed, deal with log files */ if(today != p->tm_mday) { /* Generate reports. */ generate_reports(today, thismonth, thisyear, p); manage_files(today, thismonth, thisyear); today = p->tm_mday; thismonth = p->tm_mon; thisyear = p->tm_year+1900; } /* We only check every two minutes */ sleep(120); } }