Last year with help from Rextended (that you sir), the original script was modified so that instead of writing the results to the log, it wrote the results to a couple global variables and passed that to a second script that wrote the results to a file. I did it that way so I could reuse the Write To File script for several similar ping scripts. That also has been working. Then every few hours a third script would send the file via an E-Mail and then reset the log file to 0 bytes. That also has been working fine.
Now I'm trying to add a couple line header to the log file after it is reset to 0 bytes. The easiest way to get the data for that was from a couple of the variables in the original Ping Test script. OK, successfully changed the couple variables from local to global variables and the Ping Test scrip and the Write To File script are working perfectly. The Write to File script does not use the newly created global variables, but the Send the E-Mail script will need them.
The problem is that the E-Mail script is not getting the data from the global variable. As a test, I defined the global variable in the Write To File script and added a log entry of that variable. The correct data was put into the log - so I know the Ping Test script was properly creating the variable as a global. Added the same log entry to the E-Mail script, and it is blank. All three scripts have the same owner and the same permissions - read, write, & test. Here are a couple extracts of the three scripts.
Here the Ping Test script defines the global variables and sets data into them
Code: Select all
# Set the monitored IP address and name for test 1
:global ArednIP1 "10.57.166.43";
:global ArednIP1n "W6BI-Shack-Node";
This is the Write To File script where it defines the global variable and write the data in the variable to the log. This works perfectly. What shows up in the log is: 10.57.166.43 - WF script
Note that this was added only for a test, as this script does not need to use the ArednIP1 variable
Code: Select all
:global ArednIP1;
:log info "$ArednIP1 - WF script"
This is the E-Mail script where it defines the global variable and write the data in the variable to the log. This fails. What shows up in the log is: - Mail script
Code: Select all
:global ArednIP1;
:log info "$ArednIP1 - Mail script"
So why does one work and the other not?