Linux swatch Command
The Linux swatch command is used for system monitoring.
swatch can be used to monitor system log files and perform specified actions when certain events occur. The events and corresponding actions to be monitored by swatch are stored in the swatch configuration file. The default configuration file is located in the user's home directory as .swatchrc. However, under the default user home directory of Red Hat Linux, there is no .swatchrc configuration file. You can copy the /usr/doc/swatch-2.2/config_files/swatchrc.personal file to the user's home directory as .swatchrc, and then modify the .swatchrc file to specify the events to be monitored and the actions to be taken.
Syntax
swatch [-A <delimiter>][-c <config file>][-f <log file>][-I <delimiter>][-P <delimiter>][-r <time>][-t <log file>]
Parameter Description:
-A <delimiter> The delimiter for actions in the default configuration file, default is a comma.
-c <config file> Specifies a configuration file instead of the default one.
-f <log file> Checks the specified log file, and will not continue to monitor the log file after checking.
-I <delimiter> Specifies the delimiter for input logs, default is a newline character.
-P <delimiter> Specifies the delimiter for events in the configuration file, default is a comma.
-r <time> Restarts at the specified time.
-t <log file> Checks the specified log file and will monitor subsequent entries added to the log file.
Example
Start system monitoring
# swatch