- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- (Un) wanted scripts
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
Forums
Discussions
Discussions
Discussions
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
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
09-21-2001 08:59 AM
09-21-2001 08:59 AM
(Un) wanted scripts
In my environment here we use hundreds of scripts in different boxes. Most of them run by maestro schedular and some of them via cron jobs. I'm on cleaning up the system but want to know what scripts are really being used now. There are many unwanted files/scripts and I want to take them out. And most these scripts created 4-5 years back! These are mix of Ksh, perl, c.
My question is there any way I can check which are the scripts really being used now..?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2001 09:08 AM
09-21-2001 09:08 AM
Re: (Un) wanted scripts
If you assume that nothing or no one accesses the files unless it is to actually run them, then you could examine the last access timestamp:
# find /directory -xdev -atime +365 -exec ls -l {} \;
In this example, a 'ls -l' of files in "/directory" *not* accessed in the last 365 days would be returned.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2001 09:14 AM
09-21-2001 09:14 AM
Re: (Un) wanted scripts
Aah cleanup, its a dirty job but somebody's got to do it ;-). I don't know if there is a simple solution to this one.
There could be situations that some of these scripts are not being within other scripts, so you will have to be careful when removing some of these. How many scripts are we talking about here, 10,20, 100?
The other thing which seemed to have worked for me in the past is, check if any of the scripts are run in cron, or if any other scripts are running these, if not move them to a temp directory. Someone would be complaining if they are using them and don't find it, but i would suggest talking to your users if there is any possibility that they will be using them. Wait for a certain period and delete them if no one complains but do take backups before you delete them.
Are only the sysadmins using these scripts or the users are using them too?
-Good Luck
Ramesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2001 09:17 AM
09-21-2001 09:17 AM
Re: (Un) wanted scripts
...and if my suggestion above meets your criteria, you could:
# find /directory -xdev -type f -atime +365 -exec rm {} \;
...to *remove* files in "/directory" that haven't been accessed in 365-days or more.
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2001 09:57 AM
09-21-2001 09:57 AM
Re: (Un) wanted scripts
Doing the find as shown above shows you if the file was accessed within the however many days (in the case above 365 days).
-Santosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2001 10:14 AM
09-21-2001 10:14 AM
Re: (Un) wanted scripts
Ofcourse James has a better solution ;)
but one word of caution when you do a find with atime option it modifies the access time of the subdirectories, so you are okay for the files, but just wanted to inform you.
-Regards
Ramesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2001 10:39 AM
09-21-2001 10:39 AM
Re: (Un) wanted scripts
Thanks for your valuable tips. As I told you these scripts are very old but being used. I guess when these scripts being executed by maestro(schedular) or therwise it doesn't not change the timestamp of the script. These scripts are used mainly by the users.
There are more than 500 scripts in one production server.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2001 10:47 AM
09-21-2001 10:47 AM
Re: (Un) wanted scripts
One trick you might try is to put a few lines of code at the beginning of each of the scripts that writes the script name and a date/time stamp to a log file so that you will have a record of when each script gets called. You could run that way for a few weeks and maybe get an idea of which scripts are actually being called. Then, instead of just 'rm'ing the scripts, you could leave a stub script in place that also records if that script got called.
JP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2001 11:16 AM
09-21-2001 11:16 AM
Re: (Un) wanted scripts
This may sound like a dumb question, and if so, I apologize, but can you just check out the scheduler (maestro) to see what is being run? you can crontab -l to see the scripts called directly (although scripts called within a script is a different matter...). Also, how much space are we talking here. You may have hundreds of scripts, but if each one is tiny, it may be cluttered but it might be best just to leave well enough alone. Just a thought.
Mark