Redhat Linux WTF moment, need cron help! - DFWstangs Forums
 
LinkBack Thread Tools Display Modes
post #1 of 3 (permalink) Old 02-09-2010, 02:44 PM Thread Starter
Custom Title
 
Join Date: Apr 2002
Location: Hades who?
Posts: 16,521
Angry Redhat Linux WTF moment, need cron help!

I am trying to set up a fucken simple cron job for root to find/delete files older than 60 days, but no matter what the hell I do, it does not work! Sometiems I get mail, sometimes I do not, so I added the MAIL="root" line


[[email protected]]# crontab -l
MAIL="root"
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /root/cron/aTOz.sh 2>&1 >> /root/cron/logs/delete_old_files.log
58 10 * * * /root/cron/1TOzero.sh 2>&1 > /root/cron/logs/delete_old_number_files.log
27 * * * * /usr/bin/find /files -name "[a-Z]*" -type f -mtime +60 -exec rm -f {} \; > /root/cron/logs/rob.log 2>&1


here is the aTOz.sh script:
[[email protected] cron]# more aTOz.sh
#!/bin/sh
set -x
date
/usr/bin/find /files -name "[a-Z]*" -type f -mtime +60 -print
/usr/bin/find /files -name "[a-Z]*" -type f -mtime +60|wc -l
#/usr/bin/find /files -name "[a-Z]*" -type f -mtime +60 -exec rm -f {} \;


I do not want to delete any files the begin with a dot, hence the [a-Z]*

here is all my log shows:
Tue Feb 9 1401 CST 2010
0
Tue Feb 9 1401 CST 2010
0
Tue Feb 9 14:20:01 CST 2010
0
Tue Feb 9 14:25:01 CST 2010
0
Tue Feb 9 14:30:01 CST 2010
0
Tue Feb 9 1401 CST 2010
0

The log should show 58 files exist, but it is always 0

What the hell is the deal??? Anyone have a simpel example I can just use? Damn, this is driving me fucken NUTZ! Any help will be greatly appreciated!

They've done studies you know.... 60% of the time, it works every time



Yellowstang is offline  
Sponsored Links
Advertisement
 
post #2 of 3 (permalink) Old 02-09-2010, 05:30 PM
Professional Driver
 
Join Date: Mar 2006
Location: Closed Course
Posts: 6,665
Wish I could help. Just wanted to say I LOLd at the smilies in place of your #'s in your command lines.
71chevellejohn is offline  
post #3 of 3 (permalink) Old 02-09-2010, 05:44 PM Thread Starter
Custom Title
 
Join Date: Apr 2002
Location: Hades who?
Posts: 16,521
LOL, I know, it does that shit all the time!

I am getting close, it is the stupid -name option making it not work

I need a way to limit it to files that begin with a letter a-z or A-Z and a number so I do NOT delete anything starting with a dot (like .profile, etc.)

They've done studies you know.... 60% of the time, it works every time



Yellowstang is offline  
Sponsored Links
Advertisement
 
Reply

Bookmarks

Quick Reply
Message:
Options

Register Now



In order to be able to post messages on the DFWstangs Forums forums, you must first register.
Please enter your desired user name, your email address and other required details in the form below.

User Name:
Password
Please enter a password for your user account. Note that passwords are case-sensitive.

Password:


Confirm Password:
Email Address
Please enter a valid email address for yourself.

Email Address:
OR

Log-in










Thread Tools
Show Printable Version Show Printable Version
Email this Page Email this Page
Display Modes
Linear Mode Linear Mode



Posting Rules  
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On

 
For the best viewing experience please update your browser to Google Chrome