How to Install and Use fswatch on centos-8

How to Install and Use fswatch on centos-8

Installation Process:

To check the installed version of os

[root@LinuxHelp ~]# cat /etc/centos-release
CentOS Linux release 8.0.1905 (Core) 

Use the below command to install dependencies

[root@LinuxHelp ~]# yum group install "Development Tools" -y
Last metadata expiration check: 0:17:34 ago on Friday 27 December 2019 08:06:49 PM EST.
Dependencies resolved.
========================================================================================================================
Package                                Arch          Version                                    Repository        Size
========================================================================================================================
Upgrading:
python3-rpm                            x86_64        4.14.2-11.el8_0                            BaseOS           147 k
rpm                                    x86_64        4.14.2-11.el8_0                            BaseOS           537 k
rpm-build-libs                         x86_64        4.14.2-11.el8_0                            BaseOS           150 k
…
…
Install  71 Packages
Upgrade   6 Packages
Total download size: 75 M
Downloading Packages:
(1/77): annobin-8.64-1.el8.x86_64.rpm                                                    58 kB/s | 187 kB     00:03    
(2/77): asciidoc-8.6.10-0.5.20180627gitf7c2274.el8.noarch.rpm                            51 kB/s | 216 kB     00:04    
(3/77): autoconf-2.69-27.el8.noarch.rpm                                                 114 kB/s | 710 kB     00:06    
(4/77): automake-1.16.1-6.el8.noarch.rpm                                                195 kB/s | 713 kB     00:03    
(5/77): byacc-1.9.20170709-4.el8.x86_64.rpm                                              91 kB/s |  91 kB     00:01    

(6/77): diffstat-1.61-7.el8.x86_64.rpm                                                   68 kB/s |  44 kB     00:00    
…
 systemtap-runtime-4.0-7.el8.x86_64                         xorg-x11-fonts-ISO8859-1-100dpi-7.5-19.el8.noarch         
 elfutils-0.174-6.el8.x86_64                                gettext-common-devel-0.19.8.1-14.el8.noarch               
 gettext-devel-0.19.8.1-14.el8.x86_64                       m4-1.4.18-7.el8.x86_64                                    
 mokutil-1:0.3.0-9.el8.x86_64                               patch-2.7.6-9.el8_0.x86_64                                
 sgml-common-0.6.3-50.el8.noarch                           

Complete!

Change directory

[root@LinuxHelp ~]# cd /mnt

Download fswatch package

[root@LinuxHelp mnt]# wget https://github.com/emcrisostomo/fswatch/releases/download/1.14.0/fswatch-1.14.0.tar.gz
--2019-12-27 20:29:46--  https://github.com/emcrisostomo/fswatch/releases/download/1.14.0/fswatch-1.14.0.tar.gz
Resolving github.com (github.com)... 13.234.210.38
…
…
HTTP request sent, awaiting response... 200 OK
Length: 832553 (813K) [application/octet-stream]
Saving to: ‘fswatch-1.14.0.tar.gz’
fswatch-1.14.0.tar.gz         100%[=================================================>] 813.04K   16KB/s    in 7.7s    
2019-12-27 20:29:58 (105 KB/s) - ‘fswatch-1.14.0.tar.gz’ saved [832553/832553]


Extract the Downloaded file

 [root@LinuxHelp mnt]# tar -xzf fswatch-1.14.0.tar.gz 

Long listing the current directory

[root@LinuxHelp mnt]# ls -la
total 820
drwxr-xr-x.  3 root root      57 Dec 27 20:30 .
dr-xr-xr-x. 17 root root     224 Dec 27 17:57 ..
drwxr-xr-x.  9  501 games   4096 Dec  4  2018 fswatch-1.14.0
-rw-r--r--.  1 root root  832553 Dec  4  2018 fswatch-1.14.0.tar.gz

Change directory to fswatch to configure

 [root@LinuxHelp mnt]# cd fswatch-1.14.0/

Run the Configuration file

[root@LinuxHelp fswatch-1.14.0]# ./configure
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking for fgrep... /usr/bin/grep -F
….
….
config.status: executing depfiles commands
config.status: executing libtool commands
config.status: executing po-directories commands
config.status: creating po/POTFILES
config.status: creating po/Makefile

Use the following command to build utility

[root@LinuxHelp fswatch-1.14.0]# make
make  all-recursive
make[1]: Entering directory '/mnt/fswatch-1.14.0'
Making all in libfswatch
make[2]: Entering directory '/mnt/fswatch-1.14.0/libfswatch'
Making all in src/libfswatch
make[3]: Entering directory '/mnt/fswatch-1.14.0/libfswatch/src/libfswatch'
 CXX      c/cevent.lo
 CXX      c/libfswatch.lo
 CXX      c/libfswatch_log.lo
 CXX      c++/libfswatch_exception.lo
 CXX      c++/event.lo
….
…
make[2]: Leaving directory '/mnt/fswatch-1.14.0'
make[1]: Leaving directory '/mnt/fswatch-1.14.0'

Install the Utility

[root@LinuxHelp fswatch-1.14.0]# make install
Making install in libfswatch
make[1]: Entering directory '/mnt/fswatch-1.14.0/libfswatch'
Making install in src/libfswatch
make[2]: Entering directory '/mnt/fswatch-1.14.0/libfswatch/src/libfswatch'
make[3]: Entering directory '/mnt/fswatch-1.14.0/libfswatch/src/libfswatch'
/usr/bin/mkdir -p '/usr/local/lib'
/bin/sh ../../../libtool   --mode=install /usr/bin/install -c   libfswatch.la '/usr/local/lib'
libtool: install: /usr/bin/install -c .libs/libfswatch.so.11.0.1 /usr/local/lib/libfswatch.so.11.0.1
….
…..
/usr/bin/mkdir -p '/usr/local/share/man/man7'
/usr/bin/install -c -m 644 man/fswatch.7 '/usr/local/share/man/man7'
make[2]: Leaving directory '/mnt/fswatch-1.14.0'
make[1]: Leaving directory '/mnt/fswatch-1.14.0'

After the installation, create the link for fswatch

[root@LinuxHelp fswatch-1.14.0]# ldconfig /usr/bin/
 [root@LinuxHelp fswatch-1.14.0]# ldconfig /usr/sbin/

With this, the method to install fswatch on centos-8 comes to end

Tag : Fswatch CentOS
FAQ
Q
What is the command to download fswatch?
A
The command to download fswatch
#wget https://github.com/emcrisostomo/fswatch/releases/download/1.14.0/fswatch-1.14.0.tar.gz
Q
What is the command to list the available monitors?
A
The command to list the available monitors
#fswatch -M
Q
What is the latest version of fswatch?
A
The latest version of fswatch is 1.14.0
Q
What is the command to monitor the specific directory?
A
The command to monitor the specific directory
#fswatch -d mention-directory
Q
What is fswatch?
A
fswatch monitors the directories and files and reports the changes that happened in the files and directories.