2 Bacula(R) - The Network Backup Solution
4 Copyright (C) 2000-2015 Kern Sibbald
5 Copyright (C) 2003-2014 Free Software Foundation Europe e.V.
7 The original author of Bacula is Kern Sibbald, with contributions
8 from many others, a complete list can be found in the file AUTHORS.
10 You may use this file and others of this release according to the
11 license defined in the LICENSE file, which includes the Affero General
12 Public License, v3.0 ("AGPLv3") and some additional permissions and
13 terms pursuant to its AGPLv3 Section 7.
15 This notice must be preserved when any source code is
16 conveyed and/or propagated.
18 Bacula(R) is a registered trademark of Kern Sibbald.
22 * Bacula Director -- admin.c -- responsible for doing admin jobs
24 * Kern Sibbald, May MMIII
26 * Basic tasks done here:
27 * Display the job report.
36 bool do_admin_init(JCR *jcr)
39 if (!allow_duplicate_job(jcr)) {
46 * Returns: false on failure
49 bool do_admin(JCR *jcr)
52 jcr->jr.JobId = jcr->JobId;
54 jcr->fname = (char *)get_pool_memory(PM_FNAME);
56 /* Print Job Start message */
57 Jmsg(jcr, M_INFO, 0, _("Start Admin JobId %d, Job=%s\n"),
58 jcr->JobId, jcr->Job);
60 jcr->setJobStatus(JS_Running);
61 admin_cleanup(jcr, JS_Terminated);
67 * Release resources allocated during backup.
69 void admin_cleanup(JCR *jcr, int TermCode)
71 char sdt[50], edt[50], schedt[50];
77 Dmsg0(100, "Enter backup_cleanup()\n");
79 update_job_end(jcr, TermCode);
81 if (!db_get_job_record(jcr, jcr->db, &jcr->jr)) {
82 Jmsg(jcr, M_WARNING, 0, _("Error getting Job record for Job report: ERR=%s"),
83 db_strerror(jcr->db));
84 jcr->setJobStatus(JS_ErrorTerminated);
87 msg_type = M_INFO; /* by default INFO message */
88 switch (jcr->JobStatus) {
90 term_msg = _("Admin OK");
93 case JS_ErrorTerminated:
94 term_msg = _("*** Admin Error ***");
95 msg_type = M_ERROR; /* Generate error message */
98 term_msg = _("Admin Canceled");
101 term_msg = term_code;
102 sprintf(term_code, _("Inappropriate term code: %c\n"), jcr->JobStatus);
105 bstrftimes(schedt, sizeof(schedt), jcr->jr.SchedTime);
106 bstrftimes(sdt, sizeof(sdt), jcr->jr.StartTime);
107 bstrftimes(edt, sizeof(edt), jcr->jr.EndTime);
110 Jmsg(jcr, msg_type, 0, _("Bacula " VERSION " (" LSMDATE "): %s\n"
113 " Scheduled time: %s\n"
116 " Termination: %s\n\n"),
125 Dmsg0(100, "Leave admin_cleanup()\n");