Linux swatch command

Linux 命令大全Linux Command Encyclopedia

The Linux swatch command is used for system monitoring programs.

swatch can be used to monitor system log files and execute specified actions when specific events are detected. The events monitored by swatch and the actions corresponding to those events are stored in the swatch configuration file. The default configuration file is .swatchrc in the user's home directory. However, in Red Hat Linux's default user home directory there is no .swatchrc configuration file. You can copy the /usr/doc/swatch-2.2/config_files/swatchrc.personal file to .swatchrc in the user's home directory, and then modify the events to be monitored and the actions to be executed in .swatchrc.

Syntax

swatch [-A <分隔字符>][-c <设置文件>][-f <记录文件>][-I <分隔字符>][-P <分隔字符>][-r <时间>][-t <记录文件>]

Parameter Description:

  • -A<separator character> The separator character for actions in the default configuration file; the default is a comma.
  • -c<configuration file> Specifies a configuration file instead of using the default configuration file.
  • -f<log file> Checks the specified log file; after the check is complete, it will not continue to monitor this log file.
  • -I<separator character> Specifies the separator character for input records; the default is a newline character.
  • -P<separator character> Specifies the separator character for events in the configuration file; the default is a comma.
  • -r<time> Restarts at the specified time.
  • -t<log file> Checks the specified log file and monitors subsequent records added to the log file.

Examples

Start system monitoring

# swatch

Linux 命令大全Linux Command Encyclopedia

Other Extensions