Does the acuthin "ping", (acuthin -p [servername]) support a silent mode?
Basically to run the command and return the data that is normally displayed in the display message box without the popup.
#Acuthin
#ping
Write a program using the "C$PING" library routine. I believe there is a sample program that shows how to use it.
From the documentation...
call "C$PING" using server-to-ping, server-time [, client-data].
where:
server-to-ping is a PIC X(64) data item that should be filled in by the COBOL program before calling C$PING. This is the server that will be pinged.
server-time is a pic 9(8) data item that is filled in by C$PING and that designates the time the server got and returned the request. Note that if this is a group item, the time is left-justified instead of right-justified (as is done via a COBOL MOVE statement). For this reason, a PIC 9(8) elementary data item is highly recommended.
client-data is a PIC X(n) data item that is passed verbatim to the server. The server displays this data in the trace file (if tracing is enabled) and returns it verbatim to the client. The result is that the data in this data item is unchanged, even though it came from the server. This argument is optional.
When the library routine finishes, it sets the external variable return-code to the status of the ping, as follows (these values are defined in acucobol.def.):
78 CPING-OK VALUE 0. 78 CPING-NO-CLIENT VALUE 1. 78 CPING-PARAM-ERROR VALUE 2. 78 CPING-CONN-REFUSED VALUE 3. 78 CPING-VERSION-ERROR VALUE 4. 78 CPING-SOCKET-ERROR VALUE 5.
|
CPING-OK |
everything worked, and time-at-server has a valid time from the server |
|
CPING-NO-CLIENT |
this runtime is not AcuServer-enabled |
|
CPING-PARAM-ERROR |
the COBOL program passed an invalid parameter |
|
CPING-CONN-REFUSED |
the server refused the connection, possibly because it is not running or is running on a different port than the one for which the client is configured |
|
CPING-VERSION-ERROR |
the version of the server is not compatible with this version of the runtime |
|
CPING-SOCKET-ERROR |
some unknown socket error occurred |
If the server has tracing enabled, the ping request is logged in the trace file.
We use a combination of things to verify that AcuConnect is responding to connection attempts. We use monit on an external server which works by opening a telnet session to the port acurcl is running on.
Also, I have a shell script running via cron every 10 minutes as well. The combo of these generally notifies of issues before we get notified. I am going to paste a version of our script below. Use it if you wish. You may need to adjust pathing and such. acurcl -info does hang when it stops accepting new connections, but it does return a result eventually. This script uses that fact. The -info output comes out on stderr as well...
#!/bin/sh
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# acurclmon.sh
#
# This script will check on the acuconnect
# process to ensure that it is still up and
# accepting connections emailing someone if it
# is not responding
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#~ CONFIG ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
MAILTO="someaddress@example.com"
MAILCC=
TMP=/tmp/acurclproc
#~ END CONFIG ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Interesting that the -info switch dumps its info
# to stderr and not stdout...
/usr/local/acurcl -info > $TMP 2>&1
# All that we need is the last line. Snag it and
# put it in the file
strLine=$(tail -n 1 $TMP)
print $strLine > $TMP
OUTFILE=
PID=
BADDIE="n"
# extract the PID of the host acurcl process
PID=$(cat $TMP | sed '/^.*PID: / s///g' | sed '/\\,.*/ s///')
TSTR=$(print $PID | sed 's/[0-9]//g')
# If we get something other than a process id, the server process may have
# stopped responding. The output if it has stopped is usually like
# Socket error (10020). $TSTR will be non-empty if this is the case.
if [ "$TSTR" != "" ]; then
BADDIE="y"
fi
if [ $BADDIE == "y" ]; then
OUTFILE=$(date)" - The acurcl process does not seem to be responding correctly. You should probably check it out."
else
OUTFILE=$(date)" - All is good. acurcl is humming along on PID $PID"
fi
print $OUTFILE > $TMP
print >> $TMP
print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" >> $TMP
print $0 >> $TMP
if [ $BADDIE == "y" ]; then
if [ -z "$MAILCC" ]; then
mail -s 'AcuRCL Process monitor' $MAILTO < $TMP
else
mail -s 'AcuRCL Process monitor' -c $MAILCC $MAILTO < $TMP
fi
fi
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.