2 Bacula® - The Network Backup Solution
4 Copyright (C) 2003-2007 Free Software Foundation Europe e.V.
6 The main author of Bacula is Kern Sibbald, with contributions from
7 many others, a complete list can be found in the file AUTHORS.
8 This program is Free Software; you can redistribute it and/or
9 modify it under the terms of version three of the GNU Affero General Public
10 License as published by the Free Software Foundation and included
13 This program is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU Affero General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 Bacula® is a registered trademark of Kern Sibbald.
24 The licensor of Bacula is the Free Software Foundation Europe
25 (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
26 Switzerland, email:ftf@fsfeurope.org.
30 * Bacula Director -- admin.c -- responsible for doing admin jobs
32 * Kern Sibbald, May MMIII
34 * Basic tasks done here:
35 * Display the job report.
45 bool do_admin_init(JCR *jcr)
48 if (!allow_duplicate_job(jcr)) {
55 * Returns: false on failure
58 bool do_admin(JCR *jcr)
61 jcr->jr.JobId = jcr->JobId;
63 jcr->fname = (char *)get_pool_memory(PM_FNAME);
65 /* Print Job Start message */
66 Jmsg(jcr, M_INFO, 0, _("Start Admin JobId %d, Job=%s\n"),
67 jcr->JobId, jcr->Job);
69 jcr->setJobStatus(JS_Running);
70 admin_cleanup(jcr, JS_Terminated);
76 * Release resources allocated during backup.
78 void admin_cleanup(JCR *jcr, int TermCode)
80 char sdt[50], edt[50];
86 Dmsg0(100, "Enter backup_cleanup()\n");
87 memset(&mr, 0, sizeof(mr));
89 update_job_end(jcr, TermCode);
91 if (!db_get_job_record(jcr, jcr->db, &jcr->jr)) {
92 Jmsg(jcr, M_WARNING, 0, _("Error getting Job record for Job report: ERR=%s"),
93 db_strerror(jcr->db));
94 jcr->setJobStatus(JS_ErrorTerminated);
97 msg_type = M_INFO; /* by default INFO message */
98 switch (jcr->JobStatus) {
100 term_msg = _("Admin OK");
103 case JS_ErrorTerminated:
104 term_msg = _("*** Admin Error ***");
105 msg_type = M_ERROR; /* Generate error message */
108 term_msg = _("Admin Canceled");
111 term_msg = term_code;
112 sprintf(term_code, _("Inappropriate term code: %c\n"), jcr->JobStatus);
115 bstrftime(sdt, sizeof(sdt), jcr->jr.StartTime);
116 bstrftime(edt, sizeof(edt), jcr->jr.EndTime);
118 Jmsg(jcr, msg_type, 0, _("Bacula " VERSION " (" LSMDATE "): %s\n"
123 " Termination: %s\n\n"),
131 Dmsg0(100, "Leave admin_cleanup()\n");