Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Feb 21st, 2007, 2:33 PM   #1
mima
Newbie
 
Join Date: Feb 2007
Posts: 3
Rep Power: 0 mima is on a distinguished road
why isnt this working, from crontab?

Hello

I'm a newbie of bash programming and need some help with this.
The problem is that it workes if I run it from the shell but if I run it from crontab it doesnt then I get "command not found" when calling on an extern program even if the path to the extern program is defined in $HOME/.bash_profile


I have 2 bash files
1) a. bash where the logic is
2) b.bash where common functions are stored

in a.bash I include b.bash by doing

#!/bin/bash
#
# Description:
. /<dest_to_file>/b.bash


from a.bash I then call on some functions that are stored in b.bash...
lets now say I have called on a function that are stored in b.bash and from b.bash I call on an extern program "program_a" then I get error output "command not found" even if the path to "program_a" is defined in $HOME/.bash_profile. This occurs when I run the program from crontab but not when I run it manually from shell. (The cronjob is runned by same user as from shell)

I would really apprechiate if anyone could help me to explain why its not working?


/Regards /MiMa
mima is offline   Reply With Quote
Old Feb 21st, 2007, 2:59 PM   #2
Serinth
Programmer
 
Serinth's Avatar
 
Join Date: Sep 2005
Posts: 50
Rep Power: 4 Serinth is on a distinguished road
So let me get this straight, you want to call b.bash from a.bash but it's giving you an error in path. I think the problem is that you used ./path/b.bash. I believe you can exclude the .
__________________
A girl talked to me once.

http://www.latestanime.com
Serinth is offline   Reply With Quote
Old Feb 21st, 2007, 3:06 PM   #3
mima
Newbie
 
Join Date: Feb 2007
Posts: 3
Rep Power: 0 mima is on a distinguished road
Quote:
Originally Posted by Serinth View Post
So let me get this straight, you want to call b.bash from a.bash but it's giving you an error in path. I think the problem is that you used ./path/b.bash. I believe you can exclude the .
Hello

No b.bash is included in a.bash, from b.bash I call on an extern program "program_a" that gives me the error "program_a" command not found.
The path to "program_a" is in $HOME/.bash_profile

If I want to include a bashprogram into another one dont I do as:

---in a.bash -------
#!/bin/bash
#
. /b.bash


-------------------

I really dont know whats wrong because as I sayd it works when I run a.bash from shell but its not working when it is included in crontab.

Best regards /MiMa
mima is offline   Reply With Quote
Old Feb 21st, 2007, 3:29 PM   #4
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
Perhaps if you posted the actual offending line, along with the absolute locations of each file?
Arevos is offline   Reply With Quote
Old Feb 21st, 2007, 4:56 PM   #5
mima
Newbie
 
Join Date: Feb 2007
Posts: 3
Rep Power: 0 mima is on a distinguished road
I seems to have solved the problem

the crontab has not the same environ set as I have from the shell

By including them in my script by doing

. $HOME/.bash_profile

it solved the problem

Regards/MiMa
mima is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Progwin 32 is not working Edgar C 9 Sep 7th, 2006 5:20 PM
working example badbasser98 C++ 16 Mar 31st, 2006 9:29 AM
Reading and writing files not working under Windows (find under unix/linux) .TD Java 2 Mar 30th, 2006 12:42 PM
working with xml and c# and get this error dark_omen C# 4 May 6th, 2005 6:55 AM
JSP not working on the live server Braveheart Java 0 Mar 9th, 2005 8:20 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 10:37 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC