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.
13 Bacula® - The Network Backup Solution
15 Copyright (C) 2003-2006 Free Software Foundation Europe e.V.
17 The main author of Bacula is Kern Sibbald, with contributions from
18 many others, a complete list can be found in the file AUTHORS.
19 This program is Free Software; you can redistribute it and/or
20 modify it under the terms of version two of the GNU General Public
21 License as published by the Free Software Foundation plus additions
22 that are listed in the file LICENSE.
24 This program is distributed in the hope that it will be useful, but
25 WITHOUT ANY WARRANTY; without even the implied warranty of
26 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27 General Public License for more details.
29 You should have received a copy of the GNU General Public License
30 along with this program; if not, write to the Free Software
31 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
34 Bacula® is a registered trademark of John Walker.
35 The licensor of Bacula is the Free Software Foundation Europe
36 (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
37 Switzerland, email:ftf@fsfeurope.org.
45 bool do_admin_init(JCR *jcr)
52 * Returns: false on failure
55 bool do_admin(JCR *jcr)
58 jcr->jr.JobId = jcr->JobId;
60 jcr->fname = (char *)get_pool_memory(PM_FNAME);
62 /* Print Job Start message */
63 Jmsg(jcr, M_INFO, 0, _("Start Admin JobId %d, Job=%s\n"),
64 jcr->JobId, jcr->Job);
66 set_jcr_job_status(jcr, JS_Running);
67 admin_cleanup(jcr, JS_Terminated);
73 * Release resources allocated during backup.
75 void admin_cleanup(JCR *jcr, int TermCode)
77 char sdt[50], edt[50];
83 Dmsg0(100, "Enter backup_cleanup()\n");
84 memset(&mr, 0, sizeof(mr));
85 set_jcr_job_status(jcr, TermCode);
87 update_job_end_record(jcr); /* update database */
89 if (!db_get_job_record(jcr, jcr->db, &jcr->jr)) {
90 Jmsg(jcr, M_WARNING, 0, _("Error getting job record for stats: %s"),
91 db_strerror(jcr->db));
92 set_jcr_job_status(jcr, JS_ErrorTerminated);
95 msg_type = M_INFO; /* by default INFO message */
96 switch (jcr->JobStatus) {
98 term_msg = _("Admin OK");
101 case JS_ErrorTerminated:
102 term_msg = _("*** Admin Error ***");
103 msg_type = M_ERROR; /* Generate error message */
106 term_msg = _("Admin Canceled");
109 term_msg = term_code;
110 sprintf(term_code, _("Inappropriate term code: %c\n"), jcr->JobStatus);
113 bstrftime(sdt, sizeof(sdt), jcr->jr.StartTime);
114 bstrftime(edt, sizeof(edt), jcr->jr.EndTime);
116 Jmsg(jcr, msg_type, 0, _("Bacula " VERSION " (" LSMDATE "): %s\n"
121 " Termination: %s\n\n"),
129 Dmsg0(100, "Leave admin_cleanup()\n");