/* * ms_admin - ADMIN command handler, used for OPERS as well * parv[0] = sender prefix * parv[1] = servername */ static void ms_admin(struct Client *client_p, struct Client *source_p, int parc, char *parv[]) { if (hunt_server(client_p, source_p, ":%s ADMIN :%s", 1, parc, parv) != HUNTED_ISME) return; if (IsClient(source_p)) do_admin(source_p); }
/* * ms_admin - ADMIN command handler, used for OPERS as well * parv[0] = sender prefix * parv[1] = servername */ static int ms_admin(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { if(hunt_server(client_p, source_p, ":%s ADMIN :%s", 1, parc, parv) != HUNTED_ISME) return 0; do_admin(source_p); return 0; }
/* * m_admin - ADMIN command handler * parv[0] = sender prefix * parv[1] = servername */ static int m_admin(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { static time_t last_used = 0L; static int count; if (!check_limit_simple(source_p, &last_used, &count, "ADMIN")) return 0; do_admin(source_p); return 0; }
/* * mr_admin - ADMIN command handler * parv[0] = sender prefix * parv[1] = servername */ static void mr_admin(struct Client *client_p, struct Client *source_p, int parc, char *parv[]) { static time_t last_used=0L; if((last_used + ConfigFileEntry.pace_wait) > CurrentTime) { sendto_one(source_p,form_str(source_p,RPL_LOAD2HI), me.name, BadPtr(parv[0]) ? "*" : parv[0]); return; } else last_used = CurrentTime; do_admin(source_p); }
/* * mr_admin - ADMIN command handler * parv[1] = servername */ static int mr_admin(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { static time_t last_used = 0L; if((last_used + ConfigFileEntry.pace_wait) > rb_current_time()) { sendto_one(source_p, form_str(RPL_LOAD2HI), me.name, EmptyString(source_p->name) ? "*" : source_p->name, "ADMIN"); return 0; } else last_used = rb_current_time(); do_admin(source_p); return 0; }
/* * m_admin - ADMIN command handler * parv[0] = sender prefix * parv[1] = servername */ static void m_admin(struct Client *client_p, struct Client *source_p, int parc, char *parv[]) { static time_t last_used=0L; if((last_used + ConfigFileEntry.pace_wait) > CurrentTime) { sendto_one(source_p,form_str(source_p,RPL_LOAD2HI),me.name,parv[0]); return; } else last_used = CurrentTime; if (!ConfigServerHide.disable_remote) { if (hunt_server(client_p,source_p,":%s ADMIN :%s",1,parc,parv) != HUNTED_ISME) return; } do_admin(source_p); }
/* * m_admin - ADMIN command handler * parv[1] = servername */ static int m_admin(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { static time_t last_used = 0L; if(parc > 1) { if((last_used + ConfigFileEntry.pace_wait) > rb_current_time()) { sendto_one(source_p, form_str(RPL_LOAD2HI), me.name, source_p->name, "ADMIN"); return 0; } else last_used = rb_current_time(); if(hunt_server(client_p, source_p, ":%s ADMIN :%s", 1, parc, parv) != HUNTED_ISME) return 0; } do_admin(source_p); return 0; }
/* * This is the engine called by jobq.c:jobq_add() when we were pulled * from the work queue. * At this point, we are running in our own thread and all * necessary resources are allocated -- see jobq.c */ static void *job_thread(void *arg) { JCR *jcr = (JCR *)arg; pthread_detach(pthread_self()); Dsm_check(100); Dmsg0(200, "=====Start Job=========\n"); jcr->setJobStatus(JS_Running); /* this will be set only if no error */ jcr->start_time = time(NULL); /* set the real start time */ jcr->jr.StartTime = jcr->start_time; if (jcr->res.job->MaxStartDelay != 0 && jcr->res.job->MaxStartDelay < (utime_t)(jcr->start_time - jcr->sched_time)) { jcr->setJobStatus(JS_Canceled); Jmsg(jcr, M_FATAL, 0, _("Job canceled because max start delay time exceeded.\n")); } if (job_check_maxrunschedtime(jcr)) { jcr->setJobStatus(JS_Canceled); Jmsg(jcr, M_FATAL, 0, _("Job canceled because max run sched time exceeded.\n")); } /* TODO : check if it is used somewhere */ if (jcr->res.job->RunScripts == NULL) { Dmsg0(200, "Warning, job->RunScripts is empty\n"); jcr->res.job->RunScripts = New(alist(10, not_owned_by_alist)); } if (!db_update_job_start_record(jcr, jcr->db, &jcr->jr)) { Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db)); } /* Run any script BeforeJob on dird */ run_scripts(jcr, jcr->res.job->RunScripts, "BeforeJob"); /* * We re-update the job start record so that the start * time is set after the run before job. This avoids * that any files created by the run before job will * be saved twice. They will be backed up in the current * job, but not in the next one unless they are changed. * Without this, they will be backed up in this job and * in the next job run because in that case, their date * is after the start of this run. */ jcr->start_time = time(NULL); jcr->jr.StartTime = jcr->start_time; if (!db_update_job_start_record(jcr, jcr->db, &jcr->jr)) { Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db)); } generate_plugin_event(jcr, bDirEventJobRun); switch (jcr->getJobType()) { case JT_BACKUP: switch (jcr->getJobProtocol()) { case PT_NDMP: if (!job_canceled(jcr)) { if (do_ndmp_backup(jcr)) { do_autoprune(jcr); } else { ndmp_backup_cleanup(jcr, JS_ErrorTerminated); } } else { ndmp_backup_cleanup(jcr, JS_Canceled); } break; default: if (!job_canceled(jcr)) { if (jcr->is_JobLevel(L_VIRTUAL_FULL)) { if (do_native_vbackup(jcr)) { do_autoprune(jcr); } else { native_vbackup_cleanup(jcr, JS_ErrorTerminated); } } else { if (do_native_backup(jcr)) { do_autoprune(jcr); } else { native_backup_cleanup(jcr, JS_ErrorTerminated); } } } else { if (jcr->is_JobLevel(L_VIRTUAL_FULL)) { native_vbackup_cleanup(jcr, JS_Canceled); } else { native_backup_cleanup(jcr, JS_Canceled); } } break; } break; case JT_VERIFY: if (!job_canceled(jcr)) { if (do_verify(jcr)) { do_autoprune(jcr); } else { verify_cleanup(jcr, JS_ErrorTerminated); } } else { verify_cleanup(jcr, JS_Canceled); } break; case JT_RESTORE: switch (jcr->getJobProtocol()) { case PT_NDMP: if (!job_canceled(jcr)) { if (do_ndmp_restore(jcr)) { do_autoprune(jcr); } else { ndmp_restore_cleanup(jcr, JS_ErrorTerminated); } } else { ndmp_restore_cleanup(jcr, JS_Canceled); } break; default: if (!job_canceled(jcr)) { if (do_native_restore(jcr)) { do_autoprune(jcr); } else { native_restore_cleanup(jcr, JS_ErrorTerminated); } } else { native_restore_cleanup(jcr, JS_Canceled); } break; } break; case JT_ADMIN: if (!job_canceled(jcr)) { if (do_admin(jcr)) { do_autoprune(jcr); } else { admin_cleanup(jcr, JS_ErrorTerminated); } } else { admin_cleanup(jcr, JS_Canceled); } break; case JT_COPY: case JT_MIGRATE: if (!job_canceled(jcr)) { if (do_migration(jcr)) { do_autoprune(jcr); } else { migration_cleanup(jcr, JS_ErrorTerminated); } } else { migration_cleanup(jcr, JS_Canceled); } break; default: Pmsg1(0, _("Unimplemented job type: %d\n"), jcr->getJobType()); break; } run_scripts(jcr, jcr->res.job->RunScripts, "AfterJob"); /* Send off any queued messages */ if (jcr->msg_queue && jcr->msg_queue->size() > 0) { dequeue_messages(jcr); } generate_plugin_event(jcr, bDirEventJobEnd); Dmsg1(50, "======== End Job stat=%c ==========\n", jcr->JobStatus); Dsm_check(100); return NULL; }