Skip to content

Commit 3e0c3b5

Browse files
committed
V2.24 Added more info when reporting status to Jvakt server.
Minor: Added more info when reporting status to Jvakt server.
1 parent 1ceef54 commit 3e0c3b5

13 files changed

+63
-41
lines changed

CheckStatus.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* 2024-02-24 V.66 Michael Ekdal Added logic to restrict number of messages per ID in the console
1616
* 2024-05-29 V.67 Michael Ekdal Added logic send rows directly to history
1717
* 2024-06-16 V.68 Michael Ekdal Fixed logic send rows directly to history. Duplicates in history.
18+
* 2024-07-09 V.69 Michael Ekdal Added more info when reporting in status to Jvakt server.
1819
*/
1920

2021
import java.io.*;
@@ -74,12 +75,13 @@ public class CheckStatus {
7475
static private String cmdPlug2delete = null;
7576
static String config = null;
7677
static InetAddress inet;
78+
static File configF;
7779

7880
// public static void main(String[] args ) throws IOException, UnknownHostException {
7981
public static void main(String[] args ) {
8082

81-
version += getVersion()+".68";
82-
File configF;
83+
version += getVersion()+".69";
84+
// File configF;
8385

8486
for (int i=0; i<args.length; i++) {
8587
if (args[i].equalsIgnoreCase("-config")) config = args[++i];
@@ -543,16 +545,16 @@ static protected void sendSTS( boolean STS) throws IOException {
543545
jmsg.setId("Jvakt-CheckStatus");
544546
if (STS) {
545547
if (swDormant) {
546-
jmsg.setBody("The CheckStatus program runs in DORMANT mode! Check the Jvakt.properties file.");
548+
jmsg.setBody("The CheckStatus program runs in DORMANT mode! "+configF.getCanonicalPath());
547549
jmsg.setRptsts("INFO");
548550
}
549551
else {
550-
jmsg.setBody("The CheckStatus program is working.");
552+
jmsg.setBody("The CheckStatus program is working. "+configF.getCanonicalPath());
551553
jmsg.setRptsts("OK");
552554
}
553555
}
554556
else {
555-
jmsg.setBody("The CheckStatus program is not working!");
557+
jmsg.setBody("The CheckStatus program is not working. "+configF.getCanonicalPath());
556558
jmsg.setRptsts("ERR");
557559
}
558560
jmsg.setType("T");

GetMail2Jvakt.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
/*
33
* 2022-06-23 V.54 Michael Ekdal Added getVersion() to get at consistent version throughout all classes.
44
* 2023-01-10 V.55 Michael Ekdal Added send of the status to Jvakt server
5+
* 2024-07-09 V.56 Michael Ekdal Added more info when reporting in status to Jvakt server.
56
*/
67

78
import jakarta.mail.*;
@@ -69,7 +70,7 @@ public class GetMail2Jvakt {
6970
public static void main(String[] args) {
7071

7172
String version = "GetMail2Jvakt ";
72-
version += getVersion()+".55";
73+
version += getVersion()+".56";
7374

7475
for (int i=0; i<args.length; i++) {
7576
if (args[i].equalsIgnoreCase("-config")) config = args[++i];
@@ -469,11 +470,11 @@ static protected void sendSTS( boolean STS) throws IOException {
469470
jm.open();
470471
jmsg.setId("Jvakt-GetMail2Jvakt");
471472
if (STS) {
472-
jmsg.setBody("The GetMail2Jvakt program is working.");
473+
jmsg.setBody("The GetMail2Jvakt program is working. "+configF.getCanonicalPath());
473474
jmsg.setRptsts("OK");
474475
}
475476
else {
476-
jmsg.setBody("The GetMail2Jvakt program is not working!");
477+
jmsg.setBody("The GetMail2Jvakt program is not working! "+configF.getCanonicalPath());
477478
jmsg.setRptsts("ERR");
478479
}
479480
jmsg.setType("T");

Jvakt.jar

862 Bytes
Binary file not shown.

PurgeConsoleRows.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package Jvakt;
22
/*
33
* 2023-03-15 V.01 Michael Ekdal To purge old rows from the console
4+
* 2024-07-09 V.02 Michael Ekdal Added more info when reporting in status to Jvakt server.
45
*/
56

67
import java.io.*;
@@ -58,12 +59,13 @@ public class PurgeConsoleRows {
5859
static private String hours = "72";
5960
static private int hoursi = 72;
6061
static private int wsec = 72;
62+
static File configF;
6163

6264
// public static void main(String[] args ) throws IOException, UnknownHostException {
6365
public static void main(String[] args ) {
6466

65-
version += getVersion()+".01";
66-
File configF;
67+
version += getVersion()+".02";
68+
// File configF;
6769

6870
for (int i=0; i<args.length; i++) {
6971
if (args[i].equalsIgnoreCase("-config")) config = args[++i];
@@ -403,11 +405,11 @@ static protected void sendSTS( boolean STS) throws IOException {
403405
jm.open();
404406
jmsg.setId("Jvakt-PurgeConsoleRows");
405407
if (STS) {
406-
jmsg.setBody("The PurgeConsoleRows program is working.");
408+
jmsg.setBody("The PurgeConsoleRows program is working. "+configF.getCanonicalPath());
407409
jmsg.setRptsts("OK");
408410
}
409411
else {
410-
jmsg.setBody("The PurgeConsoleRows program is not working!");
412+
jmsg.setBody("The PurgeConsoleRows program is not working! "+configF.getCanonicalPath());
411413
jmsg.setRptsts("ERR");
412414
}
413415
jmsg.setType("T");

SearchMail.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package Jvakt;
22
/*
3+
* 2024-07-09 V.57 Michael Ekdal Added more info when reporting in status to Jvakt server.
34
* 2023-11-08 V.56 Michael Ekdal Removed some System.out.println. They can cause problem in Linux when null.
45
* 2023-01-10 V.55 Michael Ekdal Added send of the status to Jvakt server
56
* 2022-06-23 V.54 Michael Ekdal Added getVersion() to get at consistent version throughout all classes.
@@ -68,7 +69,7 @@ public class SearchMail {
6869
public static void main(String[] args) throws IOException, FileNotFoundException {
6970

7071
String version = "SearchMail ";
71-
version += getVersion()+".56";
72+
version += getVersion()+".57";
7273

7374
for (int i=0; i<args.length; i++) {
7475
if (args[i].equalsIgnoreCase("-config")) config = args[++i];
@@ -367,11 +368,11 @@ static protected void sendSTS( boolean STS) throws IOException {
367368
jm.open();
368369
jmsg.setId("Jvakt-SearchMail");
369370
if (STS) {
370-
jmsg.setBody("The SearchMail program is working.");
371+
jmsg.setBody("The SearchMail program is working. "+configF.getCanonicalPath());
371372
jmsg.setRptsts("OK");
372373
}
373374
else {
374-
jmsg.setBody("The SearchMail program is not working!");
375+
jmsg.setBody("The SearchMail program is not working! "+configF.getCanonicalPath());
375376
jmsg.setRptsts("ERR");
376377
}
377378
jmsg.setType("T");

SendMail.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package Jvakt;
22
/*
3+
* 2024-07-09 V.56 Michael Ekdal Added more info when reporting in status to Jvakt server.
34
* 2023-01-09 V.55 Michael Ekdal Added send of the status to Jvakt server
45
* 2022-06-23 V.54 Michael Ekdal Added getVersion() to get at consistent version throughout all classes.
56
*/
@@ -92,22 +93,24 @@ public class SendMail {
9293
static String jvport = "1956";
9394
static int jvporti = 1956;
9495

96+
static File configF;
97+
9598
static Authenticator auth;
9699

97100
static List<String> listTo;
98101

99102
public static void main(String[] args ) throws IOException, UnknownHostException {
100103

101104
String version = "SendMail ";
102-
version += getVersion()+".55";
105+
version += getVersion()+".56";
103106
String database = "jVakt";
104107
String dbuser = "jVakt";
105108
String dbpassword = "";
106109
String dbhost = "localhost";
107110
String dbport = "5433";
108111

109112
String config = null;
110-
File configF;
113+
// File configF;
111114

112115
// java.sql.Time sqlt;
113116
Calendar cal = Calendar.getInstance();
@@ -444,11 +447,11 @@ static protected void sendSTS( boolean STS) throws IOException {
444447
jm.open();
445448
jmsg.setId("Jvakt-SendMail");
446449
if (STS) {
447-
jmsg.setBody("The SendMail program is working.");
450+
jmsg.setBody("The SendMail program is working. "+configF.getCanonicalPath());
448451
jmsg.setRptsts("OK");
449452
}
450453
else {
451-
jmsg.setBody("The SendMail program is not working!");
454+
jmsg.setBody("The SendMail program is not working! "+configF.getCanonicalPath());
452455
jmsg.setRptsts("ERR");
453456
}
454457
jmsg.setType("T");

SendMail30.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package Jvakt;
22
/*
3+
* 2024-07-09 V.56 Michael Ekdal Added more info when reporting in status to Jvakt server.
34
* 2023-01-09 V.55 Michael Ekdal Added send of the status to Jvakt server
45
* 2022-06-23 V.54 Michael Ekdal Added getVersion() to get at consistent version throughout all classes.
56
*/
@@ -620,11 +621,11 @@ static protected void sendSTS( boolean STS) throws IOException {
620621
jm.open();
621622
jmsg.setId("Jvakt-SendMail30");
622623
if (STS) {
623-
jmsg.setBody("The SendMail30 program is working.");
624+
jmsg.setBody("The SendMail30 program is working. "+configF.getCanonicalPath());
624625
jmsg.setRptsts("OK");
625626
}
626627
else {
627-
jmsg.setBody("The SendMail30 program is not working!");
628+
jmsg.setBody("The SendMail30 program is not working! "+configF.getCanonicalPath());
628629
jmsg.setRptsts("ERR");
629630
}
630631
jmsg.setType("T");

SendMailSTS.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package Jvakt;
22
/*
3+
* 2024-07-09 V.56 Michael Ekdal Added more info when reporting in status to Jvakt server.
34
* 2023-01-09 V.55 Michael Ekdal Added send of the status to Jvakt server
45
* 2022-06-23 V.54 Michael Ekdal Added getVersion() to get at consistent version throughout all classes.
56
*/
@@ -90,7 +91,7 @@ public class SendMailSTS {
9091
public static void main(String[] args ) throws IOException, UnknownHostException {
9192

9293
String version = "SendMailSTS ";
93-
version += getVersion()+".55";
94+
version += getVersion()+".56";
9495

9596
String subject = "";
9697
String body = "";
@@ -361,11 +362,11 @@ static protected void sendSTS( boolean STS) throws IOException {
361362
jm.open();
362363
jmsg.setId("Jvakt-SendMailSTS");
363364
if (STS) {
364-
jmsg.setBody("The SendMailSTS program is working.");
365+
jmsg.setBody("The SendMailSTS program is working. "+configF.getCanonicalPath());
365366
jmsg.setRptsts("OK");
366367
}
367368
else {
368-
jmsg.setBody("The SendMailSTS program is not working!");
369+
jmsg.setBody("The SendMailSTS program is not working! "+configF.getCanonicalPath());
369370
jmsg.setRptsts("ERR");
370371
}
371372
jmsg.setType("T");

SendSMS.java

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package Jvakt;
22
/*
3+
* 2024-07-09 V.57 Michael Ekdal Added more info when reporting in status to Jvakt server.
34
* 2023-08-21 V.56 Michael Ekdal Increased sleep times when waiting for the operator response.
45
* 2023-01-03 V.55 Michael Ekdal Added send of the status to Jvakt server
56
* 2022-06-23 V.54 Michael Ekdal Added getVersion() to get at consistent version throughout all classes.
@@ -28,6 +29,7 @@ public class SendSMS {
2829
static boolean swDormant = false;
2930
static boolean swShowVer = true;
3031
static boolean swOK = false;
32+
static boolean swSTS = false;
3133

3234
static java.sql.Date zDate;
3335
static java.sql.Timestamp zD;
@@ -70,6 +72,8 @@ public class SendSMS {
7072
static String jvport = "1956";
7173
static int port = 1956;
7274
static InetAddress inet;
75+
76+
static File configF;
7377

7478
// static Authenticator auth;
7579

@@ -78,7 +82,7 @@ public class SendSMS {
7882
public static void main(String[] args ) throws IOException, UnknownHostException {
7983

8084
String version = "SendSMS ";
81-
version += getVersion()+".56";
85+
version += getVersion()+".57";
8286
String database = "jVakt";
8387
String dbuser = "jVakt";
8488
String dbpassword = "";
@@ -88,7 +92,6 @@ public static void main(String[] args ) throws IOException, UnknownHostException
8892
// String jvport = "1956";
8993

9094
String config = null;
91-
File configF;
9295

9396
Calendar cal = Calendar.getInstance();
9497

@@ -189,12 +192,14 @@ public static void main(String[] args ) throws IOException, UnknownHostException
189192
" and prio < 30" +
190193
";");
191194

192-
// System.out.println(s);
195+
// System.out.println(s);
193196
// stmt = conn.createStatement(ResultSet.CONCUR_UPDATABLE,ResultSet.TYPE_SCROLL_INSENSITIVE);
194197
stmt = conn.createStatement(ResultSet.CONCUR_UPDATABLE,ResultSet.TYPE_FORWARD_ONLY,ResultSet.CLOSE_CURSORS_AT_COMMIT );
195198
stmt.setFetchSize(1000);
196199
ResultSet rs = stmt.executeQuery(s);
197200
// swHits = false; // is there already a record?
201+
swSTS = true;
202+
198203
while (rs.next()) {
199204
System.out.println("\n"+LocalDateTime.now()+" **** main RS - State:"+rs.getString("state")+" Id:" + rs.getString("id")+" Type:"+rs.getString("type")+" Prio:"+rs.getString("prio")+" Console:"+rs.getString("console")+" Status:"+rs.getString("status")+ " Sms:"+rs.getString("sms"));
200205
// swHits = true;
@@ -291,7 +296,8 @@ else if (rs.getString("sms").equalsIgnoreCase("R")) {
291296
// System.err.println(e.getMessage());
292297
}
293298
finally {
294-
if (swOK) try {sendSTS(true);} catch (IOException e) { e.printStackTrace();}
299+
if (swSTS) try {sendSTS(true);} catch (IOException e) { e.printStackTrace();}
300+
if (!swSTS) try {sendSTS(false);} catch (IOException e) { e.printStackTrace();}
295301
}
296302
}
297303

@@ -400,6 +406,7 @@ static boolean sendSMS() {
400406
return true;
401407
}
402408
else {
409+
swSTS=false;
403410
System.out.println(LocalDateTime.now()+" Failure sending SMS message");
404411
try {sendSTS(false);} catch (IOException e) { e.printStackTrace();}
405412
return false;
@@ -472,11 +479,11 @@ static protected void sendSTS( boolean STS) throws IOException {
472479
jm.open();
473480
jmsg.setId("Jvakt-SendSMS");
474481
if (STS) {
475-
jmsg.setBody("The SendSMS program is active");
482+
jmsg.setBody("The SendSMS program is active. "+configF.getCanonicalPath());
476483
jmsg.setRptsts("OK");
477484
}
478485
else {
479-
jmsg.setBody("The SendSMS program aborted the SMS sending!");
486+
jmsg.setBody("The SendSMS program aborted the SMS sending! "+configF.getCanonicalPath());
480487
jmsg.setRptsts("ERR");
481488
}
482489
jmsg.setType("T");

SendSMSSTS.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package Jvakt;
22
/*
3+
* 2024-07-09 V.57 Michael Ekdal Added more info when reporting in status to Jvakt server.
34
* 2023-08-21 V.56 Michael Ekdal Increased sleep times when waiting for the operator response.
45
* 2023-01-03 V.55 Michael Ekdal Added send of the status to Jvakt server
56
* 2022-06-23 V.54 Michael Ekdal Added getVersion() to get at consistent version throughout all classes.
@@ -77,7 +78,7 @@ public class SendSMSSTS {
7778
public static void main(String[] args ) {
7879

7980
String version = "SendSMSSTS ";
80-
version += getVersion()+".56";
81+
version += getVersion()+".57";
8182

8283
for (int i=0; i<args.length; i++) {
8384
if (args[i].equalsIgnoreCase("-config")) config = args[++i];
@@ -415,11 +416,11 @@ static protected void sendSTS( boolean STS) throws IOException {
415416
jm.open();
416417
jmsg.setId("Jvakt-SendSMSSTS");
417418
if (STS) {
418-
jmsg.setBody("The SendSMSSTS program is working.");
419+
jmsg.setBody("The SendSMSSTS program is working. "+configF.getCanonicalPath());
419420
jmsg.setRptsts("OK");
420421
}
421422
else {
422-
jmsg.setBody("The SendSMSSTS program is not working!");
423+
jmsg.setBody("The SendSMSSTS program is not working! "+configF.getCanonicalPath());
423424
jmsg.setRptsts("ERR");
424425
}
425426
jmsg.setType("T");

0 commit comments

Comments
 (0)