The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Crontab question blondie2407 HP-UX 12 09-16-2009 01:53 PM
CRONTAB Question pauls_579 UNIX for Dummies Questions & Answers 2 01-23-2007 05:46 PM
Crontab question ctcuser Shell Programming and Scripting 3 10-19-2006 09:22 AM
crontab question steelrose UNIX for Dummies Questions & Answers 5 10-05-2005 12:07 AM
crontab question Relykk UNIX for Dummies Questions & Answers 7 03-28-2004 08:02 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-13-2007
NycUnxer NycUnxer is offline
Registered User
  
 

Join Date: Sep 2007
Location: AIX-VILLE
Posts: 88
Crontab Question.

I set up a job to run a script in a certain directory to remove certain files. The script seems to run as my logs indicate but nothing happens. If I run the script manually then it removes the correct files. I'm now wondering if crontab doesnt have access to remove files from the directory I'm pointing to? Any advise would be greatly appreciated.
  #2 (permalink)  
Old 11-13-2007
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,119
as always.... look into the FAQs first!
  #3 (permalink)  
Old 11-13-2007
NycUnxer NycUnxer is offline
Registered User
  
 

Join Date: Sep 2007
Location: AIX-VILLE
Posts: 88
Did you read my question? The crontab faq did not answer it. I wasnt referring to cron running permissions.
  #4 (permalink)  
Old 11-13-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
Quote:
Originally Posted by NycUnxer View Post
The crontab faq did not answer it.
99% of problems with crontab are that is executes with a minimal environment and does not execute your .login, .profile or whatever.

Put in a wrapper script that captures the stdout and stderr, and use "#!/bin/sh -x" as the first line in your script to debug it.
  #5 (permalink)  
Old 11-13-2007
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,119
Quote:
Originally Posted by NycUnxer View Post
Did you read my question? The crontab faq did not answer it. I wasnt referring to cron running permissions.
Yes, I did. I don't believe I said anything about 'running permissions'.
As porter has pointed the answer to 'why it works from CLI and not from crontab' usually has to do with the environment of the crontab. That's what the FAQ explains in great details.
If you do read the FAQ (once again) it might help you to troubleshoot the issue.
  #6 (permalink)  
Old 11-13-2007
NycUnxer NycUnxer is offline
Registered User
  
 

Join Date: Sep 2007
Location: AIX-VILLE
Posts: 88
Quote:
Originally Posted by porter View Post
99% of problems with crontab are that is executes with a minimal environment and does not execute your .login, .profile or whatever.

Put in a wrapper script that captures the stdout and stderr, and use "#!/bin/sh -x" as the first line in your script to debug it.
Actually I'm using the script you helped me with, which is basically

Code:
find .  \( -size 100c -o -size 145c -o -size 170c \) -a -name "*testing*"  | xargs -n 1 rm
So from what you're saying, its not retaining what its finding? Is there a way to make this work in cron for a certain directory?
  #7 (permalink)  
Old 11-13-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
Quote:
Originally Posted by NycUnxer View Post
So from what you're saying, its not retaining what its finding? Is there a way to make this work in cron for a certain directory?
I suggest you post the whole script.

So there should be a "#!/bin/sh" at the start, and also, change the current directory to what you want to start with.
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not 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 Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:01 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0