On Fri, Aug 15, 2003, Tzahi Fadida wrote about "Script refresh":
> Hi all,
> I am trying to understand why when i run an sh script that calls another script, for 
> example perl,
> when i change one of the subscripts or some configuration file the changes don't 
> show on the running
> sub script (that is recalled every 15 minutes so it should refresh).
> is there a refresh command in sh?

I'm not sure what exactly you're doing, so it's hard to answer. So I'll
give you a few ideas of what might be happening.

What is a "configuration file"? If you're taking about stuff like ~/.bashrc
containing definitions of environment variables, well, sure this file doesn't
get reread every time. This sort of file only gets read once when you logged
in (or started an interactive shell, or something else, depending on your
shell and the exact configuration file) and then the environment variables
get "exported" from shell to shell. If you want to reread this file every
15 minutes, you'll need to do so explicitly with the dot (or "source")
command ". ~/.bashrc".

Abouut the scripts: if your shell command is doing something like

        while :
        do
                perl something.pl
                sleep 900
        done

(which runs something.pl every 15 minutes) then "something.pl" is read
every 15 minutes, and there is no need to tell anything to "reread" or
"refresh" that file, as it is done automatically. Obviously, if the
shell script itself (the one running the above loop) changes, the shell
won't notice it an nothing will change because the shell read the code
for this loop once when it started. If you must change the code of this
loop on the fly, you can do something like:

        #!/bin/sh
        perl something.pl
        sleep 900
        exec $0

(the last line runs the currently-running script again, but stepping over
the current process instead of running a new process).

-- 
Nadav Har'El                        |        Saturday, Aug 16 2003, 18 Av 5763
[EMAIL PROTECTED]             |-----------------------------------------
Phone: +972-53-245868, ICQ 13349191 |"A mathematician is a device for turning
http://nadav.harel.org.il           |coffee into theorems" -- P. Erdos

=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to