bucardo_ctl - utility script for controlling the Bucardo program
This documents describes bucardo_ctl version 1.1.19
./bucardo_ctl start "Starting up - Greg"
./bucardo_ctl stop "Bringing down for debugging - Raul E."
./bucardo_ctl ping
./bucardo_ctl status
./bucardo_ctl status sync1 sync2
./bucardo_ctl kick sync1 sync2
./bucardo_ctl kick sync1 0 --retry=10
./bucardoctl reload_config
The bucardo_ctl script is used to control the operation of a Bucardo process. Primarily it is used for stopping and starting Bucardo, viewing current information, and for kicking off named syncs. The script needs to know how to connect to the Bucardo database: this information can be passed as arguments or hard-coded into the script itself. If you have multiple Bucardos running, it is recommended that you create aliases for each database.
Usage: ./bucardo_ctl start "Reason --name"
Restarts Bucardo cleanly by first issuing the equivalent of a stop to ask any existing Bucardo proceses to exit, and then starting a new Bucardo MCP process. A short reason and name should be provided - these are logged in the reason_file file and sent in the email sent when Bucardo has been started up.
Before attempting to kill any old processes, a ping command with a timeout of 5 seconds is issued. If this returns successfully (indicating an active MCP process already running), the script will exit with a return value of 2.
Usage: ./bucardo_ctl stop "Reason --name"
Forces Bucardo to quit by creating a stop file which all MCP, CTL, and KID processes should detect and cause them to exit. Note that active syncs will not exit right away, as they will not look for the stop file until they have finished their current run. Typically, you should scan the list of processes after running this program to make sure that all Bucardo processes have stopped. One should also provide a reason for issuing the stop - usually this is a short explanation and your name. This is logged in the reason_file file and is also used by Bucardo when it exits and sends out mail about its death.
Usage: ./bucardo_ctl kick <syncname(s)> [timeout]
Tells one or more named syncs to fire as soon as possible. Note that this simply sends a request that the sync fire: it may not start right away if the same sync is already running, or if the source or target database has exceeded the number of allowed Bucardo connections. If the final argument is a number, it is treated as a timeout. If this number is zero, the bucardo_ctl command will not return until the sync has finished. For any other number, the sync will wait at most that number of seconds. If any sync has not finished before the timeout, a false value is returned. In all other cases, a true value is returned.
If a timeout is given, the total completion time in seconds is also displayed. If the sync is going to multiple targets, the time that each target takes from the start of the kick is also shown as each target finishes.
Forces Bucardo to reload the bucardo_config file, and then restart all processes to ensure that the new information is loaded.
Sends a ping notice to the MCP process to see if it will respond. By default, it will wait 15 seconds. A numeric argument will change this timeout. Using a 0 as the timeout indicates waiting forever. If a response was returned, the program will exit with a value of 0. If it times out, the value will be 1.
Usage: ./bucardo_ctl status [syncname(s)] [--sort=#] [--daysback=#] [--showdays]
Shows the current status of all known syncs in a tabular format. If given one or more syncnames, shows detailed information for each one.
When showing all syncs, the columns are:
The name of the sync
The type of the sync. F
= fullcopy, S
= swap, P
= pushdelta. In addition, if a sync is overdue, a O!
will
appear, and if it is expired, a E!
will appear.
The current status of this sync. If no sync is running, idle
will appear. If a sync has been rquested, but has not
started yet, WAIT
will appear, along with how long since the sync was requested. If a sync is
currently running, RUN
will appear, followed by the amount of time the sync has been running, followed by which
target the sync is running against. Note that syncs running to more than one database at a time will only show
the one most recently started.
The PID of the current sync's controller (CTL). Note that if this is not a persistent sync and the state is idle
,
this is merely a historical record and does not represent an active process.
How long since this sync last ran succesfully. Remember that this is affected by the --daysback parameter.
The amount of time the last successful sync took to run.
The number of inserts. updates, and deletes performed by the last successful sync.
How long since this sync failed to run successfully. Strongly affected by the --daysback parameter.
The amount of time the last failed sync took before it was aborted.
Activates one or more named syncs. If given a timeout argument, it will wait until it has received confirmation from Bucardo that each sync has been successfully activated.
Deactivates one or more named syncs. If given a timeout argument, it will wait until it has received confirmation from Bucardo that the sync has been successfully deactivated.
It is usually easier to set most of these options at the top of the script, or make an alias for them, as they will not change very often if at all.
The port, host, and name of the Bucardo database, the user to connect as, and the password to use.
Tells Bucardo (not bucardo_ctl) to run in verbose mode. Default is on. Turning this off is not recommended.
Makes bucardo_ctl run verbosely. Default is off.
Tells bucardo_ctl to be as quiet as possible. Default is off.
Shows a brief summary of usage for bucardo_ctl.
The following arguments are only used with the 'kick' command:
The number of times to retry a sync if it fails. Defaults to 0.
How long to sleep, in seconds, between each retry attempt.
By default, kicks with a timeout argument give a running real-time summary of time elapsed by using the backspace character. This may not be wanted if running a kick, for example, via a cronjob, so turning --notimer on will simply print the entire message without backspaces.
The following arguments are only used with the 'status' command:
Sets how many days backwards to search the old 'q' logs for information. Defaults to 3 days.
Specifies whether or not do list the time interval with days, or simply show the hours. For example, "3d 12h 6m 3s" vs. "48h 6m 3s"
Specifies whether or not to compress the time interval by removing spaces. Mostly used to limit the width of the 'status' display.
Requests sorting of the 'status' output by one of the nine columns. Use a negative number to reverse the sort order.
The following arguments are only applicable when using the "start" command:
Tells Bucardo whether or not to send mail on interesting events: startup, shutdown, and errors. Default is on. Only applicable when using ./bucardo_ctl start.
A short string that will be appended to the version string as output by the Bucardo process names. Mostly useful for debugging.
Forces creation of separate log files for each Bucardo process of the form "log.bucardo.X.Y", where X is the type of process (MCP, CTL, or KID), and Y is the process ID.
Sends all log messages to standard error. Off by default.
Sends all log messages to standard out. Off by default.
Sends all log messages to the syslog daemon. On by default. The facility used is controlled by the row "syslog_facility" in the bucardo_config table, and defaults to "LOG_LOCAL1".
If set, writes detailed debugging information to one or more files.
Directory where the debug files should go.
Appends the given string to the end of the default debug file name, "log.bucardo". A dot is added before the name as well, so a debugname of "rootdb" would produce a log file named "log.bucardo.rootdb".
Forces removal of all old debug files before running.
In addition to command-line configurations, you can put any options inside of a file. The file .bucardorc in the current directory will be used if found. If not found, then the file ~/.bucardorc will be used. The format of the file is option = value, one per line. Any line starting with a '#' will be skipped. Any values loaded from a .bucardorc file will be overwritten by command-line options.
The bucardo_ctl script uses $ENV{HOME} to look for a .bucardorc file.
The 'status' command does not yet return current information, and the start time in particular should be taken with a grain of salt.
Bug reports and feature requests are always welcome, please visit http://bucardo.org or email bucardo-general@bucardo.org.
Bucardo
Copyright 2006-2008 Greg Sabino Mullane <greg@endpoint.com>
This program is free to use, subject to the limitations in the LICENSE file.