First of all, install symlinks if it is not installed :
sudo yum install symlinks
and here is the description:
Description : The symlinks utility performs maintenance on symbolic links.
: Symlinks checks for symlink problems, including dangling symlinks
: which point to nonexistent files. Symlinks can also automatically
: convert absolute symlinks to relative symlinks.
: Install the symlinks package if you need a program for maintaining
: symlinks on your system.
and the help for the same:
symlinks: scan/change symbolic links – v1.3 – by Mark Lord
Usage: symlinks [-cdorstv] dirlist
Flags: -c == change absolute/messy links to relative
-d == delete dangling links
-o == warn about links across file systems
-r == recurse into subdirs
-s == shorten lengthy links (displayed in output only when -c not specified)
-t == show what would be done by -c
-v == verbose (show all symlinks)
So, if you want to delete all the invalid symlinks in the current directory the just execute:
I am testing some of my scripts to work on a very old system and there the versions of the most popular applications are very old, real old :(. So, some of things that I am very used to since last couple of years, do not seem to work as expected and I need to keep verifying a lot of things on the server, very inconvinient to keep testing the script on the server (need to connect on VPN) just to test some very simple things.
But if I want to test it on my local desktop or laptop then I need to donwgrade all the applications on my system. Other option is changing the scripts or the paths to get the lower version to work. I found the third option which I liked best and gives me a very controlled environment – chroot.
So, what do we need to achieve this. Here are the steps
Create a empty directory
Create the minimum required directories under this directory
Copy the required libs for the commands that you would like to have in the chroot
This will have a output like this:
linux-gate.so.1 => (0x00e77000)
libselinux.so.1 => /lib/libselinux.so.1 (0x46bf1000)
librt.so.1 => /lib/librt.so.1 (0x46bba000)
libcap.so.2 => /lib/libcap.so.2 (0x46020000)
libacl.so.1 => /lib/libacl.so.1 (0x47fb3000)
libc.so.6 => /lib/libc.so.6 (0x46a09000)
libdl.so.2 => /lib/libdl.so.2 (0x46bb3000)
libpthread.so.0 => /lib/libpthread.so.0 (0x46b97000)
libattr.so.1 => /lib/libattr.so.1 (0x46960000)
Here you would need to copy all the files mentioned after the => sign in the output to your lib directory for the chrooted environment. Also make sure that if the above are links then you copy the actual files also to ensure that you have the actual libs for the commands to work.
Copy the actual command to the chroot environment.
Copy the command with cp command to the bin directory of your chroot environment.
Once all this is done, you can simply chroot to this directory with the command
Voila, you are done.
Check that you have all the utils/commands that you have copied and nothing less/nothing more.
inotify utility is an effective tool to monitor and notify filesystem changes. You can specify a list of files and directories that needs to be monitored by inotify. This library is used by various other programs. For example, CPAN module Linux::Inotify is developed based on this library.
iNotify Execution Flow
On a high-level, you do the following with inotify utility.