![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Cron issue | kingdbag | SUN Solaris | 5 | 07-10-2008 08:14 AM |
| Another Cron issue. | Beefy | UNIX for Dummies Questions & Answers | 2 | 03-13-2008 10:30 AM |
| FTP Cron Issue | edua | Shell Programming and Scripting | 7 | 11-27-2007 12:30 AM |
| Issue with cron job -Please help | bsandeep_80 | Shell Programming and Scripting | 6 | 07-27-2007 11:20 AM |
| Issue with cron job | nattynatty | Shell Programming and Scripting | 1 | 11-21-2005 04:37 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
cron issue
user x has a cron job that looks in a dir and moves teh files from 1 name to another except its not working correctly.
Code:
. /user/.profile # sorce the users profile for file in `ls`; do mv $file $file.`date +%Y%m%d%H%M%S``microsec` done /usr/local/bin IS in the users path && from a shell prompt as that user i can run microsec and it will display the microseconds. when i run the script by hand everything works. but when it runs via cron the file will get the date but not the microsec. any hints? |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Hint 1: user X does not have /usr/local/bin in their PATH
|
|
#3
|
|||
|
|||
|
maybe
When you load the .profile can be handy top point to the users homne directory by using ~<username>/.profile
in this case u are sure the right profile is loaded when a script is NOT working in the cron BUT it does by hand, the problem is mostly a envirnment problem. so use instead . /user/.profile # sorce the users profile ~x/.profile Where X is the username |
|
#4
|
||||
|
||||
|
Why not just use the full path to microsec in the cronjob?
That way, you don't have to worry about pathing for the individual user and if the cronjob is ever moved to another user, you are still good to go. And if another admin has to work with this cronjob, the placement of microsec is obvious.
__________________
Not quite as cool as all the other Kids... |
|
#5
|
|||
|
|||
|
you know what really makes me mad. when people over write a profile on an account they are NOT supposed to use.
i guess its my error for not double checking the PATH. ;/ its working liek it should now (after i fixed the path) |
|
#6
|
||||
|
||||
|
/agree Auswipe full path is always best
I must reluctantly agree with Auswipe.
It is a good practice and good security to ALWAYS use the full path in any cron entry and in the scripts that you write. The reason for this is, it is a very easy way for someone to replace any binary on your system with a trojan. Always use full path AND always keep a backup copy of crontab for all users that have one especially cron.
__________________
My brain is your brain |
||||
| Google The UNIX and Linux Forums |