|
|
@ -345,7 +345,7 @@ void on_logrotate_save(GtkWidget *self, logrotate_configure_window *window){
|
|
|
|
int weekday = gtk_combo_box_get_active(GTK_COMBO_BOX(window->RotationPeriodAdditionalCombo));
|
|
|
|
int weekday = gtk_combo_box_get_active(GTK_COMBO_BOX(window->RotationPeriodAdditionalCombo));
|
|
|
|
weekday++;
|
|
|
|
weekday++;
|
|
|
|
if (weekday==7) weekday=0;
|
|
|
|
if (weekday==7) weekday=0;
|
|
|
|
period = yon_char_unite(period,", ",yon_char_from_int(weekday));
|
|
|
|
period = yon_char_unite(period,", ",yon_char_from_int(weekday),NULL);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 4: period = "monthly";
|
|
|
|
case 4: period = "monthly";
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -357,7 +357,7 @@ void on_logrotate_save(GtkWidget *self, logrotate_configure_window *window){
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->JournalMaxSizeCheck))){
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->JournalMaxSizeCheck))){
|
|
|
|
int last = gtk_combo_box_get_active(GTK_COMBO_BOX(window->JournalMaxSizeCombo));
|
|
|
|
int last = gtk_combo_box_get_active(GTK_COMBO_BOX(window->JournalMaxSizeCombo));
|
|
|
|
long maxsize = gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->JournalMaxSizeSpin));
|
|
|
|
long maxsize = gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->JournalMaxSizeSpin));
|
|
|
|
size = yon_char_unite(yon_char_from_long(maxsize),yon_size_get_letter_from_int(last));
|
|
|
|
size = yon_char_unite("size ",yon_char_from_long(maxsize),yon_size_get_letter_from_int(last),NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->FileAmountCheck))){
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->FileAmountCheck))){
|
|
|
@ -371,8 +371,11 @@ void on_logrotate_save(GtkWidget *self, logrotate_configure_window *window){
|
|
|
|
|
|
|
|
|
|
|
|
char *user_rotate = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->RotationAtUserCombo));
|
|
|
|
char *user_rotate = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->RotationAtUserCombo));
|
|
|
|
char *group_rotate = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->RotationAtGroupCombo));
|
|
|
|
char *group_rotate = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->RotationAtGroupCombo));
|
|
|
|
if (!yon_char_is_empty(user_rotate)&&!yon_char_is_empty(group_rotate))
|
|
|
|
if (!yon_char_is_empty(user_rotate)&&!yon_char_is_empty(group_rotate)){
|
|
|
|
|
|
|
|
if (gtk_combo_box_get_active(GTK_COMBO_BOX(window->RotationAtUserCombo))==0) user_rotate = "root";
|
|
|
|
|
|
|
|
if (gtk_combo_box_get_active(GTK_COMBO_BOX(window->RotationAtGroupCombo))==0) group_rotate = "root";
|
|
|
|
su = yon_char_unite("su ",user_rotate," ",group_rotate,NULL);
|
|
|
|
su = yon_char_unite("su ",user_rotate," ",group_rotate,NULL);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int error_processing = gtk_combo_box_get_active(GTK_COMBO_BOX(window->ErrorProcessingCombo));
|
|
|
|
int error_processing = gtk_combo_box_get_active(GTK_COMBO_BOX(window->ErrorProcessingCombo));
|
|
|
|
if (error_processing==0|| error_processing==1) {
|
|
|
|
if (error_processing==0|| error_processing==1) {
|
|
|
@ -382,7 +385,7 @@ void on_logrotate_save(GtkWidget *self, logrotate_configure_window *window){
|
|
|
|
missingok = "nomissingok";
|
|
|
|
missingok = "nomissingok";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int empty_journal = gtk_combo_box_get_active(window->JournalEmptyCombo);
|
|
|
|
int empty_journal = gtk_combo_box_get_active(GTK_COMBO_BOX(window->JournalEmptyCombo));
|
|
|
|
if (empty_journal==0||empty_journal==1) {
|
|
|
|
if (empty_journal==0||empty_journal==1) {
|
|
|
|
empty_journal = 1;
|
|
|
|
empty_journal = 1;
|
|
|
|
ifempty = "ifempty";
|
|
|
|
ifempty = "ifempty";
|
|
|
@ -401,13 +404,13 @@ void on_logrotate_save(GtkWidget *self, logrotate_configure_window *window){
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->RotateSizeMaxAfterTimeCheck))){
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->RotateSizeMaxAfterTimeCheck))){
|
|
|
|
long value = gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->RotateSizeMaxAfterTimeSpin));
|
|
|
|
long value = gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->RotateSizeMaxAfterTimeSpin));
|
|
|
|
int last = gtk_combo_box_get_active(GTK_COMBO_BOX(window->RotateSizeMaxAfterTimeCombo));
|
|
|
|
int last = gtk_combo_box_get_active(GTK_COMBO_BOX(window->RotateSizeMaxAfterTimeCombo));
|
|
|
|
minsize = yon_char_unite("minsize ",yon_char_from_long(value),yon_size_get_letter_from_int(last));
|
|
|
|
minsize = yon_char_unite("minsize ",yon_char_from_long(value),yon_size_get_letter_from_int(last),NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->RotateSizeMaxBeforeTimeCheck))){
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->RotateSizeMaxBeforeTimeCheck))){
|
|
|
|
long value = gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->RotateSizeMaxBeforeTimeSpin));
|
|
|
|
long value = gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->RotateSizeMaxBeforeTimeSpin));
|
|
|
|
int last = gtk_combo_box_get_active(GTK_COMBO_BOX(window->RotateSizeMaxBeforeTimeCombo));
|
|
|
|
int last = gtk_combo_box_get_active(GTK_COMBO_BOX(window->RotateSizeMaxBeforeTimeCombo));
|
|
|
|
maxsize = yon_char_unite("maxsize ", yon_char_from_long(value),yon_size_get_letter_from_int(last));
|
|
|
|
maxsize = yon_char_unite("maxsize ", yon_char_from_long(value),yon_size_get_letter_from_int(last),NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// int create_log_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->CreateLogCombo));
|
|
|
|
// int create_log_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->CreateLogCombo));
|
|
|
@ -417,6 +420,87 @@ void on_logrotate_save(GtkWidget *self, logrotate_configure_window *window){
|
|
|
|
|
|
|
|
|
|
|
|
copytruncate = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->CutCheck)) ? "copytruncate" : "";
|
|
|
|
copytruncate = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->CutCheck)) ? "copytruncate" : "";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int compression_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->CompressionCombo));
|
|
|
|
|
|
|
|
if (compression_active){
|
|
|
|
|
|
|
|
switch (compression_active){
|
|
|
|
|
|
|
|
case 1: compress = "compress";
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2: compress = "nocompress";
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int compression_delay_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->QueueCombo));
|
|
|
|
|
|
|
|
if (compression_delay_active){
|
|
|
|
|
|
|
|
switch (compression_delay_active){
|
|
|
|
|
|
|
|
case 1: delaycompress = "delaycompress";
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2: delaycompress = "nodelaycompress";
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int original_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->SaveOriginalCombo));
|
|
|
|
|
|
|
|
if (original_active==1){
|
|
|
|
|
|
|
|
char *ext_file = (char*)gtk_entry_get_text(GTK_ENTRY(window->SaveOriginalEntry));
|
|
|
|
|
|
|
|
extension = yon_char_append("extension ",ext_file);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (gtk_combo_box_get_active(GTK_COMBO_BOX(window->AddDateCombo))==1){
|
|
|
|
|
|
|
|
dateext = "dateext";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (gtk_combo_box_get_active(GTK_COMBO_BOX(window->OldNumberCombo))==1){
|
|
|
|
|
|
|
|
long value = gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->OldNumberEntry));
|
|
|
|
|
|
|
|
if (value>0)
|
|
|
|
|
|
|
|
start = yon_char_append("start ",yon_char_from_long(value));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int email_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->EmailCombo));
|
|
|
|
|
|
|
|
if (email_active){
|
|
|
|
|
|
|
|
switch(email_active){
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
|
|
char *adress = (char*)gtk_entry_get_text(GTK_ENTRY(window->EmailEntry));
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(adress))
|
|
|
|
|
|
|
|
mail=yon_char_append("mail ", adress);
|
|
|
|
|
|
|
|
int contents_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->EmailContentsCombo));
|
|
|
|
|
|
|
|
if (contents_active==1)
|
|
|
|
|
|
|
|
mailfirst = "mailfirst";
|
|
|
|
|
|
|
|
else if (contents_active==2)
|
|
|
|
|
|
|
|
mailfirst = "maillast";
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2: mail = "nomail";
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->SharedScenariosCheck))){
|
|
|
|
|
|
|
|
char *before_once = (char*)gtk_entry_get_text(GTK_ENTRY(window->CommandBeforeOnceEntry));
|
|
|
|
|
|
|
|
char *after_once = (char*)gtk_entry_get_text(GTK_ENTRY(window->CommandAfterOnceEntry));
|
|
|
|
|
|
|
|
char *before = (char*)gtk_entry_get_text(GTK_ENTRY(window->CommandBeforeEntry));
|
|
|
|
|
|
|
|
char *after = (char*)gtk_entry_get_text(GTK_ENTRY(window->CommandAfterEntry));
|
|
|
|
|
|
|
|
char *endwork = (char*)gtk_entry_get_text(GTK_ENTRY(window->EndworkCommandEntry));
|
|
|
|
|
|
|
|
sharedscripts = "sharedscripts";
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(before_once))
|
|
|
|
|
|
|
|
firstaction = yon_char_append("firstaction ",before_once);
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(after_once))
|
|
|
|
|
|
|
|
lastaction = yon_char_append("lastaction ",after_once);
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(before))
|
|
|
|
|
|
|
|
prerotate = yon_char_append("prerotate ",before);
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(after))
|
|
|
|
|
|
|
|
postrotate = yon_char_append("postrotate ",after);
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(endwork))
|
|
|
|
|
|
|
|
endscript = yon_char_append("endscript ",endwork);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char *commandline = yon_char_unite(period,yon_add_space_if_exists(size),yon_add_space_if_exists(rotate_count),yon_add_space_if_exists(olddir),yon_add_space_if_exists(su),yon_add_space_if_exists(missingok),yon_add_space_if_exists(ifempty),yon_add_space_if_exists(notifempty),yon_add_space_if_exists(minage),yon_add_space_if_exists(maxage),yon_add_space_if_exists(minsize),yon_add_space_if_exists(maxsize),yon_add_space_if_exists(create),yon_add_space_if_exists(copytruncate),yon_add_space_if_exists(compress),yon_add_space_if_exists(delaycompress),yon_add_space_if_exists(extension),yon_add_space_if_exists(dateext),yon_add_space_if_exists(start),yon_add_space_if_exists(mail),yon_add_space_if_exists(mailfirst),yon_add_space_if_exists(sharedscripts),yon_add_space_if_exists(firstaction),yon_add_space_if_exists(lastaction),yon_add_space_if_exists(prerotate),yon_add_space_if_exists(postrotate),yon_add_space_if_exists(preremove),yon_add_space_if_exists(endscript),NULL);
|
|
|
|
|
|
|
|
if (commandline[0]==' '){
|
|
|
|
|
|
|
|
free(yon_char_divide_search(commandline," ",-1));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!yon_char_is_empty(paths)){
|
|
|
|
|
|
|
|
yon_config_register(LOGROTATE(paths),"logging",commandline);
|
|
|
|
|
|
|
|
on_close_subwindow(window->MainWindow);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
logrotate_configure_window *yon_logrotate_window_new(){
|
|
|
|
logrotate_configure_window *yon_logrotate_window_new(){
|
|
|
@ -477,9 +561,15 @@ logrotate_configure_window *yon_logrotate_window_new(){
|
|
|
|
window->LogPathRemoveButton=yon_gtk_builder_get_widget(builder,"LogPathRemoveButton");
|
|
|
|
window->LogPathRemoveButton=yon_gtk_builder_get_widget(builder,"LogPathRemoveButton");
|
|
|
|
window->list=GTK_LIST_STORE(gtk_builder_get_object(builder,"liststore1"));
|
|
|
|
window->list=GTK_LIST_STORE(gtk_builder_get_object(builder,"liststore1"));
|
|
|
|
window->PathCell=GTK_CELL_RENDERER(gtk_builder_get_object(builder,"PathCell"));
|
|
|
|
window->PathCell=GTK_CELL_RENDERER(gtk_builder_get_object(builder,"PathCell"));
|
|
|
|
|
|
|
|
window->SharedScenariosCheck=yon_gtk_builder_get_widget(builder,"SharedScenariosCheck");
|
|
|
|
|
|
|
|
window->CommandBeforeOnceEntry=yon_gtk_builder_get_widget(builder,"CommandBeforeOnceEntry");
|
|
|
|
|
|
|
|
window->CommandAfterOnceEntry=yon_gtk_builder_get_widget(builder,"CommandAfterOnceEntry");
|
|
|
|
|
|
|
|
window->CommandBeforeEntry=yon_gtk_builder_get_widget(builder,"CommandBeforeEntry");
|
|
|
|
|
|
|
|
window->CommandAfterEntry=yon_gtk_builder_get_widget(builder,"CommandAfterEntry");
|
|
|
|
|
|
|
|
window->EndworkCommandEntry=yon_gtk_builder_get_widget(builder,"EndworkCommandEntry");
|
|
|
|
gtk_window_set_title(GTK_WINDOW(window->MainWindow),TITLE_LABEL);
|
|
|
|
gtk_window_set_title(GTK_WINDOW(window->MainWindow),TITLE_LABEL);
|
|
|
|
g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_close_subwindow),NULL);
|
|
|
|
g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_close_subwindow),NULL);
|
|
|
|
g_signal_connect(G_OBJECT(window->SaveButton),"clicked",G_CALLBACK(on_logrotate_save),NULL);
|
|
|
|
g_signal_connect(G_OBJECT(window->SaveButton),"clicked",G_CALLBACK(on_logrotate_save),window);
|
|
|
|
g_signal_connect(G_OBJECT(window->PathCell),"edited",G_CALLBACK(on_path_editing_done),window);
|
|
|
|
g_signal_connect(G_OBJECT(window->PathCell),"edited",G_CALLBACK(on_path_editing_done),window);
|
|
|
|
g_signal_connect(G_OBJECT(window->PathCell),"editing-canceled",G_CALLBACK(on_path_editing_cancel),window);
|
|
|
|
g_signal_connect(G_OBJECT(window->PathCell),"editing-canceled",G_CALLBACK(on_path_editing_cancel),window);
|
|
|
|
g_signal_connect(G_OBJECT(window->LogPathAddButton),"clicked",G_CALLBACK(on_logrotate_configuration_path_add),window);
|
|
|
|
g_signal_connect(G_OBJECT(window->LogPathAddButton),"clicked",G_CALLBACK(on_logrotate_configuration_path_add),window);
|
|
|
@ -511,6 +601,9 @@ logrotate_configure_window *yon_logrotate_window_new(){
|
|
|
|
g_signal_connect(G_OBJECT(window->CreateLogCombo),"changed",G_CALLBACK(yon_gtk_widget_set_sensitive_from_combo_box_inversed),window->CreateGroupCombo);
|
|
|
|
g_signal_connect(G_OBJECT(window->CreateLogCombo),"changed",G_CALLBACK(yon_gtk_widget_set_sensitive_from_combo_box_inversed),window->CreateGroupCombo);
|
|
|
|
g_signal_connect(G_OBJECT(window->CreateLogCombo),"changed",G_CALLBACK(yon_gtk_widget_set_sensitive_from_combo_box_inversed),window->CreateLogEntry);
|
|
|
|
g_signal_connect(G_OBJECT(window->CreateLogCombo),"changed",G_CALLBACK(yon_gtk_widget_set_sensitive_from_combo_box_inversed),window->CreateLogEntry);
|
|
|
|
g_signal_connect(G_OBJECT(window->CreateLogCombo),"changed",G_CALLBACK(yon_gtk_widget_set_sensitive_from_combo_box_inversed),window->CreateLogButton);
|
|
|
|
g_signal_connect(G_OBJECT(window->CreateLogCombo),"changed",G_CALLBACK(yon_gtk_widget_set_sensitive_from_combo_box_inversed),window->CreateLogButton);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return window;
|
|
|
|
return window;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|