bool no_signals = false;
bool test_config = false;
JCR jcr;
+ utime_t heart_beat;
setlocale(LC_ALL, "");
bindtextdomain("bacula", LOCALEDIR);
}
}
- UA_sock = bnet_connect(NULL, 5, 15, "Director daemon", dir->address,
+ if (dir->heartbeat_interval) {
+ heart_beat = dir->heartbeat_interval;
+ } else if (cons) {
+ heart_beat = cons->heartbeat_interval;
+ } else {
+ heart_beat = 0;
+ }
+ UA_sock = bnet_connect(NULL, 5, 15, heart_beat, "Director daemon", dir->address,
NULL, dir->DIRport, 0);
if (UA_sock == NULL) {
terminate_console(0);
-/*
- * Main configuration file parser for Bacula User Agent
- * some parts may be split into separate files such as
- * the schedule configuration (sch_config.c).
- *
- * Note, the configuration file parser consists of three parts
- *
- * 1. The generic lexical scanner in lib/lex.c and lib/lex.h
- *
- * 2. The generic config scanner in lib/parse_config.c and
- * lib/parse_config.h.
- * These files contain the parser code, some utility
- * routines, and the common store routines (name, int,
- * string).
- *
- * 3. The daemon specific file, which contains the Resource
- * definitions as well as any specific store routines
- * for the resource records.
- *
- * Kern Sibbald, January MM, September MM
- */
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2006 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
(FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
Switzerland, email:ftf@fsfeurope.org.
*/
+/*
+ * Main configuration file parser for Bacula User Agent
+ * some parts may be split into separate files such as
+ * the schedule configuration (sch_config.c).
+ *
+ * Note, the configuration file parser consists of three parts
+ *
+ * 1. The generic lexical scanner in lib/lex.c and lib/lex.h
+ *
+ * 2. The generic config scanner in lib/parse_config.c and
+ * lib/parse_config.h.
+ * These files contain the parser code, some utility
+ * routines, and the common store routines (name, int,
+ * string).
+ *
+ * 3. The daemon specific file, which contains the Resource
+ * definitions as well as any specific store routines
+ * for the resource records.
+ *
+ * Kern Sibbald, January MM, September MM
+ */
#include "bacula.h"
#include "console_conf.h"
{"tlscertificate", store_dir, ITEM(res_cons.tls_certfile), 0, 0, 0},
{"tlskey", store_dir, ITEM(res_cons.tls_keyfile), 0, 0, 0},
{"director", store_str, ITEM(res_cons.director), 0, 0, 0},
+ {"heartbeatinterval", store_time, ITEM(res_cons.heartbeat_interval), 0, ITEM_DEFAULT, 0},
{NULL, NULL, {0}, 0, 0, 0}
};
{"tlscacertificatedir", store_dir, ITEM(res_dir.tls_ca_certdir), 0, 0, 0},
{"tlscertificate", store_dir, ITEM(res_dir.tls_certfile), 0, 0, 0},
{"tlskey", store_dir, ITEM(res_dir.tls_keyfile), 0, 0, 0},
+ {"heartbeatinterval", store_time, ITEM(res_dir.heartbeat_interval), 0, ITEM_DEFAULT, 0},
{NULL, NULL, {0}, 0, 0, 0}
};
-/*
- * Bacula User Agent specific configuration and defines
- *
- * Kern Sibbald, Sep MM
- *
- * Version $Id$
- */
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2006 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
(FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
Switzerland, email:ftf@fsfeurope.org.
*/
+/*
+ * Bacula User Agent specific configuration and defines
+ *
+ * Kern Sibbald, Sep MM
+ *
+ * Version $Id$
+ */
/*
* Resource codes -- they must be sequential for indexing
char *tls_certfile; /* TLS Client Certificate File */
char *tls_keyfile; /* TLS Client Key File */
char *director; /* bind to director */
+ utime_t heartbeat_interval; /* Interval to send heartbeats to Dir */
TLS_CONTEXT *tls_ctx; /* Shared TLS Context */
};
char *tls_ca_certdir; /* TLS CA Certificate Directory */
char *tls_certfile; /* TLS Client Certificate File */
char *tls_keyfile; /* TLS Client Key File */
+ utime_t heartbeat_interval; /* Interval to send heartbeats to Dir */
TLS_CONTEXT *tls_ctx; /* Shared TLS Context */
};
{"password", store_password, ITEM(res_dir.password), 0, ITEM_REQUIRED, 0},
{"fdconnecttimeout", store_time,ITEM(res_dir.FDConnectTimeout), 0, ITEM_DEFAULT, 60 * 30},
{"sdconnecttimeout", store_time,ITEM(res_dir.SDConnectTimeout), 0, ITEM_DEFAULT, 60 * 30},
+ {"heartbeatinterval", store_time, ITEM(res_dir.heartbeat_interval), 0, ITEM_DEFAULT, 0},
{"tlsenable", store_bool, ITEM(res_dir.tls_enable), 0, 0, 0},
{"tlsrequire", store_bool, ITEM(res_dir.tls_require), 0, 0, 0},
{"tlsverifypeer", store_bool, ITEM(res_dir.tls_verify_peer), 0, ITEM_DEFAULT, true},
{"catalog", store_res, ITEM(res_client.catalog), R_CATALOG, ITEM_REQUIRED, 0},
{"fileretention", store_time, ITEM(res_client.FileRetention), 0, ITEM_DEFAULT, 60*60*24*60},
{"jobretention", store_time, ITEM(res_client.JobRetention), 0, ITEM_DEFAULT, 60*60*24*180},
+ {"heartbeatinterval", store_time, ITEM(res_client.heartbeat_interval), 0, ITEM_DEFAULT, 0},
{"autoprune", store_bool, ITEM(res_client.AutoPrune), 0, ITEM_DEFAULT, true},
{"maximumconcurrentjobs", store_pint, ITEM(res_client.MaxConcurrentJobs), 0, ITEM_DEFAULT, 1},
{"tlsenable", store_bool, ITEM(res_client.tls_enable), 0, 0, 0},
{"mediatype", store_strname, ITEM(res_store.media_type), 0, ITEM_REQUIRED, 0},
{"autochanger", store_bool, ITEM(res_store.autochanger), 0, ITEM_DEFAULT, 0},
{"enabled", store_bool, ITEM(res_store.enabled), 0, ITEM_DEFAULT, true},
+ {"heartbeatinterval", store_time, ITEM(res_store.heartbeat_interval), 0, ITEM_DEFAULT, 0},
{"maximumconcurrentjobs", store_pint, ITEM(res_store.MaxConcurrentJobs), 0, ITEM_DEFAULT, 1},
{"sddport", store_pint, ITEM(res_store.SDDport), 0, 0, 0}, /* deprecated */
{"tlsenable", store_bool, ITEM(res_store.tls_enable), 0, 0, 0},
uint32_t MaxConcurrentJobs; /* Max concurrent jobs for whole director */
utime_t FDConnectTimeout; /* timeout for connect in seconds */
utime_t SDConnectTimeout; /* timeout in seconds */
+ utime_t heartbeat_interval; /* Interval to send heartbeats */
char *tls_ca_certfile; /* TLS CA Certificate File */
char *tls_ca_certdir; /* TLS CA Certificate Directory */
char *tls_certfile; /* TLS Server Certificate File */
int FDport; /* Where File daemon listens */
utime_t FileRetention; /* file retention period in seconds */
utime_t JobRetention; /* job retention period in seconds */
+ utime_t heartbeat_interval; /* Interval to send heartbeats */
char *address;
char *password;
CAT *catalog; /* Catalog resource */
bool enabled; /* Set if device is enabled */
bool autochanger; /* set if autochanger */
int64_t StorageId; /* Set from Storage DB record */
+ utime_t heartbeat_interval; /* Interval to send heartbeats */
int drives; /* number of drives in autochanger */
/* Methods */
{
BSOCK *fd;
char ed1[30];
+ utime_t heart_beat;
+
+ if (jcr->client->heartbeat_interval) {
+ heart_beat = jcr->client->heartbeat_interval;
+ } else {
+ heart_beat = director->heartbeat_interval;
+ }
if (!jcr->file_bsock) {
- fd = bnet_connect(jcr, retry_interval, max_retry_time,
+ fd = bnet_connect(jcr, retry_interval, max_retry_time, heart_beat,
_("File daemon"), jcr->client->address,
NULL, jcr->client->FDport, verbose);
if (fd == NULL) {
}
}
/* TODO : we have to play with other client */
- /*
+ /*
else {
send command to an other client
}
-/*
- *
- * Bacula Director -- msgchan.c -- handles the message channel
- * to the Storage daemon and the File daemon.
- *
- * Kern Sibbald, August MM
- *
- * This routine runs as a thread and must be thread reentrant.
- *
- * Basic tasks done here:
- * Open a message channel with the Storage daemon
- * to authenticate ourself and to pass the JobId.
- * Create a thread to interact with the Storage daemon
- * who returns a job status and requests Catalog services, etc.
- *
- * Version $Id$
- */
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2006 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-20076 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
(FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
Switzerland, email:ftf@fsfeurope.org.
*/
+/*
+ *
+ * Bacula Director -- msgchan.c -- handles the message channel
+ * to the Storage daemon and the File daemon.
+ *
+ * Kern Sibbald, August MM
+ *
+ * This routine runs as a thread and must be thread reentrant.
+ *
+ * Basic tasks done here:
+ * Open a message channel with the Storage daemon
+ * to authenticate ourself and to pass the JobId.
+ * Create a thread to interact with the Storage daemon
+ * who returns a job status and requests Catalog services, etc.
+ *
+ * Version $Id$
+ */
#include "bacula.h"
#include "dird.h"
{
BSOCK *sd;
STORE *store;
+ utime_t heart_beat;
if (jcr->store_bsock) {
return true; /* already connected */
store = jcr->rstore;
}
+ if (store->heartbeat_interval) {
+ heart_beat = store->heartbeat_interval;
+ } else {
+ heart_beat = director->heartbeat_interval;
+ }
+
/*
* Open message channel with the Storage daemon
*/
Dmsg2(100, "bnet_connect to Storage daemon %s:%d\n", store->address,
store->SDport);
- sd = bnet_connect(jcr, retry_interval, max_retry_time,
+ sd = bnet_connect(jcr, retry_interval, max_retry_time, heart_beat,
_("Storage daemon"), store->address,
NULL, store->SDport, verbose);
if (sd == NULL) {
-/*
- * Main configuration file parser for Bacula File Daemon (Client)
- * some parts may be split into separate files such as
- * the schedule configuration (sch_config.c).
- *
- * Note, the configuration file parser consists of three parts
- *
- * 1. The generic lexical scanner in lib/lex.c and lib/lex.h
- *
- * 2. The generic config scanner in lib/parse_config.c and
- * lib/parse_config.h.
- * These files contain the parser code, some utility
- * routines, and the common store routines (name, int,
- * string).
- *
- * 3. The daemon specific file, which contains the Resource
- * definitions as well as any specific store routines
- * for the resource records.
- *
- * Kern Sibbald, September MM
- *
- * Version $Id$
- */
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2006 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
(FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
Switzerland, email:ftf@fsfeurope.org.
*/
+/*
+ * Main configuration file parser for Bacula File Daemon (Client)
+ * some parts may be split into separate files such as
+ * the schedule configuration (sch_config.c).
+ *
+ * Note, the configuration file parser consists of three parts
+ *
+ * 1. The generic lexical scanner in lib/lex.c and lib/lex.h
+ *
+ * 2. The generic config scanner in lib/parse_config.c and
+ * lib/parse_config.h.
+ * These files contain the parser code, some utility
+ * routines, and the common store routines (name, int,
+ * string).
+ *
+ * 3. The daemon specific file, which contains the Resource
+ * definitions as well as any specific store routines
+ * for the resource records.
+ *
+ * Kern Sibbald, September MM
+ *
+ * Version $Id$
+ */
#include "bacula.h"
#include "filed.h"
{"scriptsdirectory", store_dir, ITEM(res_client.scripts_directory), 0, 0, 0},
{"maximumconcurrentjobs", store_pint, ITEM(res_client.MaxConcurrentJobs), 0, ITEM_DEFAULT, 10},
{"messages", store_res, ITEM(res_client.messages), R_MSGS, 0, 0},
- {"heartbeatinterval", store_time, ITEM(res_client.heartbeat_interval), 0, ITEM_DEFAULT, 0},
{"sdconnecttimeout", store_time,ITEM(res_client.SDConnectTimeout), 0, ITEM_DEFAULT, 60 * 30},
+ {"heartbeatinterval", store_time, ITEM(res_client.heartbeat_interval), 0, ITEM_DEFAULT, 0},
{"maximumnetworkbuffersize", store_pint, ITEM(res_client.max_network_buffer_size), 0, 0, 0},
#ifdef DATA_ENCRYPTION
{"pkisignatures", store_bool, ITEM(res_client.pki_sign), 0, ITEM_DEFAULT, 0},
-/*
- * Bacula File Daemon specific configuration
- *
- * Kern Sibbald, Sep MM
- *
- * Version $Id$
- */
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2006 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
(FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
Switzerland, email:ftf@fsfeurope.org.
*/
+/*
+ * Bacula File Daemon specific configuration
+ *
+ * Kern Sibbald, Sep MM
+ *
+ * Version $Id$
+ */
/*
* Resource codes -- they must be sequential for indexing
char *scripts_directory;
MSGS *messages; /* daemon message handler */
int MaxConcurrentJobs;
- utime_t heartbeat_interval; /* Interval to send heartbeats to Dir */
utime_t SDConnectTimeout; /* timeout in seconds */
+ utime_t heartbeat_interval; /* Interval to send heartbeats */
uint32_t max_network_buffer_size; /* max network buf size */
bool pki_sign; /* Enable Data Integrity Verification via Digital Signatures */
bool pki_encrypt; /* Enable Data Encryption */
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2006 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
Dmsg3(110, "Open storage: %s:%d ssl=%d\n", jcr->stored_addr, stored_port, enable_ssl);
/* Open command communications with Storage daemon */
/* Try to connect for 1 hour at 10 second intervals */
- sd = bnet_connect(jcr, 10, (int)me->SDConnectTimeout, _("Storage daemon"),
- jcr->stored_addr, NULL, stored_port, 1);
+ sd = bnet_connect(jcr, 10, (int)me->SDConnectTimeout, me->heartbeat_interval,
+ _("Storage daemon"), jcr->stored_addr, NULL, stored_port, 1);
if (sd == NULL) {
Jmsg(jcr, M_FATAL, 0, _("Failed to connect to Storage daemon: %s:%d\n"),
jcr->stored_addr, stored_port);
-/*
- * Bacula JCR Structure definition for Daemons and the Library
- * This definition consists of a "Global" definition common
- * to all daemons and used by the library routines, and a
- * daemon specific part that is enabled with #defines.
- *
- * Kern Sibbald, Nov MM
- *
- * Version $Id$
- */
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2006 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
(FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
Switzerland, email:ftf@fsfeurope.org.
*/
+/*
+ * Bacula JCR Structure definition for Daemons and the Library
+ * This definition consists of a "Global" definition common
+ * to all daemons and used by the library routines, and a
+ * daemon specific part that is enabled with #defines.
+ *
+ * Kern Sibbald, Nov MM
+ *
+ * Version $Id$
+ */
#ifndef __JCR_H_
* Returns BSOCK * pointer on success
*
*/
-static BSOCK *bnet_open(JCR * jcr, const char *name, char *host, char *service,
- int port, int *fatal)
+static BSOCK *bnet_open(JCR *jcr, const char *name, char *host, char *service,
+ int port, utime_t heart_beat, int *fatal)
{
int sockfd = -1;
dlist *addr_list;
Qmsg1(jcr, M_WARNING, 0, _("Cannot set SO_KEEPALIVE on socket: %s\n"),
be.strerror());
}
+#if defined(TCP_KEEPIDLE)
+ if (heart_beat) {
+ int opt = heart_beat
+ if (setsockopt(sockfd, IPPROTO_IP, TCP_KEEPIDLE, (sockopt_val_t)&opt, sizeof(opt)) < 0) {
+ berrno be;
+ Qmsg1(jcr, M_WARNING, 0, _("Cannot set SO_KEEPALIVE on socket: %s\n"),
+ be.strerror());
+ }
+ }
+#endif
+
/* connect to server */
if (connect(sockfd, ipaddr->get_sockaddr(), ipaddr->get_sockaddr_len()) < 0) {
save_errno = errno;
* Try to connect to host for max_retry_time at retry_time intervals.
*/
BSOCK *bnet_connect(JCR * jcr, int retry_interval, utime_t max_retry_time,
+ utime_t heart_beat,
const char *name, char *host, char *service, int port,
int verbose)
{
time_t begin_time = time(NULL);
time_t now;
- for (i = 0; (bsock = bnet_open(jcr, name, host, service, port, &fatal)) == NULL;
+ for (i = 0; (bsock = bnet_open(jcr, name, host, service, port, heart_beat, &fatal)) == NULL;
i -= retry_interval) {
berrno be;
if (fatal || (jcr && job_canceled(jcr))) {
uint32_t dbuf_size, start_size;
#if defined(IP_TOS) && defined(IPTOS_THROUGHPUT)
int opt;
-
opt = IPTOS_THROUGHPUT;
- setsockopt(bs->fd, IPPROTO_IP, IP_TOS, (sockopt_val_t) & opt, sizeof(opt));
+ setsockopt(bs->fd, IPPROTO_IP, IP_TOS, (sockopt_val_t)&opt, sizeof(opt));
#endif
if (size != 0) {
bool bnet_tls_client (TLS_CONTEXT *ctx, BSOCK *bsock,
alist *verify_list);
BSOCK * bnet_connect (JCR *jcr, int retry_interval,
- utime_t max_retry_time, const char *name, char *host, char *service,
+ utime_t max_retry_time, utime_t heart_beat,
+ const char *name, char *host, char *service,
int port, int verbose);
void bnet_close (BSOCK *bsock);
BSOCK * init_bsock (JCR *jcr, int sockfd, const char *who, const char *ip,
{"tlscacertificatedir", store_dir, ITEM(dir_res.tls_ca_certdir), 0, 0, 0},
{"tlscertificate", store_dir, ITEM(dir_res.tls_certfile), 0, 0, 0},
{"tlskey", store_dir, ITEM(dir_res.tls_keyfile), 0, 0, 0},
+ {"heartbeatinterval", store_time, ITEM(dir_res.heartbeat_interval), 0, ITEM_DEFAULT, 0},
{NULL, NULL, {0}, 0, 0, 0}
};
{"tlscacertificatedir", store_dir, ITEM(con_res.tls_ca_certdir), 0, 0, 0},
{"tlscertificate", store_dir, ITEM(con_res.tls_certfile), 0, 0, 0},
{"tlskey", store_dir, ITEM(con_res.tls_keyfile), 0, 0, 0},
+ {"heartbeatinterval", store_time, ITEM(con_res.heartbeat_interval), 0, ITEM_DEFAULT, 0},
{NULL, NULL, {0}, 0, 0, 0}
};
-/*
- * Bacula Adminstration Tool (bat)
- *
- * Kern Sibbald, March 2002
- *
- * Version $Id$
- */
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2002-2006 Free Software Foundation Europe e.V.
+ Copyright (C) 2002-2007 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
(FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
Switzerland, email:ftf@fsfeurope.org.
*/
+/*
+ * Bacula Adminstration Tool (bat)
+ *
+ * Kern Sibbald, March 2002
+ *
+ * Version $Id$
+ */
#ifndef _BAT_CONF_H_
#define _BAT_CONF_H_
char *tls_ca_certdir; /* TLS CA Certificate Directory */
char *tls_certfile; /* TLS Client Certificate File */
char *tls_keyfile; /* TLS Client Key File */
+ utime_t heartbeat_interval; /* Dir heartbeat interval */
TLS_CONTEXT *tls_ctx; /* Shared TLS Context */
char *tls_ca_certdir; /* TLS CA Certificate Directory */
char *tls_certfile; /* TLS Client Certificate File */
char *tls_keyfile; /* TLS Client Key File */
+ utime_t heartbeat_interval; /* Dir heartbeat interval */
TLS_CONTEXT *tls_ctx; /* Shared TLS Context */
};
void Console::connect()
{
JCR jcr;
+ utime_t heart_beat;
m_textEdit = textEdit; /* our console screen */
CONRES *cons = (CONRES *)GetNextRes(R_CONSOLE, (RES *)NULL);
UnlockRes();
- m_sock = bnet_connect(NULL, 5, 15, _("Director daemon"), m_dir->address,
+ if (m_dir->heartbeat_interval) {
+ heart_beat = m_dir->heartbeat_interval;
+ } else if (cons) {
+ heart_beat = cons->heartbeat_interval;
+ } else {
+ heart_beat = 0;
+ }
+
+ m_sock = bnet_connect(NULL, 5, 15, heart_beat,
+ _("Director daemon"), m_dir->address,
NULL, m_dir->DIRport, 0);
if (m_sock == NULL) {
mainWin->set_status("Connection failed");
General:
22Apr07
+kes Implement socket level heartbeat (tcp_keepidle)
ebl Commit File relocation patch
kes Make bat have 'make install' target.
kes Warn during install if old gnome-console binary found.