- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Dead soft links
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-27-2000 08:49 AM
тАО06-27-2000 08:49 AM
Dead soft links
I don't want to do it pen and paper way because it would defeat the purpose of having the computer. If a script has to be written, I can do it to as long as I know what I'm looking for... Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-27-2000 10:38 AM
тАО06-27-2000 10:38 AM
Re: Dead soft links
If you want to write a script, here are some thing to watch for:
Links can be associated with their target in one of three ways. It can point to an absolute path, a relative path (does not have to be in same directory, you see ../../
A find command will locate all links on a system with the -type l search criteria.
There are some situations where the link may point to something that is only valid when an NFS mount is active.
Be sure to test your script VERY carefully prior to removing any links! Run the output to a file you review first! And don't rely on the script test operators for regular files and directories alone! If the link points to something like a block device, the test would fail and you could end up removing a valid link that is otherwise allowing the machine to run!
There is a good chance that someone out there has already written a script to do what you are looking for. In cases like these I usually will look around the open source community for something that fits the bill. A good source for stuff like this is http://www.oase-shareware.org/shell/links (shelldorado).
My best advice is to just leave them alone for now. The amount of disk space and inode usage is usually not worth talking about. I know some may suggest this goes against the motherhood of keeping a clean system. But I guess a clean system is not much use if its dead.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-27-2000 10:48 AM
тАО06-27-2000 10:48 AM
Re: Dead soft links
A rather slow way of searching for all files with symbolic links would be using the ncheck command to check for the inode of a file. The ncheck is a very slow command though. You can restrict it to just one mounted file system though.
You can get the inode number for a file with the ls -li command, then run;
ncheck [/dev/vg00/lvol1] | grep the_inode_number
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-27-2000 11:55 AM
тАО06-27-2000 11:55 AM
Re: Dead soft links
do
if [ ! -a $FILE ]
then
echo $LINK is a dead link
fi
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-27-2000 12:01 PM
тАО06-27-2000 12:01 PM
Re: Dead soft links
Another happy customer was out there.. :-)
Thanks again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-28-2000 05:01 AM
тАО06-28-2000 05:01 AM
Re: Dead soft links
O.K. I can only imagine what "-a" test stands for. I was looking for it in my books and documentation but could not find anything that would confirm what I think it.
So, what "-a" stands for in this particular context??
if [ ! -a $FILE ]
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-28-2000 05:23 AM
тАО06-28-2000 05:23 AM
Re: Dead soft links
-a file true if file exists
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-28-2000 08:12 AM
тАО06-28-2000 08:12 AM
Re: Dead soft links
-e or -f. I gues, I have to commit to my memory one more test paramter... :-)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-28-2000 08:22 AM
тАО06-28-2000 08:22 AM
Re: Dead soft links
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-07-2000 06:17 AM
тАО07-07-2000 06:17 AM
Re: Dead soft links
find ./ -type l -exec file {} ;
the file command will fail on any non-existant link files and should get you started. The list of errors could then be used for arguments into rm .