| Author |
shell script not running as cron
|
Abhinav Srivastava
Ranch Hand
Joined: Nov 19, 2002
Posts: 345
|
|
i have one shellscript which does some work and i am trying to invoke another script from within it. something like this - when I run this myself, works like a charm. When it is run by the cron seems like script.ksh is not being invoked properly. Have also tried running it directly instead of using period still no luck. any clues?
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24045
|
|
|
"./script.ksh" means "the file in the current directory named script.ksh". When you run your script from cron, the current directory is generally going to be your home directory, so unless script.ksh is there, this isn't going to work. There are many ways to deal with this; one simple one would just be to use an absolute path (i.e., like "/home/Srivastava/bin/script.ksh").
|
[Jess in Action][AskingGoodQuestions]
|
 |
Abhinav Srivastava
Ranch Hand
Joined: Nov 19, 2002
Posts: 345
|
|
thanks. why did i think it would be relative to the parent script!
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24045
|
|
Originally posted by Abhinav Srivastava: thanks. why did i think it would be relative to the parent script!
I think Windows works that way... sometimes.
|
 |
Stefan Wagner
Ranch Hand
Joined: Jun 02, 2003
Posts: 1923
|
|
Originally posted by Ernest Friedman-Hill: I think Windows works that way... sometimes.
I don't think so. While working on a script, and testing it: ./foo.sh - the location of the script often IS the PWD. That may lead to wrong assumptions.
|
http://home.arcor.de/hirnstrom/bewerbung
|
 |
 |
|
|
subject: shell script not running as cron
|
|
|