Swatch can be used to monitor system records and perform specified actions when a specific event is detected. The events monitored by swatch and the actions of the corresponding events are stored in the swatch configuration file. The default configuration file is. swatchrc under the root directory. However, in Red Hat Linux, the default root directory does not exist. in the swatchrc configuration file, you can set/usr/doc/swatch-2.2/config_files/swatchrc. copy the personal file to. swatchrc, and then modify. the event to be monitored and the action to be executed by swatchrc.
Syntax
Swatch [-A <delimiter>] [-c <setting File>] [-f <Record File>] [-I <delimiter>] [-P <delimiter>]
[-R <time>] [-t <Record File>]
Parameter description:
- -A <delimiter> specifies the delimiter of an action in the preset configuration file. The delimiter is A comma.
- -C <Configuration File> specifies the configuration file, instead of the preset configuration file.
- -F <Record File> checks the specified record file. After the check, it does not continue to monitor the record file.
- -I <delimiter> specifies the delimiter of the input record. It is a newline character by default.
- -P <delimiter> specifies the delimiter of the event in the configuration file. The default delimiter is comma.
- -R <time> restarts at the specified time.
- -T <Record File> checks the specified record file and monitors the subsequent records added to the record file.
Instance
Enable system monitoring
# Swatch