- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- simple cron job
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
05-30-2002 07:40 AM
05-30-2002 07:40 AM
Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2002 07:44 AM
05-30-2002 07:44 AM
Re: simple cron job
Use find with -size c (for characters). See man find.
HTH,
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2002 07:45 AM
05-30-2002 07:45 AM
Re: simple cron job
cd
ll|awk '{print $5" "$9}'|while read
do
read A B
[ $A -eq 411 ] && echo $B
done
The reason its done this way is to pump only the size and filenames into the while loop and if the size = 411 then remove the file ($B). Its very safe.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2002 07:45 AM
05-30-2002 07:45 AM
Re: simple cron job
Login as root and give
# crontab -e
Then it will open a file and there you can type
30 21 * * * /usr/bin/rm
save the file an exit
Then your cron job will be activated at 21:30 daily
Piyush
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2002 07:45 AM
05-30-2002 07:45 AM
Re: simple cron job
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2002 07:46 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2002 07:48 AM
05-30-2002 07:48 AM
Re: simple cron job
# cd dir
# find . -type f -size 411c -print (for testing)
# find . -type f -size 411c -exec rm {} \; ( for delete these files)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2002 07:54 AM
05-30-2002 07:54 AM
Re: simple cron job
#! /usr/bin/ksh
DIR=/tmp/apps
find $DIR -type f -size 411c -exec rm {} \;
And put this script in your cron (say 2pm everyday), assuming you're using root to run the cron ..
# crontab -e
==> add this line ..
00 14 * * * /bin/myscript
# crontab -l
==> check it ..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2002 07:57 AM
05-30-2002 07:57 AM
Re: simple cron job
Share and Enjoy! Ian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2002 08:06 AM
05-30-2002 08:06 AM
Re: simple cron job
I like Ian's idea about disabling the receipts. Or perhaps writing them to a directory that is not used for anything else.
Barring those choices, the find is a good option. I would add the -name option (-name "wildcarded_name_here") presuming the file names have something unique to identify them. Is there something command in all the file names?
Darrell
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2002 08:56 AM
05-30-2002 08:56 AM
Re: simple cron job
I simply did not know how to add file size tothe rm command.
The fax receipts have to go somewhere, and they do get looked at sometimes. Just wanted to remove them at the end of the day, to keep from filling a file folder, and also to not have to wade through them when looking for other stuff.
THanks for all the help.