The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM
Home Forums Register Rules & FAQ Members List Arcade Search Today's Posts Mark Forums Read


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 !!


Other UNIX.COM Threads You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
AIX and cron logs filtering ?: /etc/cronlog.conf, /var/adm/cron/log Keith Johnson AIX 0 01-09-2008 04:32 PM
Script doesn't work, but commands inside work cheongww UNIX for Dummies Questions & Answers 2 11-14-2006 06:52 PM
Command doesn't work under cron ? bigjohn-nj Shell Programming and Scripting 4 01-20-2006 12:38 PM
script didn;t work in cron !!! @_@ stancwong Shell Programming and Scripting 2 10-04-2005 06:25 AM
ncopy doesn't work from cron Selma UNIX for Dummies Questions & Answers 2 01-20-2005 05:28 AM

Closed Thread
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-14-2004
Registered User
 

Join Date: Jan 2004
Posts: 2
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
Simple cron job won't work

I have a script in a directory -say users/me/test/
It looks like this:
# "bkup" - copies specified files to the user's ~/Backup
# directory after checking for name conflicts.
a=$(date +%T)
cp $1 ~/test/Backup/$1.$a
It copies file.txt from current directory and timestamps the name of it of it.
No problem there. bkup runs ok

I have a cron job that looks like this:
54 18 * * * /`users/me/test/bkup
I do crontab cron.txt and get no error
I set it up to run in the next few minutes. When the appointed time comes, instead of getting a new file copied, i get a mail from the Unix saying

Your "cron" job on thebox
/users/calcdev/coregan/pocbatch/bkup

produced the following output:

sh: /users/me/test/bkup^M: not found
What incredibly simple thing am I doing wrong? Do I have permissions to run the job. Seems like it can't find the script to run it.
Forum Sponsor
  #2 (permalink)  
Old 01-14-2004
flim flam flamma jamma
 

Join Date: May 2001
Location: Chicago IL, USA
Posts: 1,006
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
dont edit your crontab file w/ a windows editor.

remove the ^M at the end of your crontab entrie.
  #3 (permalink)  
Old 01-14-2004
oombera's Avatar
Have a day :|
 

Join Date: Aug 2002
Location: Cleveland, OH
Posts: 804
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
Just as an update to Optimus_P's post, I found this old thread:

What is wrong with this code?
  #4 (permalink)  
Old 01-19-2004
Registered User
 

Join Date: Nov 2003
Location: seattle
Posts: 8
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
^M chars should be the cause.
You can remove them by opening the file in vi editor and using the foll command in the command mode:

%s/ctrl-v ctrl-m//g
(finally, it should show :%s/^M//g)
  #5 (permalink)  
Old 01-20-2004
Registered User
 

Join Date: Jan 2004
Posts: 2
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
^M was the carriage return as described previously thanks to everyone.
I was editing it in UltraEdit because I can never get to grips with vi editor - I know that's blasphemy! - but UltraEdit is so much easier to use. Apart from when there are carriage returns in there of course!
Google UNIX.COM
Closed Thread



Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB 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 -7. The time now is 09:55 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger

Search Engine Optimization by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102