it will pipe the bootstrap record. It could for example be a shell
script that emails you the bootstrap record.
- On versions 1.39.22 or greater, before opening the file or execute the
+ On versions 1.39.22 or greater, before opening the file or executing the
specified command, Bacula performs
\ilink{character substitution}{character substitution} like in RunScript
directive. To automatically manage your bootstrap files, you can use
\index[dir]{RunScript}
\index[dir]{Directive!Run Script}
- This directive is only implemented in version 1.39.22 and later.
- The RunScript directive behaves more like a resource in that it
+ This directive is implemented in version 1.39.22 and later.
+ The RunScript directive behaves like a resource in that it
requires opening and closing braces around a number of directives
that make up the body of the runscript.
Bacula job report. The command string must be a valid program name or name
of a shell script.
- In addition, the command string is parsed then fed to the execvp() function,
+ In addition, the command string is parsed then fed to the OS,
which means that the path will be searched to execute your specified
command, but there is no shell interpretation, as a consequence, if you
invoke complicated commands or want any shell features such as redirection
{\bf Special Windows Considerations}
In addition, for a Windows client on version 1.33 and above, please take
- careful note that you must ensure a correct path to your script. The
- script or program can be a .com, .exe or a .bat file. However, if you
- specify a path, you must also specify the full extension. Unix like
- commands will not work unless you have installed and properly configured
- Cygwin in addition to and separately from Bacula.
-
+ note that you must ensure a correct path to your script. The script or
+ program can be a .com, .exe or a .bat file. If you just put the program
+ name in then Bacula will search using the same rules that cmd.exe uses
+ (current directory, Bacula bin directory, and PATH). It will even try the
+ different extensions in the same order as cmd.exe.
The command can be anything that cmd.exe or command.com will recognize
- as an executable file. Specifying the executable's extension is
- optional, unless there is an ambiguity. (i.e. ls.bat, ls.exe)
+ as an executable file.
+
+ However, if you have slashes in the program name then Bacula figures you
+ are fully specifying the name, so you must also explicitly add the three
+ character extension.
+
+ The command is run in a Win32 environment, so Unix like commands will not
+ work unless you have installed and properly configured Cygwin in addition
+ to and separately from Bacula.
The System \%Path\% will be searched for the command. (under the
environment variable dialog you have have both System Environment and
available to bacula-fd, if it is running as a service.)
System environment variables can be referenced with \%var\% and
- used as either part of the command name or arguments.
+ used as either part of the command name or arguments.
+
+ So if you have a script in the Bacula\\bin directory then the following lines
+ should work fine:
+\footnotesize
+\begin{verbatim}
+ Client Run Before Job = systemstate
+or
+ Client Run Before Job = systemstate.bat
+or
+ Client Run Before Job = "systemstate"
+or
+ Client Run Before Job = "systemstate.bat"
+or
+ ClientRunBeforeJob = "\"C:/Program Files/Bacula/systemstate.bat\""
+\end{verbatim}
+\normalsize
+
+The outer set of quotes is removed when the configuration file is parsed.
+You need to escape the inner quotes so that they are there when the code
+that parses the command line for execution runs so it can tell what the
+program name is.
+
\footnotesize
\begin{verbatim}
For Win32, please note that there are certain limitations:
-
ClientRunBeforeJob = "C:/Program Files/Bacula/bin/pre-exec.bat"
Lines like the above do not work because there are limitations of
be rescheduled. The default is {\bf no} (i.e. the job will not be
rescheduled).
-
This specification can be useful for portables, laptops, or other
machines that are not always connected to the network or switched on.