static char *runjob = NULL;
static bool foreground = false;
+static bool make_pid_file = true; /* create pid file */
static void init_reload(void);
static CONFIG *config;
static bool test_config = false;
" -g groupid\n"
" -m print kaboom output (for debugging)\n"
" -r <job> run <job> now\n"
+ " -P do not create pid file\n"
" -s no signals\n"
" -t test - read configuration and exit\n"
" -u userid\n"
setup_daemon_message_queue();
console_command = run_console_command;
- while ((ch = getopt(argc, argv, "c:d:fg:mr:stu:v?T")) != -1) {
+ while ((ch = getopt(argc, argv, "c:d:fg:mPr:stu:v?T")) != -1) {
switch (ch) {
case 'c': /* specify config file */
if (configfile != NULL) {
prt_kaboom = true;
break;
+ case 'P': /* no pid file */
+ make_pid_file = false;
+ break;
+
case 'r': /* run job */
if (runjob != NULL) {
free(runjob);
if (!test_config) {
/* Create pid must come after we are a daemon -- so we have our final pid */
- create_pid_file(director->pid_directory, "bacula-dir",
- get_first_port_host_order(director->DIRaddrs));
+ if (make_pid_file) {
+ create_pid_file(director->pid_directory, "bacula-dir",
+ get_first_port_host_order(director->DIRaddrs));
+ }
read_state_file(director->working_directory, "bacula-dir",
get_first_port_host_order(director->DIRaddrs));
}
unload_plugins();
if (!test_config) {
write_state_file(director->working_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs));
- delete_pid_file(director->pid_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs));
+ if (make_pid_file) {
+ delete_pid_file(director->pid_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs));
+ }
}
term_scheduler();
term_job_server();