|
|
| ZCS Administrator's Guide, Network Edition 4.0 |
Appendix A Command-Line UtilitiesCommand Line Interface (CLI) can be used to create, modify and delete certain features and functions of the Zimbra Collaboration Suite. The administration console is the main tool for maintaining the Zimbra Collaboration Suite, but some functions can only be changed from the CLI utility.*In general, provisioning and managing accounts should be performed from the administration console, but bulk provisioning can be done from the CLIGeneral Tool Information
• CLI commands are run as the zimbra user, that is su - zimbra.
• Press ENTER after you type a command.
• Typing the CLI command and then - h displays the usage options for the command. Example: zmprov - h lists all the options available for the zmprov utility.
• Each operation is invoked through command-line options. Many have a long name and a short name. For example, these two commands are equivalent:When demonstrating the syntax of each tool, the following conventions indicate required, optional, and alternate values:
• {attribute} in curly brackets is required information.
• [attribute] in square brackets are optional arguments or information.
•
• The command-line tools available for administrators are all located in the
/opt/zimbra/bin directory on the Zimbra serverThe zmprov tool performs all provisioning tasks in Zimbra LDAP, including creating accounts, aliases, domains, distribution lists, and calendar resources. Each operation is invoked through command-line options, each of which has a long name and a short name.The syntax for modify can include the prefix "+” or "-” so that you can make changes to the attributes affected and do not need to reenter attributes that are not changing. Use + to add a new instance of the specified attribute name without changing any existing attributes. Use - to remove a particular instance of an attribute. The syntax is zmprov [cmd] [argument].The following example would add the attribute zimbraZimletUserProperties with the value "testing” to user 1 and would not change the value of any other instances of that attribute.
Long Name {host}[:{port}] server hostname and optional port --account {name} --passfile {file} use zimbra admin name/password from localconfig for admin/password verbose mode (dumps full exception stack trace) debug mode (dumps SOAP messages)The commands in the following table are divided into the following tasks types - Account, Calendar Resources, Config, COS, Distribution List, Documents, Domain, Server, and Miscellaneous.
Short Name Syntax:{name@domain} {password} [attribute1 value1 etc]zmprov ca joe@domain.com test123 displayName JSmith {name@domain|id|adminName} [attribute1 value1 etc]zmprov ma joe@domain.com zimbraAccountStatus maintenance {name@domain|id|adminName} {password} {name@domain|id|adminName} {alias@domain}zmprov aaa joe@domain.com joe.smith@engr.domain.com {name@domain|id|adminName} {alias@domain}zmprov raa joe@domain.com joe.smith@engr.domain.com {name@domain|id|adminName} {cos-name|cos-id} [-v] {ldap-query} [limit] [offset] [sortBy {attribute} Note: After you rename an account, you should run a full backup for that account. zmbackup -f - <servername.com> -a <newaccountname@servername.com> {name@domain} [attr1 value1 [attr2 value2...]] {name@domain|id} [attr1 value1 {attr2 value2...]] zmprov cc Executive zimbraAttachmentsBlocked FALSE zimbraAuthTokenLifetime 60m zimbraMailQuota 100M zimbraMailMessageLifetime 0 zmprov mc Executive zimbraAttachmentsBlocked TRUE zmprov ms domain.com zimbraVirusDefinitionsUpdateFrequency 2h zmprov adlm needlepoint-list@domain.com singer23@mail.free.net zmprov rdlm needlepoint-list@domain.com singer23@mail.free.net Get DistributionListmembership {list@domain|id} attr1 value1 {attr2 value2...} {username} {password} {from dir}{to folder} Before importing files, any file that will become a Documents page (wiki-style page), must be renamed to include the extension ".wiki”. If not it is imported as a file, accessed either as an attachment or an image. in globalwiki@company.com test123 /opt/zimbra/wiki/template template {username}{password} {domain} {directory} {folder} Creates the domain Documents accountidn domainwiki@company.com test123 zimbra.com /opt/zimbra/wiki/template template Generates a pre-authentication key to enable a trusted third party to authenticate to allow for single-sign on. Used in conjunction with GenerateDomainPreAuth. {domain|id} {name} {name|id|foreignPrincipal} {timestamp|0} {expires|0}
• Create one account with a password that is assigned to a specified COS. You must know the COS ID number. To find a COS ID, type gc <COSname>.zmprov ca name@domain.com password zimbraCOS cosIDnumberstring
• Using a batch process to create accounts, see Managing the Zimbra Collaboration Suite chapter for the procedure.
• Add a member to a distribution list. Tip: You can add multiple members to a list from the administration console.
• Change the administrator’s password. Use this command to change any password. Enter the address of the password to be changed.Then type zmloggerctl start, to start the logger.
• Modify zimbraNewMailNotification to customize the notification email template. A default email is sent from Postmaster notifying users that they have received mail in another mailbox. To change the template, you modify the receiving mailbox account. The variables areYou can specify which of the above variables appear in the Subject, From, or Body of the email. The following example is changing the appearance of the message in the body of the notification email that is received at name@domain.com. You can also change the template in a class of service, use zmprov mc. The command is written on one line.zmprov ma name@domain.com zimbraNewMailNotificationBody ‘Important message from ${SENDER_ADDRESS}.${NEWLINE}Subject:${SUBJECT}’This tool performs full backups and incremental backups for a designated mail host. You can either specify specific accounts, or, if no accounts are specified, all accounts are included.This utility has short option names and full names. The short option is preceded by a single dash, the full option is proceeded by a double dash. For example, -fb is the same as --fullBackup.
Short Name --incrementalBackup Specifies the account email addresses. Separate accounts with a blank space. Enter all to backup all accounts. Required. <label|date> Deletes the backup session on or prior to the specified label/date. --incrementalBackup <arg> Mail server host name. For format, use either the plain host name or the server.domain.com name. The default is the localhost name. <arg> Specifies the target backup location. The default is <zimbra_home>/backup. Displays the usage options for this command.In these examples, the server (-s) is server1.domain.com. The (-t) is not required if the target is the default directory, (zimbra_home/backup).
•
• Perform incremental backup of all mailboxes on server1 since last full backup.
• Perform full backup of only user1’s mailbox on server1. Note that hostname does not need full domain if account is used.zmbackup -f -s server1 -a user1@domain.com
• Each crontab entry is a single line composed of five fields separated by a blank space. Specify the fields as follows:minute 0 through 59hour 0 through 23day of month 1 through 31month 1 through 12day of week 0 through 7 (0 or 7 is Sunday)
Command Name Default command, displays the existing Zimbra backup schedule. Save the schedule. Allows you to save the schedule command to a text file so that you can quickly regenerate the backup schedule when the system is restored. Removes the current schedule and cancels all scheduled backups. Adds an additional specified backup to the current schedule. Replaces the current schedule with the specified schedule. Replaces the current schedule with the default schedule. -h Displays the usage options for this command.
• To display the schedules on one line as a command, so that they can be copied to a text file and saved to be used if the application needs to be restored.The zmbackupabort command can be used to stop a backup process. Before you can abort an account you must know backup label. This label is displayed after you start the backup procedure. If you do not know the label, use the zmbackupquery to find the label name.To stop the restore process. The zmbackupabort -r interrupts an on going restore. The restore process is stopped after the current account is restored. The command displays message showing which accounts were not restored.
Short Name Label of the full backup to be aborted. Use the zmbackupquery, to find the file name. Specifies the account email addresses. Separate accounts with a blank space. If accounts are omitted, all accounts are backed up. Mail server host name. For format, use either the plain host name or the server.domain.com name. The default is the localhost name. Specifies the target backup location. The default is <zimbra_home>/backup. Displays the usage options for this command.The zmbackupquery command is used to find full backup sets. The command can be used to find a specific full backup set, full backup sets since a specific date, or all backup sets in the backup directory.
Short Name -a Account email addresses separated by white space or all for all accounts. The label of the full backup session to query. An example of a label is backup200507121559510. If a date is used, the query returns a list of full backup sets since the specified date. Enter date as YYYY/MM/DD hh:mm:ss. The hours, minutes, and seconds are not required. Mail server host name. For format, use either the plain host name or the server.domain.com name. The default is the localhost name. Specifies the backup target location. The default is <zimbra_home>/backup. Displays the usage options for this command.This tool performs full restores and incremental restores for a designated mail host. You can either specify specific accounts, or, if no accounts are specified, all accounts are in the backup are restored. In addition, you can restore to a specific point in time.This utility has short option names and full names. The short option is preceded by a single dash, the full option is proceeded by a double dash. For example, -rb is the same as --restorefullBackupOnly.
Short Name The label of the full backup to restore. Restores to the latest full backup if this is omitted. --restorefullBackup Only Restores to the full backup only, not any incremental backups since that backup. Restores the account in directory service. -restoreToIncreLabel <arg> Replay redo logs up to and including this incremental backup -restoreToRedoSeq <arg> Replay up to and including this redo log sequence <prefix> The prefix to pre-pend to the original account names. Restores global tables and local config. Restores accounts to new target accounts whose names are pre-pended with <prefix>. --backedupRedolog Only Replays the redo logs in backup only, which excludes archived and current redo logs of the system. Continue to restore other accounts when an error occurs. Specifies the account email addresses. Separate accounts with a blank space or Type all to restore all accounts. Mail server host name. For format, use either the plain host name or the server.domain.com name. The default is the localhost name. --skipDeletedAccounts Do not restore if named accounts were deleted or did not exist at backup time. (This option is always enabled with "-a all”) Specifies the backup target location. The default is <zimbra_home>/backup. Displays the usage options for this command.
• Perform complete restore of all accounts on server1, including last full backup and any incremental backups since last full backup.
• Perform restore only to last full backup, excluding incremental backups since then, for all accounts on server1.zmbackup -rf -acct all -s server1.domain.comThis tool is run when the Zimbra server (i.e., the Tomcat process) is down. The MySQL database for the server and the OpenLDAP directory server must be running before you start the zmrestoreoffline command.
Short Name The label of the full backup to restore. Type this label to specify a backup file other then the latest. Restores to the full backup only, not any incremental backups since that backup. Restores the account in directory service. <prefix> The prefix to pre-pend to the original account names. Restores accounts to new target accounts whose names are pre-pended with <prefix>. <arg> Specifies the account email addresses. Separate accounts with a blank space or state all for restoring all accounts. Required. --backedupRedolog Only Replays the redo logs in backup only, which excludes archived and current redo logs of the system. Continue to restore other accounts when an error occurs. Restores global tables and local config. Mail server host name. For format, use either the plain host name or the server.domain.com name. The default is the localhost name. If -s is specified, this must be localhost. Specifies the backup target location. The default is <zimbra_home>/backup. Displays the usage options for this command.
• Perform a complete restore of all accounts on server1, including last full backup and any incremental backups since last full backup.zmrestoreoffline -s server1.domain.com
Short Name Session label to restore from. For example, full200612291821113. Specifies the backup target location. The default is /opt/zimbra/backup. Restores named account(s). List account names separated by white space.This command is run to start or to stop services. You can also find which version of the Zimbra Collaboration Suite is installed.
Short Name Displays the usage options for this command. Shutdown all services and manager on this host. When the manager is shutdown, you cannot query that status. Startup manager and all services on this host. Startup manger and all services on this host. Returns services information for the named host. Stop all services but leave the manager running.This command is used to move a mailbox from one Zimbra server to another. Mailboxes can be moved between Zimbra servers that share the same LDAP server. All the files are copied to the new server and LDAP is updated. After the mailbox is moved to a new server, a copy still remains on the older server, but the status of old mailbox is closed. Users cannot log on and mail is not delivered. You should check to see that all the mailbox contents were moved successfully before purging the old mailbox.
Short Name Displays the usage options for this command. Purge old mailbox on previous server. After a mailbox has been successfully moved to a new server, perform purgeOld to remove the mailbox and its contents from the previous server. Mail server hostname. The default is the localhost. Server where the --account mailbox is located. -t and -po options are mutually exclusive. Use -t option to move a mailbox from the current server to the new server specified by the option. If -ow is specified, if a mailbox already exists for the target server, it is overwritten. After successfully moving the mailbox, use
-po option to purge the old mailbox on the original server.zmmboxsearch is the CLI command used to search across mailboxes. You can search across mailboxes to find messages and attachments that match specific criteria and save copies of these messages to a directory.
Short Name <arg> Directory to write the messages to. If none is specified, then only the headers are fetched. Files names are generated in the form RESULTNUM_ACCOUNT-ID_ MAILITEMID. Sets the limit for the number of results returned. The default is 25. <arg> Comma-separated list of mailboxes to search. UIDs or email-address or /SERVER/MAILBOXID or *. <arg> Specify where the hit list should start. The default is 0. <arg> The query string for the search. <arg> Mail server hostname. default is the localhost. Request that the status message print while the search is being executed.The following example is to do a cross-mailbox search in the inbox folder of two different mailboxes on the specified server and put a copy of the message in to the specified directory.The CLI command zmcreateca creates the signing certificate and zmcreatecert creates a new self-signed certificate. After a certificate is created, zmcertinstall is the CLI command to install it.Example of steps to use to stop tomcat, delete a certificate that is not working and then create a new certificate and install it.
1.
2. Type su - zimbra, then type the following all on one linekeytool -delete -alias my_ca -keystore /opt/zimbra/java/jre/lib/security/cacerts -storepass changeit
4.
5.
6.
7.
8.
Short Name The default values for the keys listedin [args} is listed. Edit the configuration file, change keys and values specified. The [args] is in the key=value form. Edit the keys whose change is known to be potentially dangerous. Shows the help for the usage options for this tool. Shows the documentation for the keys listed in [args]. Shows the values in one of these formats: plain (default), xml, shell, nokey. Shows the values for only those keys listed in the [args] that have been changed from their defaults. This option is used with the edit option. Specified key is set to a random password string. Forces the display of the password strings. Removes the local setting for a variable, which causes it to fallback to the default. This command is used to set the Web server mode to the communication protocol options: HTTP, HTTPS, or mixed. Mixed mode uses HTTPS for logging in and HTTP for normal session traffic. All modes use SSL encryption for back-end administrative traffic.Note: If you switch to https, you use the self-signed certificate generated during Zimbra installation, in /opt/zimbra/ssl/ssl/server/server.crt.
1.
2.
3. This command is to start, stop (abort), and see the status of a HSM session. The threshold for when messages are moved to a storage volume is configured from the administration console, Servers>Volume tab.
Short Name Aborts the current HSM session.If all the messages in a mailbox being processed were not moved before you clicked Abort, no messages from that mailbox are moved from the primary volume. Messages for mailboxes that have completed the move to the secondary volume are not moved back to the primary volume. Shows the help for the usage options for this tool. The mail server host name. The default is the localhost [args]. The status of the last HSM session is displayed.The zmmailbox tool is used for mailbox management. The command can help administrators provision new mailboxes along with accounts, debug issues with a mailbox, and help with migrations.
Long Name http[s]://{host}[:{port}] server hostname and optional port. Must use admin port with -z/-a --account {name} use zimbra admin name/password from localconfig for admin/password --passfile {file} verbose mode (dumps full exception stack trace) debug mode (dumps SOAP messages)Specific CLI tools are available for the different components of a mailbox. Usage is described in the CLI help for the following
help on contact-related commands (address book) help on conversation-related commands
• When you create an account, you may want to pre-create some tags and folders. You can invoke zmmailbox inside of zmprov by using "selectMailbox(sm)”
This command is used to view and install your Zimbra license. The license can be viewed and installed from the administration console, Global Settings, License tab.
Short Name Check to see if a valid license is installed. Shows the help for the usage options for this tool. Installs the specified license file.[arg] This is the Zimbra license file that you received. This command is used to trace an email message that was sent or received with the last 30 days.
Short Name Shows the help for the usage options for this tool. From Times in YYYYMMDD (hhmmss) format. start, end times in YYYYMMDD[hhmmss] formatThis command is used to change the zimbra_logger_myql_password. If the --root option is specified, the MySql_logger_root_passwd is changed. In both cases, MySQL is updated with the new passwords. Refer to the MySQL documentation to see how you can start the MySQL server temporarily to skip grant tables, to override the root password.This command is used to change zimbra_myql_password. If the --root option is specified, the mysql_root_passwd is changed. In both cases, MySQL is updated with the new passwords. Refer to the MySQL documentation to see how you can start the MySQL server temporarily to skip grant tables, to override the root password.This command is used to train the anti-spam filter. This command is run automatically every night to train the SpamAssasin filter from messages users mark as "junk” "not junk” from their mailbox. See "Anti-Spam Training Filters” .You can use this command to manually send one account’s mail through the spam filter. You will need to know the account password.zmtrainsa fetches the mail from <user> with password <pass> from <server> and trains the filter as either spam or ham <spam|ham>. The folder is optional. If a folder is not defined, the contents of the Inbox is fetched.This command can be used to manage storage volumes from the CLI. Volumes can be easily managed from the administration console, Server, Volume tab.
Long Name Second Attribute Short Name Type of volume, primaryMessage, secondaryMessage, or index. SecondaryMessage is used only when the Network Edition, HSM feature is enabled. File system root path of the volume --compress <arg> Compress blobs, "true” or "false”. The default is "false.”
True means that message blobs whose size are above the compression threshold are compressed. Compression threshold size is specified in bytes. The default is 4KB Edits a volume. Any of the options listed under --add can also be specified to have its volume modified. ID is optional. If it is specified, just that volume is listed. If not, all volumes are displayed. Sets the volume specified by --id to be the current volume of its volume type. --turnOffSecondary Turns off the current secondary message volume. After this command completes, no current secondary volume is enabled.
Short Name deploy <zimletname> Creates the Zimlet entry in the LDAP server, installs the zimlet files on the Server, grants, access to the members of the default COS, and turns on the Zimlet Shows the status of all the Zimlets on the server Extracts the configuration template from the Zimlet.zip file Shows the current Zimlet priorities (0 is high, 9 is low)
|
|
| ZCS Administrator's Guide, Network Edition 4.0 |