2 Bacula(R) - The Network Backup Solution
4 Copyright (C) 2000-2015 Kern Sibbald
6 The original author of Bacula is Kern Sibbald, with contributions
7 from many others, a complete list can be found in the file AUTHORS.
9 You may use this file and others of this release according to the
10 license defined in the LICENSE file, which includes the Affero General
11 Public License, v3.0 ("AGPLv3") and some additional permissions and
12 terms pursuant to its AGPLv3 Section 7.
14 This notice must be preserved when any source code is
15 conveyed and/or propagated.
17 Bacula(R) is a registered trademark of Kern Sibbald.
21 * Bacula Director -- admin.c -- responsible for doing admin jobs
23 * Kern Sibbald, May MMIII
25 * Basic tasks done here:
26 * Display the job report.
35 bool do_admin_init(JCR *jcr)
38 if (!allow_duplicate_job(jcr)) {
45 * Returns: false on failure
48 bool do_admin(JCR *jcr)
51 jcr->jr.JobId = jcr->JobId;
53 jcr->fname = (char *)get_pool_memory(PM_FNAME);
55 /* Print Job Start message */
56 Jmsg(jcr, M_INFO, 0, _("Start Admin JobId %d, Job=%s\n"),
57 jcr->JobId, jcr->Job);
59 jcr->setJobStatus(JS_Running);
60 admin_cleanup(jcr, JS_Terminated);
66 * Release resources allocated during backup.
68 void admin_cleanup(JCR *jcr, int TermCode)
70 char sdt[50], edt[50], schedt[50];
76 Dmsg0(100, "Enter admin_cleanup()\n");
78 update_job_end(jcr, TermCode);
80 if (!db_get_job_record(jcr, jcr->db, &jcr->jr)) {
81 Jmsg(jcr, M_WARNING, 0, _("Error getting Job record for Job report: ERR=%s"),
82 db_strerror(jcr->db));
83 jcr->setJobStatus(JS_ErrorTerminated);
86 msg_type = M_INFO; /* by default INFO message */
87 switch (jcr->JobStatus) {
89 term_msg = _("Admin OK");
92 case JS_ErrorTerminated:
93 term_msg = _("*** Admin Error ***");
94 msg_type = M_ERROR; /* Generate error message */
97 term_msg = _("Admin Canceled");
100 term_msg = term_code;
101 sprintf(term_code, _("Inappropriate term code: %c\n"), jcr->JobStatus);
104 bstrftimes(schedt, sizeof(schedt), jcr->jr.SchedTime);
105 bstrftimes(sdt, sizeof(sdt), jcr->jr.StartTime);
106 bstrftimes(edt, sizeof(edt), jcr->jr.EndTime);
109 Jmsg(jcr, msg_type, 0, _("Bacula " VERSION " (" LSMDATE "): %s\n"
112 " Scheduled time: %s\n"
115 " Termination: %s\n\n"),
124 Dmsg0(100, "Leave admin_cleanup()\n");