Linux swatch Command
The Linux swatch command is used for system monitoring.
swatch can be used to monitor system log files and execute specified actions when particular events are detected. The events monitored by swatch and their corresponding actions are stored in swatch's configuration file. The default configuration file is .swatchrc in the user's home directory. However, in Red Hat Linux there is no .swatchrc configuration file in the default user home directory. You can copy the /usr/doc/swatch-2.2/config_files/swatchrc.personal file to .swatchrc in your home directory, then modify .swatchrc to specify the events to monitor and the actions to execute.
Syntax
swatch [-A <分隔字符>][-c <设置文件>][-f <记录文件>][-I <分隔字符>][-P <分隔字符>][-r <时间>][-t <记录文件>]
Parameter Description:
- -A
The action separator in the default configuration file; defaults to a comma. - -c
Specify a configuration file instead of using the default one. - -f
Check the specified log file; after checking, monitoring of that log file will not continue. - -I
Specify the separator for input records; defaults to a newline character. - -P
Specify the separator for events in the configuration file; defaults to a comma. - -r
- -t
Check the specified log file and also monitor subsequent records added to it.
Example
Enable system monitoring
# swatch
Linux Command Reference