- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- shell script
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
07-03-2003 09:15 PM
07-03-2003 09:15 PM
I find that in one of my server /var/spool/cron/tmp is growing very fast and sometime new files are created and which grows too.
Pls. note sometime new files are generated in /var/spool/cron/tmp.
I am looking for a shell script which will read all the files under /var/spool/cron/tmp and trim them to 0KB.
I want to schedule this script to run once a day.
Thanks and pts in advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2003 09:29 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2003 09:30 PM
07-03-2003 09:30 PM
Re: shell script
#!/usr/bin/sh
for fn_name in /var/spool/cron/tmp
do
> /var/spool/cron/tmp/$fn_name
done
The make a cron to run this script:
#chmod 755 cutcron.sh
#crontab -e
0 0 * * 0-6 /cutcron.sh
Is this really you need?
-ux
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2003 09:30 PM
07-03-2003 09:30 PM
Re: shell script
This is not exact because my HP box isn't built yet.
find /var/spool/cron/tmp +msize ### -exec rm {} \;
That is the basic structure. You may want to make a list for later removal instead of zapping the files straight away.
Also, I forget right now whether msize is in kilobytes or what, so play around a bit.
This is a good way to go though.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2003 09:31 PM
07-03-2003 09:31 PM
Re: shell script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2003 09:37 PM
07-03-2003 09:37 PM
Re: shell script
do
> $file
done
HTH
- ramd.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2003 09:42 PM
07-03-2003 09:42 PM
Re: shell script
http://www.introcomp.co.uk/examples/logrotate.html
You will need to make some modifications.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2003 09:57 PM
07-03-2003 09:57 PM
Re: shell script
you got a lot of replys how to trim your tempfiles. But i think it would be better to check why these files are created. It should be possible to find a configuration where these files are not created in the first place.
check your crontabs. I think the "problem" could be that you don't redirect your STDERR to a file or /dev/null.
Do something like this:
1 23 * * 1-5 yourscript 2> /dev/null
Hope this helps
Regards Stefan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2003 10:01 PM
07-03-2003 10:01 PM
Re: shell script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2003 10:46 PM
07-03-2003 10:46 PM
Re: shell script
for file in /var/spool/cron/tmp/*
do
> /var/spool/cron/tmp/${file}
done
will truncate all files in /var/spool/cron/tmp
Caesar