The UNIX and Linux Forums  

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
AIX and cron logs filtering ?: /etc/cronlog.conf, /var/adm/cron/log Keith Johnson AIX 0 01-09-2008 05:32 PM
Script doesn't work, but commands inside work cheongww UNIX for Dummies Questions & Answers 2 11-14-2006 07:52 PM
Command doesn't work under cron ? bigjohn-nj Shell Programming and Scripting 4 01-20-2006 01: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 06:28 AM

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

Join Date: Jan 2004
Posts: 2
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  
Old 01-14-2004
flim flam flamma jamma
 

Join Date: May 2001
Location: Chicago IL, USA
Posts: 1,006
dont edit your crontab file w/ a windows editor.

remove the ^M at the end of your crontab entrie.
  #3  
Old 01-14-2004
oombera's Avatar
Registered User
 

Join Date: Aug 2002
Location: Cleveland, OH
Posts: 804
Just as an update to Optimus_P's post, I found this old thread:

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

Join Date: Nov 2003
Location: seattle
Posts: 8
^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  
Old 01-20-2004
Registered User
 

Join Date: Jan 2004
Posts: 2
^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 The UNIX and Linux Forums
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 09:04 AM.


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

Content Relevant URLs by vBSEO 3.2.0