running a program from shell script
Hey guys,
I have been trying to write a shell script which is able to run a little programm. ping -c 2 192.168.1.51 if [$? !=0] ; then wol --host=192.168.1.1 90:50:A1:EF:D0:53 echo "Starting up Host" fi Thats what I got so far. What I want to do is that the script pings one of my computers in my network. Whenever it fails I want the script to start the program "wol" which starts up the remote computer by the wake on lan function. I am a noob in shell programming so it is a minor error most probably. I guess the line wol --host=192.168.1.1 90:50:A1:EF:D0:53 has to be different. It is the whole command which has to be executed. Thx Suinatsa |
You do not need to post your question twice but you need to tell us what the problem is !
|
Hey,
I am sorry for double posting. My firefox had some trouble sending my post! The problem is that whenever I execute the script it says line 4 command not found. Line 4 is wol --host=192.168.1.1 90:50:A1:EF:D0:53 Thx Suinatsa |
Is this bash scripting ?
Isn't the real error message: "wol: command not found" Assuming int, the "wol" command is either missing or not in the path. |
Hey
yeah it is a bash script. And you are right it cannot find the command. I just want to know how I write a sript that can execute a program. When I type "wol" in the command line it executes the programm "wol". Do I have to specify the path of the programm or what? Thx Suinatsa |
Quote:
where/what is wol ? (type wol) Quote:
|
Hey
ok wol is a program which uses the (w)ake (o)n (l)an function. Whenever you execute the program with some parameters it starts up a computer in a network. What I want to do is that whenever I execute the script one computer in my network starts up. I never specified anything for $path so it does not show me anything if I do echo $path. Thats why I asekd if I have to do it! Thx Suinatsa |
Quote:
run both of the following shell commands, and post their output: Code:
echo $PATH Quote:
Quote:
|
Hey
I am sorry but I am a noob in shell coding! Ok I ran the commands: /usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/games:/opt/www/htdig/bin:/usr/lib/java/bin:/usr/lib/java/jre/bin:/opt/kde/bin:/usr/lib/qt/bin:/usr/share/texmf/bin wol is /usr/local/bin/wol Thats the output. Thx Suinatsa |
Are you running your script directly from the bash command prompt, or do you have it setup to run from something like a cron script. Usually the PATH variable that is set when running a cron script is different from a user's bash prompt. Explicitly specifying the path to wol might help. (e.g. /usr/local/bin/wol)
|
Can you post the whole script code too ?
Or add "echo $PATH" before the "wol" command is attempted and see if /usr/local/bin is there. |
All times are GMT -5. The time now is 10:30 AM. |