the scripts listed below are used to sync the time of the main pbx and the pbx in remote offices. all of the meridian switch are connected to the IP network. the script runs on a win2k pc that is time sync to the internet time source (ntp).
time sync is done using Script #1. it is an expect script. expect runs on a number of popular OS including Linux, Unix, BSD, and Windows(thru cygwin). add an entry in cron to run the scrip daily. the script can be run from the command line e.g.
#expect pbxtimesync.xpt pbx_ip_address pbx_password
for win2k, you may want to use a vbscript wrapper (script #2) to do extra functions. cygwin rlogin may not end properly so a function in vbscript is included to kill rlogin processes. note that you need to download cygwin to get rlogin and expect (
*************************************************
* Script #2 (vbscript wrapper)
* this script was slapped together by jetb
*************************************************
Dim WshShell, oExec
Set WshShell = CreateObject("WScript.Shell"
Set fso = CreateObject("Scripting.FileSystemObject"
mypbx="MeridianPBX"
'mypbx can be hostname or IP address
pbxpassword="secretpassword"
call setpbxtime(mypbx, pbxpassword)
'if you have more pbx to time sync, you can make
'another call to setpbxtime
'Wait for the end of process
Do While oExec.Status = 0
WScript.Sleep 100
Loop
'Scan and display the output of Exec
Do While oExec.Stdout.AtEndofStream <> True
pgm_out=oExec.StdOut.ReadLine
pos_match=Instr(1, pgm_out, ".stad", 0)
match_count = match_count + pos_match
Loop
if match_count > 0 then
EmailMsg=targetpbx & ": Time Sync OK"
EmailTxt="Time Sync successful. Please see attached file for session snapshot."
else
EmailMsg=targetpbx & ": Time Sync Error"
EmailTxt="Time Sync Failed. Please see attached file for session snapshot."
end if
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.