3 * Bacula Director -- admin.c -- responsible for doing admin jobs
5 * Kern Sibbald, May MMIII
7 * Basic tasks done here:
8 * Display the job report.
14 Copyright (C) 2003-2006 Kern Sibbald
16 This program is free software; you can redistribute it and/or
17 modify it under the terms of the GNU General Public License
18 version 2 as amended with additional clauses defined in the
19 file LICENSE in the main source directory.
21 This program is distributed in the hope that it will be useful,
22 but WITHOUT ANY WARRANTY; without even the implied warranty of
23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 the file LICENSE for additional details.
33 bool do_admin_init(JCR *jcr)
40 * Returns: false on failure
43 bool do_admin(JCR *jcr)
46 jcr->jr.JobId = jcr->JobId;
48 jcr->fname = (char *)get_pool_memory(PM_FNAME);
50 /* Print Job Start message */
51 Jmsg(jcr, M_INFO, 0, _("Start Admin JobId %d, Job=%s\n"),
52 jcr->JobId, jcr->Job);
54 set_jcr_job_status(jcr, JS_Running);
55 admin_cleanup(jcr, JS_Terminated);
61 * Release resources allocated during backup.
63 void admin_cleanup(JCR *jcr, int TermCode)
65 char sdt[50], edt[50];
71 Dmsg0(100, "Enter backup_cleanup()\n");
72 memset(&mr, 0, sizeof(mr));
73 set_jcr_job_status(jcr, TermCode);
75 update_job_end_record(jcr); /* update database */
77 if (!db_get_job_record(jcr, jcr->db, &jcr->jr)) {
78 Jmsg(jcr, M_WARNING, 0, _("Error getting job record for stats: %s"),
79 db_strerror(jcr->db));
80 set_jcr_job_status(jcr, JS_ErrorTerminated);
83 msg_type = M_INFO; /* by default INFO message */
84 switch (jcr->JobStatus) {
86 term_msg = _("Admin OK");
89 case JS_ErrorTerminated:
90 term_msg = _("*** Admin Error ***");
91 msg_type = M_ERROR; /* Generate error message */
94 term_msg = _("Admin Canceled");
98 sprintf(term_code, _("Inappropriate term code: %c\n"), jcr->JobStatus);
101 bstrftime(sdt, sizeof(sdt), jcr->jr.StartTime);
102 bstrftime(edt, sizeof(edt), jcr->jr.EndTime);
104 Jmsg(jcr, msg_type, 0, _("Bacula " VERSION " (" LSMDATE "): %s\n"
109 " Termination: %s\n\n"),
117 Dmsg0(100, "Leave admin_cleanup()\n");