
# OSMT命令帮助信息
- 执行**osmt -h** 命令，显示OSMT的帮助信息。
  ```
  [root@localhost SOURCES]# osmt -h
  usage: osmt [-h] {update,rollback,remove,config,job} ...
  positional arguments:
    {update,rollback,remove,config,job}
      update              update packages
      rollback            rollback last upgrade
      remove              remove backup files in store path
      config              modify config file by command line
      job                 handle upgrade task.
  options:
    -h, --help            show this help message and exit
  ```
  表1osmt参数说明 
  | 参数         | 说明                      |
  |:---|:---|
  | update     | 升级操作系统或RPM包。            |
  | rollback   | 回退操作系统或RPM包。            |
  | remove     | 删除存储路径中的备份文件。           |
  | config     | 查询或修改配置文件。              |
  | job        | 查询或管理升级任务。              |
  | -h, --help | 可选参数，提供**osmt**命令的帮助信息。 |
     
  

- 执行**osmt update -h** 命令，显示升级操作系统或RPM包的帮助信息。
  ```
  [root@localhost SOURCES]# osmt update -h
  usage: osmt update [-h] [--nosignature] [-s] [--all] [--security] [--version] [-a] [-p  PKGS [PKGS ...]] [-e  EXCLUDE_PKGS [EXCLUDE_PKGS ...]] [-v  RELEASEVER] [-r  REBOOT_CONFIG]
                     [-b BETWEEN] [-j] [-c]
  optional arguments:
    -h, --help            show this help message and exit
    --nosignature         ignore the signature of packages
    -s , --show           show updateinfo
    --all                 show all pkgs which can update, 'osmt update --show --all'
    --security            show security pkgs which can update
    --version             show all version can update to
    -a , --auto           auto update use config file
    -p  PKGS [PKGS ...], --pkgs PKGS [PKGS ...]
                          specify the packages to upgrade
    -e  EXCLUDE_PKGS [EXCLUDE_PKGS ...], --exclude_pkgs EXCLUDE_PKGS [EXCLUDE_PKGS ...]
                          specify the packages not to upgrade
    -v  RELEASEVER, --releasever RELEASEVER
                          specify the release version to upgrade
    -r  REBOOT_CONFIG, --reboot_config REBOOT_CONFIG
                          you can choose between always, never or a specific time. 'always': reboot os after update ends if need. 'never': never reboot os automatically. '<specific time>':
                          reboot at specified time, format like "2020-02-02 2:02:02".
    -b BETWEEN, --between BETWEEN
                          start upgrade time and end upgrade time, format like: '2020-02-02 2:02:02','2020-02-02 4:02:02'
    -j , --job            run upgrade in background.
    -c, --check           check upgrade task.
    -V, --verbose         show more log to screen
    -o, --preinstalled-only
                          upgrade preinstalled packages only
    -t, --retry           retry previous upgrade action
    --nocheck             do not check before upgrade
    -f, --fix             auto fix some system problems checked out
    --upgrade_history     query upgrade/rollback records
  ```
  表2osmt update主要参数说明 
  | 参数                      | 说明                                                                                                                                                                                                                                                                                                                                                                                                                                       |
  |:---|:---|
  | -h, --help              | 提供**osmt update**命令的帮助信息。                                                                                                                                                                                                                                                                                                                                                                                                                |
  | --nosignature           | 升级时不根据包的签名筛选待更新的RPM包。                                                                                                                                                                                                                                                                                                                                                                                                                    |
  | -s,--show               | 显示当前系统可用的升级或更新信息。 - --all：显示所有待更新的RPM包。  - --security：显示待更新的安全包。  - --version：显示所更新到的版本号。                                                                                                |
  | -a,--auto               | [指定更新RPM包更新方式](https://support.huaweicloud.com/usermanual-hce/hce_02_0039.html#hce_02_0039__zh-cn_topic_0000001343415668_li1188118193910)，与-v、-p、-e互斥。                                                                                                                                                                                                                                                                                   |
  | -p,--pkgs               | 指定需要更新的RPM包白名单列表，与-v、-a互斥。                                                                                                                                                                                                                                                                                                                                                                                                               |
  | -e,--exclude_pkgs       | 指定不需要更新的RPM包黑名单列表，与-v、-a互斥。                                                                                                                                                                                                                                                                                                                                                                                                              |
  | -v , --releasever       | 指定需要升级到的HCE版本号。                                                                                                                                                                                                                                                                                                                                                                                                                          |
  | -r, --reboot_config     | 指定重启方式。 - always：更新结束后，若有重启才能生效的RPM包，则立即自动重启；若没有，则不重启。  - never ：更新结束后，不重启。  - \<specific time\>：指定重启时间。更新结束后，若有重启才能生效的RPM包，则在指定时间自动重启；若没有，则不重启。时间格式如 "2020-02-02 2:02:02"。   |
  | -b, --between           | 指定osmt执行更新的开始时间和结束时间，格式为"HH:MM-HH:MM"。 如果截止时间小于开始时间，则表示本次升级时间段跨越自然日。如"22:00-05:00"表示升级时间段为当日22:00到次日凌晨5:00。                                                                                                                                                                                                                                                                   |
  | -j, --job               | 以后台进程方式进行本次升级。                                                                                                                                                                                                                                                                                                                                                                                                                           |
  | -c, --check             | 升级前检查系统状态，确认系统是否能升级。该检查操作是可选的，在实际升级时会再次执行升级前检查。 建议在升级命令增加-c参数，对升级命令进行检查。例如，执行**osmt update -a** 进行升级前，执行**osmt update -a -c**检查系统状态。                                                                                                                                                                                                                                                                       |
  | -V, --verbose           | 可选参数，显示详细的升级信息。                                                                                                                                                                                                                                                                                                                                                                                                                          |
  | -o, --preinstalled-only | 可选参数，仅升级/etc/osmt/preinstalled.list中的RPM包列表，该选项仅对版本升级有效。                                                                                                                                                                                                                                                                                                                                                                                 |
  | -t, --retry             | 可选参数，进行升级重试。                                                                                                                                                                                                                                                                                                                                                                                                                             |
  | --nocheck               | 可选参数，升级前不做任何检查，直接进入升级流程。                                                                                                                                                                                                                                                                                                                                                                                                                 |
  | -f, --fix               | 可选参数，版本升级流程中自动修复部分环境检查的问题。                                                                                                                                                                                                                                                                                                                                                                                                               |
  | --upgrade_history       | 可选参数，查询升级/回退记录                                                                                                                                                                                                                                                                                                                                                                                                                           |
     
  

- 执行**osmt rollback -h** 命令，显示回退操作系统或RPM包的帮助信息。
  ```
  usage: osmt rollback [-h] [-r  {never,always}] [-V] [-t] [--nocheck]
  optional arguments:
    -h, --help            show this help message and exit
    -r  {never,always}, --reboot_config {never,always}
                          whether to reboot after rollback
    -V, --verbose         show more log to screen
    -t, --retry           retry previous upgrade action
    --nocheck             do not check before rollback
    --check_status        check rollback status
  ```
  表3osmt rollback参数说明 
  | 参数                  | 说明                                         |
  |:---|:---|
  | -h, --help          | 提供**osmt rollback**命令的帮助信息。                |
  | -r, --reboot_config | 指定是否允许重启。                                  |
  | -V, --verbose       | 可选参数，显示详细的过程日志。                            |
  | -t, --retry         | 可选参数，进行回退重试。                               |
  | --nocheck           | 可选参数，回退前不进行任何检查，直接进入回退阶段。                  |
  | --check_status      | 可选参数，检查回退状态，如果退出码为0，表示回退正常。如果退出码为1，表示回退异常。 |
     
  
- 执行**osmt config -h** 命令，显示修改配置项或显示配置项的帮助信息。
  ```
  usage: osmt config [-h] [-k KEY] [-v VALUE] [-V]
  optional arguments:
    -h, --help            show this help message and exit
    -k KEY, --key KEY     key of config item
    -v VALUE, --value VALUE
                          value of config item
    -V, --verbose         show more log to screen
  ```
  表4osmt config参数说明 
  | 参数            | 说明                            |
  |:---|:---|
  | -h, --help    | 提供**osmt** **config**命令的帮助信息。 |
  | -k, --key     | 指定要查询或修改的key值。                |
  | -v, --value   | 指定对应修改key值的value值。            |
  | -V, --verbose | 可选参数，显示详细的过程日志。               |
     
  ![](https://support.huaweicloud.com/usermanual-hce/public_sys-resources/note_3.0-zh-cn.png)
  建议只通过**osmt config**命令来修改配置文件，使用其他方式修改配置文件，可能导致OSMT功能异常。
  
- 指定**osmt job -h** 命令，显示任务管理的帮助信息。
  ```
  usage: osmt job [-h] [-s] [-c] [-d DELAY] [-y]
  optional arguments:
    -h, --help            show this help message and exit
    -s, --show            show task info.
    -c, --cancel          cancel current task.
    -d DELAY, --delay DELAY
                          delay task
    -y, --yes             never ask for yes.
    -V, --verbose         show more log to screen
  ```
  表5osmt job参数说明 
  | 参数            | 说明                                                 |
  |:---|:---|
  | -h, --help    | 提供**osmt** **job**命令的帮助信息。                         |
  | -s, --show    | 显示后台任务信息。                                          |
  | -d, --delay   | 允许将当前等待重启的任务延迟一段时间，具体格式为"1:50:00"，表示将重启时间推迟1小时50分。 |
  | -c, --cancel  | 取消当前job。                                           |
  | -y, --yes     | 默认用户同意本次操作。                                        |
  | -V, --verbose | 可选参数，显示详细的过程日志。                                    |
     
  
 
