Omaha #4103: Update GFE service backup server code to support multiple service backup sites, use "smarter" lock files to store additional status.

NOTE: Service Backup features are broken until DR 4300 lands on this branch.

Change-Id: Ic0184c10c553187c8d0515f639c5a33fd3abde1f

Former-commit-id: 732208b6600882a9ba9fcc0eefd7c8be0157beab
This commit is contained in:
David Gillingham 2015-03-17 16:34:00 -05:00
parent 9faf691a35
commit a4d13dbabd
74 changed files with 2013 additions and 2216 deletions

View file

@ -31,8 +31,6 @@ import org.eclipse.swt.widgets.ProgressBar;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.dataplugin.gfe.server.notify.GfeNotification; import com.raytheon.uf.common.dataplugin.gfe.server.notify.GfeNotification;
import com.raytheon.uf.common.dataplugin.gfe.server.notify.ServiceBackupMessageNotification;
import com.raytheon.uf.common.dataplugin.gfe.server.notify.ServiceBackupProgressNotification;
import com.raytheon.uf.common.jms.notification.INotificationObserver; import com.raytheon.uf.common.jms.notification.INotificationObserver;
import com.raytheon.uf.common.jms.notification.NotificationException; import com.raytheon.uf.common.jms.notification.NotificationException;
import com.raytheon.uf.common.jms.notification.NotificationMessage; import com.raytheon.uf.common.jms.notification.NotificationMessage;
@ -89,11 +87,13 @@ public class ProgressDlg extends CaveJFACEDialog implements
newShell.setText("Progress Bar"); newShell.setText("Progress Bar");
} }
@Override
public int open() { public int open() {
NotificationManagerJob.addObserver(ServiceBackupDlg.NOTIFY_TOPIC, this); NotificationManagerJob.addObserver(ServiceBackupDlg.NOTIFY_TOPIC, this);
return super.open(); return super.open();
} }
@Override
public boolean close() { public boolean close() {
NotificationManagerJob.removeObserver(ServiceBackupDlg.NOTIFY_TOPIC, NotificationManagerJob.removeObserver(ServiceBackupDlg.NOTIFY_TOPIC,
this); this);
@ -181,13 +181,21 @@ public class ProgressDlg extends CaveJFACEDialog implements
ArrayList<GfeNotification> notifications = (ArrayList<GfeNotification>) msg ArrayList<GfeNotification> notifications = (ArrayList<GfeNotification>) msg
.getMessagePayload(); .getMessagePayload();
for (GfeNotification notification : notifications) { for (GfeNotification notification : notifications) {
if (notification instanceof ServiceBackupMessageNotification) { /*
ServiceBackupMessageNotification notify = (ServiceBackupMessageNotification) notification; * FIXME: If we're going to continue to use this dialog fix
updateMessage(notify.getMessage()); * this notificationArrived handler.
} else if (notification instanceof ServiceBackupProgressNotification) { */
ServiceBackupProgressNotification notify = (ServiceBackupProgressNotification) notification; // if (notification instanceof
updateProgress(notify.getProgress()); // ServiceBackupMessageNotification) {
} // ServiceBackupMessageNotification notify =
// (ServiceBackupMessageNotification) notification;
// updateMessage(notify.getMessage());
// } else if (notification instanceof
// ServiceBackupProgressNotification) {
// ServiceBackupProgressNotification notify =
// (ServiceBackupProgressNotification) notification;
// updateProgress(notify.getProgress());
// }
} }
} }
} catch (NotificationException e) { } catch (NotificationException e) {

View file

@ -21,7 +21,11 @@ package com.raytheon.viz.gfe.dialogs.sbu;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.net.URL; import java.net.URL;
import java.util.Collection;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.eclipse.core.runtime.FileLocator; import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
@ -54,8 +58,9 @@ import org.eclipse.swt.widgets.Shell;
import org.osgi.framework.Bundle; import org.osgi.framework.Bundle;
import com.raytheon.uf.common.dataplugin.gfe.request.GetKnownSitesRequest; import com.raytheon.uf.common.dataplugin.gfe.request.GetKnownSitesRequest;
import com.raytheon.uf.common.dataplugin.gfe.request.GetSbLockFilesRequest; import com.raytheon.uf.common.dataplugin.gfe.request.GetServiceBackupJobStatusRequest;
import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse; import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse;
import com.raytheon.uf.common.dataplugin.gfe.svcbu.ServiceBackupJobStatus;
import com.raytheon.uf.common.site.requests.GetActiveSitesRequest; import com.raytheon.uf.common.site.requests.GetActiveSitesRequest;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
@ -100,6 +105,7 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
* Jul 22, 2013 1762 dgilling Fix running as primary check. * Jul 22, 2013 1762 dgilling Fix running as primary check.
* Apr 14, 2014 2984 njensen Moved help files to viz.gfe plugin * Apr 14, 2014 2984 njensen Moved help files to viz.gfe plugin
* Jun 10,2014 DR-17401 lshi * Jun 10,2014 DR-17401 lshi
* Feb 17, 2015 4103 dgilling Wire GUI to updated requests.
* *
* </pre> * </pre>
* *
@ -170,12 +176,11 @@ public class ServiceBackupDlg extends CaveJFACEDialog {
private boolean isTerminated = false; private boolean isTerminated = false;
public boolean isTerminated() { public boolean isTerminated() {
return isTerminated; return isTerminated;
} }
/** /**
* @param parentShell * @param parentShell
*/ */
public ServiceBackupDlg(Shell parentShell) { public ServiceBackupDlg(Shell parentShell) {
@ -184,10 +189,11 @@ public class ServiceBackupDlg extends CaveJFACEDialog {
this.site = LocalizationManager.getInstance().getCurrentSite(); this.site = LocalizationManager.getInstance().getCurrentSite();
this.runningAsPrimary = CheckPermissions.runningAsPrimary(this.site); this.runningAsPrimary = CheckPermissions.runningAsPrimary(this.site);
if (!CheckPermissions.getPrimarySites().contains(this.site)) { if (!CheckPermissions.getPrimarySites().contains(this.site)) {
displayMessage("You cannot run Service Backup as " + this.site + " - EXITING!!!"); displayMessage("You cannot run Service Backup as " + this.site
isTerminated = true; + " - EXITING!!!");
return; isTerminated = true;
return;
} }
if (!ServiceBackupJobManager.getInstance().isRunning()) { if (!ServiceBackupJobManager.getInstance().isRunning()) {
@ -860,54 +866,73 @@ public class ServiceBackupDlg extends CaveJFACEDialog {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private void doRefresh() { private void doRefresh() {
/*
GetSbLockFilesRequest request = new GetSbLockFilesRequest(); * FIXME: this code needs to be further modified to handle multiple
List<String> lockFiles = null; * sites performing service backup. For now the first site with a
* non-empty set of lock files is the one assumed to be in service
* backup.
*/
Collection<ServiceBackupJobStatus> thisSitesLockFiles = Collections
.emptyList();
Collection<ServiceBackupJobStatus> failedSiteLockFiles = Collections
.emptyList();
String siteIdForLocks = "";
GetServiceBackupJobStatusRequest request = new GetServiceBackupJobStatusRequest();
try { try {
ServerResponse<List<String>> response = (ServerResponse<List<String>>) ThriftClient ServerResponse<Map<String, Collection<ServiceBackupJobStatus>>> response = (ServerResponse<Map<String, Collection<ServiceBackupJobStatus>>>) ThriftClient
.sendRequest(request); .sendRequest(request);
lockFiles = response.getPayload(); Map<String, Collection<ServiceBackupJobStatus>> allSitesLockFiles = response
.getPayload();
if (allSitesLockFiles != null && !allSitesLockFiles.isEmpty()) {
for (Entry<String, Collection<ServiceBackupJobStatus>> entry : allSitesLockFiles
.entrySet()) {
if (!entry.getValue().isEmpty()) {
String siteID = entry.getKey();
if (site.equalsIgnoreCase(siteID)) {
thisSitesLockFiles = entry.getValue();
} else if (failedSiteLockFiles.isEmpty()) {
failedSiteLockFiles = entry.getValue();
siteIdForLocks = siteID;
}
}
}
}
} catch (VizException e) { } catch (VizException e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
"Error processing site activation request", e); "Error processing site activation request", e);
} }
String theFailedSite = null; /*
if (this.failedSite != null) { * FIXME: lock file handling in this function is now completely broken
this.failedSite.toLowerCase(); * with the move to using the ServiceBackupJobStatus class. Needs to
} * check the names of the locks in the collection instead of the current
boolean lock_file = lockFiles.contains(theFailedSite + "svcbuMode"); * contains() check.
*/
boolean lock_file = (failedSiteLockFiles.contains("svcbuMode") && siteIdForLocks
.equalsIgnoreCase(failedSite));
if (!lock_file) { if (!lock_file) {
for (String file : lockFiles) { this.failedSite = null;
if (file.contains("svcbuMode")) {
this.failedSite = file.replace("svcbuMode", "") if (failedSiteLockFiles.contains("svcbuMode")) {
.toUpperCase(); failedSite = siteIdForLocks;
theFailedSite = this.failedSite.toLowerCase(); lock_file = true;
lock_file = true;
break;
} else {
this.failedSite = null;
}
} }
} }
if (lockFiles.isEmpty()) {
this.failedSite = null;
}
boolean ghg_lock_file = false; boolean ghg_lock_file = false;
boolean wait_lock_file = lockFiles.contains(theFailedSite + "waitMode"); boolean wait_lock_file = failedSiteLockFiles.contains("waitMode");
boolean export_lock_file = lockFiles.contains(this.site.toLowerCase() boolean export_lock_file = thisSitesLockFiles.contains("exportGrids")
+ "exportGrids") || failedSiteLockFiles.contains("exportGridsCron");
|| lockFiles.contains(theFailedSite + "exportGridsCron"); boolean grd_lock_file = failedSiteLockFiles.contains("importGrids");
boolean grd_lock_file = lockFiles.contains("importGrids") boolean imp_lock_file = failedSiteLockFiles
|| lockFiles.contains("procGrids"); .contains("importConfiguration");
boolean imp_lock_file = lockFiles.contains("importConfiguration"); boolean cs_lock_file = failedSiteLockFiles
boolean cs_lock_file = lockFiles.contains(theFailedSite .contains("exportBksiteGridsCS");
+ "exportBksiteGridsCS"); boolean excon_lock_file = thisSitesLockFiles.contains("exportConfig");
boolean excon_lock_file = lockFiles.contains(this.site.toLowerCase() boolean bksite_lock_file = thisSitesLockFiles
+ "exportConfig"); .contains("exportBkSiteGrids");
boolean bksite_lock_file = lockFiles.contains(this.site.toLowerCase()
+ "exportBkSiteGrids");
if (ghg_lock_file) { if (ghg_lock_file) {
updateBanner("CURRENTLY RUNNING\nEMERGENCY GFE", bigFont, black, updateBanner("CURRENTLY RUNNING\nEMERGENCY GFE", bigFont, black,

View file

@ -33,6 +33,7 @@ import com.raytheon.viz.gfe.GFEServerException;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Aug 11, 2011 bphillip Initial creation * Aug 11, 2011 bphillip Initial creation
* Mar 18, 2015 #4103 dgilling Remove unnecessary primary site field.
* *
* </pre> * </pre>
* *
@ -59,8 +60,7 @@ public class SvcbuCleanupJob extends ServiceBackupJob {
*/ */
@Override @Override
public void run() { public void run() {
CleanupSvcBuRequest request = new CleanupSvcBuRequest(primarySite, CleanupSvcBuRequest request = new CleanupSvcBuRequest(failedSite);
failedSite);
try { try {
makeRequest(request); makeRequest(request);
} catch (GFEServerException e) { } catch (GFEServerException e) {

View file

@ -33,6 +33,7 @@ import com.raytheon.viz.gfe.GFEServerException;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Aug 10, 2011 bphillip Initial creation * Aug 10, 2011 bphillip Initial creation
* Mar 18, 2015 #4103 dgilling Remove unnecessary primary site field.
* *
* </pre> * </pre>
* *
@ -47,7 +48,8 @@ public class SvcbuExportDigitalDataToFailedSiteJob extends ServiceBackupJob {
/** /**
* @param name * @param name
*/ */
public SvcbuExportDigitalDataToFailedSiteJob(String primarySite, String failedSite) { public SvcbuExportDigitalDataToFailedSiteJob(String primarySite,
String failedSite) {
super("Export Grids to: " + failedSite, primarySite); super("Export Grids to: " + failedSite, primarySite);
this.failedSite = failedSite; this.failedSite = failedSite;
} }
@ -55,7 +57,7 @@ public class SvcbuExportDigitalDataToFailedSiteJob extends ServiceBackupJob {
@Override @Override
public void run() { public void run() {
ExportDataToFailedSiteRequest request = new ExportDataToFailedSiteRequest( ExportDataToFailedSiteRequest request = new ExportDataToFailedSiteRequest(
primarySite, failedSite); failedSite);
try { try {
makeRequest(request); makeRequest(request);
} catch (GFEServerException e) { } catch (GFEServerException e) {

View file

@ -33,6 +33,7 @@ import com.raytheon.viz.gfe.GFEServerException;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Aug 10, 2011 bphillip Initial creation * Aug 10, 2011 bphillip Initial creation
* Mar 18, 2015 #4103 dgilling Remove unnecessary primary site field.
* *
* </pre> * </pre>
* *
@ -60,7 +61,7 @@ public class SvcbuExportFailedSiteDataJob extends ServiceBackupJob {
@Override @Override
public void run() { public void run() {
ExportFailedSiteDataToCCRequest request = new ExportFailedSiteDataToCCRequest( ExportFailedSiteDataToCCRequest request = new ExportFailedSiteDataToCCRequest(
primarySite, failedSite); failedSite);
try { try {
makeRequest(request); makeRequest(request);
} catch (GFEServerException e) { } catch (GFEServerException e) {

View file

@ -27,7 +27,6 @@ import com.raytheon.uf.common.dataplugin.gfe.request.AbortOperationRequest;
import com.raytheon.uf.common.dataplugin.gfe.request.ImportConfRequest; import com.raytheon.uf.common.dataplugin.gfe.request.ImportConfRequest;
import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse; import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse;
import com.raytheon.uf.common.dataplugin.gfe.server.notify.GfeNotification; import com.raytheon.uf.common.dataplugin.gfe.server.notify.GfeNotification;
import com.raytheon.uf.common.dataplugin.gfe.server.notify.ServiceBackupMessageNotification;
import com.raytheon.uf.common.jms.notification.INotificationObserver; import com.raytheon.uf.common.jms.notification.INotificationObserver;
import com.raytheon.uf.common.jms.notification.NotificationException; import com.raytheon.uf.common.jms.notification.NotificationException;
import com.raytheon.uf.common.jms.notification.NotificationMessage; import com.raytheon.uf.common.jms.notification.NotificationMessage;
@ -52,6 +51,8 @@ import com.raytheon.viz.gfe.dialogs.sbu.ServiceBackupDlg;
* Aug 05, 2011 bphillip Initial creation * Aug 05, 2011 bphillip Initial creation
* Mar 20, 2013 1447 dgilling Add support for service backup * Mar 20, 2013 1447 dgilling Add support for service backup
* troubleshooting mode from A1. * troubleshooting mode from A1.
* Feb 13, 2015 #4103 dgilling Use site id in AbortOperationRequest.
* Mar 18, 2015 #4103 dgilling Remove unnecessary primary site field.
* *
* </pre> * </pre>
* *
@ -85,8 +86,7 @@ public class SvcbuImportConfJob extends ServiceBackupJob implements
@Override @Override
public void run() { public void run() {
ImportConfRequest request = new ImportConfRequest(primarySite, ImportConfRequest request = new ImportConfRequest(failedSite, trMode);
failedSite, trMode);
try { try {
VizApp.runAsync(new Runnable() { VizApp.runAsync(new Runnable() {
@ -126,7 +126,7 @@ public class SvcbuImportConfJob extends ServiceBackupJob implements
if (aborted) { if (aborted) {
AbortOperationRequest abortRequest = new AbortOperationRequest( AbortOperationRequest abortRequest = new AbortOperationRequest(
"importConfiguration"); "importConfiguration", failedSite);
try { try {
Object obj = ThriftClient.sendRequest(abortRequest); Object obj = ThriftClient.sendRequest(abortRequest);
if (obj instanceof ServerResponse) { if (obj instanceof ServerResponse) {
@ -175,18 +175,24 @@ public class SvcbuImportConfJob extends ServiceBackupJob implements
ArrayList<GfeNotification> notifications = (ArrayList<GfeNotification>) msg ArrayList<GfeNotification> notifications = (ArrayList<GfeNotification>) msg
.getMessagePayload(); .getMessagePayload();
for (GfeNotification notification : notifications) { for (GfeNotification notification : notifications) {
if (notification instanceof ServiceBackupMessageNotification) { /*
ServiceBackupMessageNotification notify = (ServiceBackupMessageNotification) notification; * FIXME: If we're going to continue to use this class, fix
if (notify.getMessage().equals( * this notificationArrived handler.
"Import Configuration Complete!")) { */
complete = true; // if (notification instanceof
} else if (notify.getMessage().startsWith( // ServiceBackupMessageNotification) {
"Error Processing Configuration Data!")) { // ServiceBackupMessageNotification notify =
complete = true; // (ServiceBackupMessageNotification) notification;
failed = true; // if (notify.getMessage().equals(
errorMsg = notify.getMessage(); // "Import Configuration Complete!")) {
} // complete = true;
} // } else if (notify.getMessage().startsWith(
// "Error Processing Configuration Data!")) {
// complete = true;
// failed = true;
// errorMsg = notify.getMessage();
// }
// }
} }
} }
} catch (NotificationException e) { } catch (NotificationException e) {

View file

@ -27,7 +27,6 @@ import com.raytheon.uf.common.dataplugin.gfe.request.AbortOperationRequest;
import com.raytheon.uf.common.dataplugin.gfe.request.ImportDigitalDataRequest; import com.raytheon.uf.common.dataplugin.gfe.request.ImportDigitalDataRequest;
import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse; import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse;
import com.raytheon.uf.common.dataplugin.gfe.server.notify.GfeNotification; import com.raytheon.uf.common.dataplugin.gfe.server.notify.GfeNotification;
import com.raytheon.uf.common.dataplugin.gfe.server.notify.ServiceBackupMessageNotification;
import com.raytheon.uf.common.jms.notification.INotificationObserver; import com.raytheon.uf.common.jms.notification.INotificationObserver;
import com.raytheon.uf.common.jms.notification.NotificationException; import com.raytheon.uf.common.jms.notification.NotificationException;
import com.raytheon.uf.common.jms.notification.NotificationMessage; import com.raytheon.uf.common.jms.notification.NotificationMessage;
@ -49,7 +48,9 @@ import com.raytheon.viz.gfe.dialogs.sbu.ServiceBackupDlg;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Aug 8, 2011 bphillip Initial creation * Aug 08, 2011 bphillip Initial creation
* Feb 13, 2015 #4103 dgilling Use site id in AbortOperationRequest.
* Mar 18, 2015 #4103 dgilling Remove unnecessary primary site field.
* *
* </pre> * </pre>
* *
@ -89,7 +90,7 @@ public class SvcbuImportDataJob extends ServiceBackupJob implements
@Override @Override
public void run() { public void run() {
ImportDigitalDataRequest request = new ImportDigitalDataRequest( ImportDigitalDataRequest request = new ImportDigitalDataRequest(
primarySite, failedSite); failedSite);
try { try {
VizApp.runAsync(new Runnable() { VizApp.runAsync(new Runnable() {
@ -129,7 +130,7 @@ public class SvcbuImportDataJob extends ServiceBackupJob implements
if (aborted) { if (aborted) {
AbortOperationRequest abortRequest = new AbortOperationRequest( AbortOperationRequest abortRequest = new AbortOperationRequest(
"importGrids"); "importGrids", failedSite);
try { try {
Object obj = ThriftClient.sendRequest(abortRequest); Object obj = ThriftClient.sendRequest(abortRequest);
if (obj instanceof ServerResponse) { if (obj instanceof ServerResponse) {
@ -178,17 +179,24 @@ public class SvcbuImportDataJob extends ServiceBackupJob implements
ArrayList<GfeNotification> notifications = (ArrayList<GfeNotification>) msg ArrayList<GfeNotification> notifications = (ArrayList<GfeNotification>) msg
.getMessagePayload(); .getMessagePayload();
for (GfeNotification notification : notifications) { for (GfeNotification notification : notifications) {
if (notification instanceof ServiceBackupMessageNotification) { /*
ServiceBackupMessageNotification notify = (ServiceBackupMessageNotification) notification; * FIXME: If we're going to continue to use this class, fix
if (notify.getMessage().equals("Import Data Complete!")) { * this notificationArrived handler.
complete = true; */
} else if (notify.getMessage().startsWith( // if (notification instanceof
"Error Processing Digital Data!")) { // ServiceBackupMessageNotification) {
complete = true; // ServiceBackupMessageNotification notify =
failed = true; // (ServiceBackupMessageNotification) notification;
errorMsg = notify.getMessage(); // if (notify.getMessage().equals("Import Data Complete!"))
} // {
} // complete = true;
// } else if (notify.getMessage().startsWith(
// "Error Processing Digital Data!")) {
// complete = true;
// failed = true;
// errorMsg = notify.getMessage();
// }
// }
} }
} }
} catch (NotificationException e) { } catch (NotificationException e) {

View file

@ -192,11 +192,6 @@
<constructor-arg value="com.raytheon.uf.common.dataplugin.gfe.request.GetSiteTimeZoneInfoRequest"/> <constructor-arg value="com.raytheon.uf.common.dataplugin.gfe.request.GetSiteTimeZoneInfoRequest"/>
<constructor-arg ref="siteTimeZoneHandler"/> <constructor-arg ref="siteTimeZoneHandler"/>
</bean> </bean>
<bean id="statusUpdateHandler" class="com.raytheon.edex.plugin.gfe.server.handler.ServiceBackupStatusUpdateRequestHandler"/>
<bean factory-bean="handlerRegistry" factory-method="register">
<constructor-arg value="com.raytheon.uf.common.dataplugin.gfe.request.ServiceBackupStatusUpdateRequest"/>
<constructor-arg ref="statusUpdateHandler"/>
</bean>
<bean id="smartInitHandler" class="com.raytheon.edex.plugin.gfe.server.handler.SmartInitRequestHandler"/> <bean id="smartInitHandler" class="com.raytheon.edex.plugin.gfe.server.handler.SmartInitRequestHandler"/>
<bean factory-bean="handlerRegistry" factory-method="register"> <bean factory-bean="handlerRegistry" factory-method="register">
<constructor-arg value="com.raytheon.uf.common.dataplugin.gfe.request.SmartInitRequest"/> <constructor-arg value="com.raytheon.uf.common.dataplugin.gfe.request.SmartInitRequest"/>
@ -261,10 +256,10 @@
<constructor-arg ref="AbortOperationRequestHandler"/> <constructor-arg ref="AbortOperationRequestHandler"/>
</bean> </bean>
<bean id="GetSbLockFilesRequestHandler" class="com.raytheon.edex.plugin.gfe.server.handler.svcbu.GetSbLockFilesRequestHandler"/> <bean id="GetSvcBuJobStatusHandler" class="com.raytheon.edex.plugin.gfe.server.handler.svcbu.GetServiceBackupJobStatusHandler" />
<bean factory-bean="handlerRegistry" factory-method="register"> <bean factory-bean="handlerRegistry" factory-method="register">
<constructor-arg value="com.raytheon.uf.common.dataplugin.gfe.request.GetSbLockFilesRequest"/> <constructor-arg value="com.raytheon.uf.common.dataplugin.gfe.request.GetServiceBackupJobStatusRequest"/>
<constructor-arg ref="GetSbLockFilesRequestHandler"/> <constructor-arg ref="GetSvcBuJobStatusHandler"/>
</bean> </bean>
<bean id="CleanupSvcBuRequestHandler" class="com.raytheon.edex.plugin.gfe.server.handler.svcbu.CleanupSvcBuRequestHandler"/> <bean id="CleanupSvcBuRequestHandler" class="com.raytheon.edex.plugin.gfe.server.handler.svcbu.CleanupSvcBuRequestHandler"/>
@ -291,13 +286,6 @@
<constructor-arg ref="GetServiceBackupPrimarySitesHandler"/> <constructor-arg ref="GetServiceBackupPrimarySitesHandler"/>
</bean> </bean>
<bean id="CleanupSvcBuLogRequestHandler" class="com.raytheon.edex.plugin.gfe.server.handler.svcbu.CleanupSvcBuLogRequestHandler"/>
<bean factory-bean="handlerRegistry" factory-method="register">
<constructor-arg value="com.raytheon.uf.common.dataplugin.gfe.request.CleaunpSvcBuLogRequest"/>
<constructor-arg ref="CleanupSvcBuLogRequestHandler"/>
</bean>
<bean id="ExportConfRequestHandler" class="com.raytheon.edex.plugin.gfe.server.handler.svcbu.ExportConfRequestHandler"/> <bean id="ExportConfRequestHandler" class="com.raytheon.edex.plugin.gfe.server.handler.svcbu.ExportConfRequestHandler"/>
<bean factory-bean="handlerRegistry" factory-method="register"> <bean factory-bean="handlerRegistry" factory-method="register">
<constructor-arg value="com.raytheon.uf.common.dataplugin.gfe.request.ExportConfRequest"/> <constructor-arg value="com.raytheon.uf.common.dataplugin.gfe.request.ExportConfRequest"/>
@ -419,8 +407,9 @@
<bean id="logPurger" class="com.raytheon.edex.plugin.gfe.log.LogPurger"/> <bean id="logPurger" class="com.raytheon.edex.plugin.gfe.log.LogPurger"/>
<bean id="sbLockMgr" class="com.raytheon.edex.plugin.gfe.server.handler.svcbu.ServiceBackupLockManager" <bean id="svcBuLogPurger" class="com.raytheon.edex.plugin.gfe.svcbackup.SvcbuCleanupLogsTask">
factory-method="getInstance"/> <constructor-arg value="${purge.svcbu.logs.retention}" />
</bean>
<bean id="productIscPurger" class="com.raytheon.uf.common.dataplugin.gfe.util.FilePurger"> <bean id="productIscPurger" class="com.raytheon.uf.common.dataplugin.gfe.util.FilePurger">
<constructor-arg value="/awips2/GFESuite/products/ISC"/> <!-- directory to be purged --> <constructor-arg value="/awips2/GFESuite/products/ISC"/> <!-- directory to be purged -->
@ -457,12 +446,6 @@
</doTry> </doTry>
</route> </route>
<route id="gfeSiteActivationNotification">
<from uri="jms-generic:topic:edex.alerts.siteActivate?threadName=gfe-edex.alerts.siteActivate"/>
<bean ref="serializationUtil" method="transformFromThrift"/>
<bean ref="sbLockMgr" method="handleSiteActivationNotification"/>
</route>
<route id="purgeGfeLogs"> <route id="purgeGfeLogs">
<from uri="gfeLogPurgeCron"/> <from uri="gfeLogPurgeCron"/>
<to uri="jms-generic:queue:purgeGfeLogWork"/> <to uri="jms-generic:queue:purgeGfeLogWork"/>
@ -518,7 +501,7 @@
<route id="purgeSvcbuLogWork"> <route id="purgeSvcbuLogWork">
<from uri="jms-generic:queue:purgeSvcbuLogWork"/> <from uri="jms-generic:queue:purgeSvcbuLogWork"/>
<doTry> <doTry>
<bean ref="CleanupSvcBuLogRequestHandler" method="svcbuLogCleanupCron"/> <bean ref="svcBuLogPurger" method="run"/>
<doCatch> <doCatch>
<exception>java.lang.Throwable</exception> <exception>java.lang.Throwable</exception>
<to <to

View file

@ -10,6 +10,9 @@ purge.gfe.logs.cron=0+30+0+*+*+?
# Interval at which the service backup logs are purged # Interval at which the service backup logs are purged
purge.svcbu.logs.cron=0+30+0+*+*+? purge.svcbu.logs.cron=0+30+0+*+*+?
# Number of days of service backup logs to retain
purge.svcbu.logs.retention=7
# Interval at which the gfe products are purged # Interval at which the gfe products are purged
purge.gfe.products.isc.cron=0+45+0+*+*+? purge.gfe.products.isc.cron=0+45+0+*+*+?
purge.gfe.products.atbl.cron=0+50+0+*+*+? purge.gfe.products.atbl.cron=0+50+0+*+*+?

View file

@ -1,68 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.edex.plugin.gfe.server.handler;
import com.raytheon.edex.plugin.gfe.svcbackup.ServiceBackupNotificationManager;
import com.raytheon.uf.common.dataplugin.gfe.request.ServiceBackupStatusUpdateRequest;
import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse;
import com.raytheon.uf.common.serialization.comm.IRequestHandler;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 26, 2010 dgilling Initial creation
*
* </pre>
*
* @author dgilling
* @version 1.0
*/
public class ServiceBackupStatusUpdateRequestHandler implements
IRequestHandler<ServiceBackupStatusUpdateRequest> {
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.common.serialization.comm.IRequestHandler#handleRequest
* (com.raytheon.uf.common.serialization.comm.IServerRequest)
*/
@Override
public ServerResponse<String> handleRequest(
ServiceBackupStatusUpdateRequest request) throws Exception {
ServerResponse<String> sr = new ServerResponse<String>();
String msg = request.getStatusMessage();
try {
int percent = Integer.parseInt(msg);
ServiceBackupNotificationManager.sendProgressNotification(percent);
} catch (NumberFormatException e) {
ServiceBackupNotificationManager.sendMessageNotification(msg);
}
return sr;
}
}

View file

@ -19,7 +19,8 @@
**/ **/
package com.raytheon.edex.plugin.gfe.server.handler.svcbu; package com.raytheon.edex.plugin.gfe.server.handler.svcbu;
import java.io.File; import java.nio.file.Files;
import java.nio.file.Path;
import com.raytheon.edex.plugin.gfe.svcbackup.SvcBackupUtil; import com.raytheon.edex.plugin.gfe.svcbackup.SvcBackupUtil;
import com.raytheon.uf.common.dataplugin.gfe.request.AbortOperationRequest; import com.raytheon.uf.common.dataplugin.gfe.request.AbortOperationRequest;
@ -36,6 +37,7 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Aug 12, 2011 bphillip Initial creation * Aug 12, 2011 bphillip Initial creation
* Feb 13, 2015 #4103 dgilling Use site id.
* *
* </pre> * </pre>
* *
@ -43,21 +45,21 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler;
* @version 1.0 * @version 1.0
*/ */
public class AbortOperationRequestHandler implements public final class AbortOperationRequestHandler implements
IRequestHandler<AbortOperationRequest> { IRequestHandler<AbortOperationRequest> {
@Override @Override
public Object handleRequest(AbortOperationRequest request) throws Exception { public ServerResponse<Object> handleRequest(AbortOperationRequest request)
throws Exception {
ServerResponse<Object> sr = new ServerResponse<>();
Path lockFilePath = SvcBackupUtil.getLockDir(request.getSiteID())
.resolve(request.getOperation());
ServerResponse<String> sr = new ServerResponse<String>(); if (!Files.deleteIfExists(lockFilePath)) {
File lockFile = new File(SvcBackupUtil.getLockDir() + "/" sr.addMessage("Unable to delete lock file: "
+ request.getOperation()); + request.getOperation());
if (lockFile.exists()) {
if (!lockFile.delete()) {
sr.addMessage("Unable to delete lock file: "
+ request.getOperation());
}
} }
return sr; return sr;
} }
} }

View file

@ -1,78 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.edex.plugin.gfe.server.handler.svcbu;
import java.util.Date;
import java.util.Random;
import java.util.Timer;
import com.raytheon.edex.plugin.gfe.svcbackup.ServiceBackupNotificationManager;
import com.raytheon.edex.plugin.gfe.svcbackup.SvcbuCleanupLogsTask;
import com.raytheon.edex.plugin.gfe.svcbackup.SvcBackupUtil;
import com.raytheon.uf.common.dataplugin.gfe.request.CleanupSvcBuLogRequest;
import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse;
import com.raytheon.uf.common.serialization.comm.IRequestHandler;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 3, 2013 jdynina Initial creation
*
* </pre>
*
* @author jdynina
* @version 1.0
*/
public class CleanupSvcBuLogRequestHandler implements
IRequestHandler<CleanupSvcBuLogRequest> {
private static Timer svcbuLogCleanTimer = new Timer(true);
@Override
public Object handleRequest(CleanupSvcBuLogRequest request) {
ServerResponse<String> sr = new ServerResponse<String>();
try {
ServiceBackupNotificationManager
.sendMessageNotification("Running service backup log cleanup script");
SvcBackupUtil.execute("cleanup_svcbu_logs");
} catch (Exception e) {
sr.addMessage("Error executing service backup log cleanup script! "
+ e.getLocalizedMessage());
}
return sr;
}
public void svcbuLogCleanupCron() throws Exception {
Random rand = new Random(System.currentTimeMillis());
Date executionDate = new Date(System.currentTimeMillis()
+ Math.abs(rand.nextInt() % 45) * 60 * 1000);
svcbuLogCleanTimer.schedule(new SvcbuCleanupLogsTask(executionDate),
executionDate);
}
}

View file

@ -23,18 +23,20 @@ import java.io.File;
import com.raytheon.edex.plugin.gfe.db.dao.GFEDao; import com.raytheon.edex.plugin.gfe.db.dao.GFEDao;
import com.raytheon.edex.plugin.gfe.server.database.GridDatabase; import com.raytheon.edex.plugin.gfe.server.database.GridDatabase;
import com.raytheon.edex.plugin.gfe.svcbackup.ServiceBackupNotificationManager;
import com.raytheon.edex.plugin.gfe.svcbackup.SvcBackupUtil; import com.raytheon.edex.plugin.gfe.svcbackup.SvcBackupUtil;
import com.raytheon.uf.common.dataplugin.PluginException; import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.common.dataplugin.gfe.request.CleanupSvcBuRequest; import com.raytheon.uf.common.dataplugin.gfe.request.CleanupSvcBuRequest;
import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse; import com.raytheon.uf.common.dataplugin.gfe.svcbu.JobProgress;
import com.raytheon.uf.common.datastorage.DataStoreFactory; import com.raytheon.uf.common.datastorage.DataStoreFactory;
import com.raytheon.uf.common.datastorage.IDataStore; import com.raytheon.uf.common.datastorage.IDataStore;
import com.raytheon.uf.common.serialization.comm.IRequestHandler; import com.raytheon.uf.common.serialization.comm.IRequestHandler;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.edex.database.DataAccessLayerException; import com.raytheon.uf.edex.database.DataAccessLayerException;
/** /**
* TODO Add Description * Request handler for {@code CleanupSvcBuRequest}. This handler will delete all
* data for the failed site from the local server.
* *
* <pre> * <pre>
* *
@ -43,6 +45,7 @@ import com.raytheon.uf.edex.database.DataAccessLayerException;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Aug 10, 2011 bphillip Initial creation * Aug 10, 2011 bphillip Initial creation
* Feb 12, 2015 #4103 dgilling Move lock deletion to cleanup script.
* *
* </pre> * </pre>
* *
@ -50,42 +53,50 @@ import com.raytheon.uf.edex.database.DataAccessLayerException;
* @version 1.0 * @version 1.0
*/ */
public class CleanupSvcBuRequestHandler implements public final class CleanupSvcBuRequestHandler implements
IRequestHandler<CleanupSvcBuRequest> { IRequestHandler<CleanupSvcBuRequest> {
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(CleanupSvcBuRequestHandler.class);
@Override @Override
public Object handleRequest(CleanupSvcBuRequest request) { public JobProgress handleRequest(final CleanupSvcBuRequest request) {
JobProgress progress = JobProgress.SUCCESS;
ServerResponse<String> sr = new ServerResponse<String>();
SvcBackupUtil.removeLocks();
GFEDao dao = null;
try { try {
dao = new GFEDao(); statusHandler.info("Running cleanup script for for "
ServiceBackupNotificationManager + request.getFailedSite());
.sendMessageNotification("Purging database for " SvcBackupUtil.execute("cleanup_svcbk", request.getFailedSite()
+ request.getFailedSite()); .toLowerCase());
dao.purgeDatabaseForSite(request.getFailedSite());
ServiceBackupNotificationManager
.sendMessageNotification("Purging HDF5 for "
+ request.getFailedSite());
purgeHDF5(request.getFailedSite());
ServiceBackupNotificationManager
.sendMessageNotification("Running cleanup script for for "
+ request.getFailedSite());
SvcBackupUtil.execute("cleanup_svcbk", request.getPrimarySite()
.toLowerCase(), request.getFailedSite().toLowerCase());
} catch (PluginException e) {
sr.addMessage("Error instantiating GFE dao! "
+ e.getLocalizedMessage());
} catch (DataAccessLayerException e) {
sr.addMessage("Error purging data for " + request.getFailedSite()
+ " " + e.getLocalizedMessage());
} catch (Exception e) { } catch (Exception e) {
sr.addMessage("Error executing cleanup script! " statusHandler.error("Error executing cleanup script!", e);
+ e.getLocalizedMessage()); progress = JobProgress.FAILED;
} }
return sr;
try {
statusHandler.info("Purging database for "
+ request.getFailedSite());
new GFEDao().purgeDatabaseForSite(request.getFailedSite());
} catch (DataAccessLayerException e) {
statusHandler.error(
"Error purging GFE data for site "
+ request.getFailedSite(), e);
progress = JobProgress.FAILED;
} catch (PluginException e) {
statusHandler.error("Error instantiating GFEDao!", e);
progress = JobProgress.FAILED;
}
try {
statusHandler.info("Purging HDF5 for " + request.getFailedSite());
purgeHDF5(request.getFailedSite());
} catch (DataAccessLayerException e) {
statusHandler.error("Error purging GFE HDF5 data for site "
+ request.getFailedSite(), e);
progress = JobProgress.FAILED;
}
return progress;
} }
private void purgeHDF5(String failedSite) throws DataAccessLayerException { private void purgeHDF5(String failedSite) throws DataAccessLayerException {

View file

@ -19,17 +19,20 @@
**/ **/
package com.raytheon.edex.plugin.gfe.server.handler.svcbu; package com.raytheon.edex.plugin.gfe.server.handler.svcbu;
import com.raytheon.edex.plugin.gfe.svcbackup.ServiceBackupNotificationManager;
import com.raytheon.edex.plugin.gfe.svcbackup.SvcBackupUtil; import com.raytheon.edex.plugin.gfe.svcbackup.SvcBackupUtil;
import com.raytheon.uf.common.auth.exception.AuthorizationException; import com.raytheon.uf.common.auth.exception.AuthorizationException;
import com.raytheon.uf.common.auth.user.IUser; import com.raytheon.uf.common.auth.user.IUser;
import com.raytheon.uf.common.dataplugin.gfe.request.ExportConfRequest; import com.raytheon.uf.common.dataplugin.gfe.request.ExportConfRequest;
import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse; import com.raytheon.uf.common.dataplugin.gfe.svcbu.JobProgress;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.edex.auth.req.AbstractPrivilegedRequestHandler; import com.raytheon.uf.edex.auth.req.AbstractPrivilegedRequestHandler;
import com.raytheon.uf.edex.auth.resp.AuthorizationResponse; import com.raytheon.uf.edex.auth.resp.AuthorizationResponse;
/** /**
* Exports configuration? * Request handler for {@code ExportConfRequest}. This handler will export the
* local site's configuration data to the central server for use in a service
* backup scenario.
* *
* <pre> * <pre>
* *
@ -37,7 +40,9 @@ import com.raytheon.uf.edex.auth.resp.AuthorizationResponse;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Aug 4, 2011 bphillip Initial creation * Aug 04, 2011 bphillip Initial creation
* Mar 17, 2015 #4103 dgilling Stop using ServiceBackupNotificationManager,
* supoprt new Service Backup GUI.
* *
* </pre> * </pre>
* *
@ -45,26 +50,35 @@ import com.raytheon.uf.edex.auth.resp.AuthorizationResponse;
* @version 1.0 * @version 1.0
*/ */
public class ExportConfRequestHandler extends public final class ExportConfRequestHandler extends
AbstractPrivilegedRequestHandler<ExportConfRequest> { AbstractPrivilegedRequestHandler<ExportConfRequest> {
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(ExportConfRequestHandler.class);
@Override @Override
public Object handleRequest(ExportConfRequest request) throws Exception { public JobProgress handleRequest(final ExportConfRequest request)
throws Exception {
AuthorizationResponse response = authorized(request.getUser(), request); AuthorizationResponse response = authorized(request.getUser(), request);
ServerResponse<String> sr = new ServerResponse<String>(); if (!response.isAuthorized()) {
if (response.isAuthorized()) { statusHandler.error("User " + request.getUser()
+ " is not export configuration for site "
+ request.getSite());
return JobProgress.FAILED;
}
try {
SvcBackupUtil.execute("export_configuration", request.getSite() SvcBackupUtil.execute("export_configuration", request.getSite()
.toLowerCase()); .toLowerCase());
ServiceBackupNotificationManager statusHandler
.sendMessageNotification("Configuration successfully sent to central server"); .info("Configuration successfully sent to central server");
ServiceBackupNotificationManager.sendProgressNotification(100); } catch (Exception e) {
} else { statusHandler.error("Error exporting configuration for site "
ServiceBackupNotificationManager.sendMessageNotification("User " + request.getSite(), e);
+ request.getUser() return JobProgress.FAILED;
+ " is not authorized to perform this operation");
sr.addMessage(response.getResponseMessage());
} }
return sr;
return JobProgress.SUCCESS;
} }
@Override @Override

View file

@ -21,11 +21,15 @@ package com.raytheon.edex.plugin.gfe.server.handler.svcbu;
import com.raytheon.edex.plugin.gfe.svcbackup.SvcBackupUtil; import com.raytheon.edex.plugin.gfe.svcbackup.SvcBackupUtil;
import com.raytheon.uf.common.dataplugin.gfe.request.ExportDataToFailedSiteRequest; import com.raytheon.uf.common.dataplugin.gfe.request.ExportDataToFailedSiteRequest;
import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse; import com.raytheon.uf.common.dataplugin.gfe.svcbu.JobProgress;
import com.raytheon.uf.common.serialization.comm.IRequestHandler; import com.raytheon.uf.common.serialization.comm.IRequestHandler;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
/** /**
* TODO Add Description * Request handler for {@code ExportDataToFailedSiteRequest}. This handler will
* export the GFE grids for a failed site running in service backup mode and
* send them directly to the failed site.
* *
* <pre> * <pre>
* *
@ -33,7 +37,8 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Aug 4, 2011 bphillip Initial creation * Aug 04, 2011 bphillip Initial creation
* Mar 17, 2015 #4103 dgilling Support new Service Backup GUI.
* *
* </pre> * </pre>
* *
@ -41,16 +46,24 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler;
* @version 1.0 * @version 1.0
*/ */
public class ExportDataToFailedSiteRequestHandler implements public final class ExportDataToFailedSiteRequestHandler implements
IRequestHandler<ExportDataToFailedSiteRequest> { IRequestHandler<ExportDataToFailedSiteRequest> {
@Override private final IUFStatusHandler statusHandler = UFStatus
public Object handleRequest(ExportDataToFailedSiteRequest request) .getHandler(ExportDataToFailedSiteRequestHandler.class);
throws Exception {
ServerResponse<String> sr = new ServerResponse<String>();
SvcBackupUtil.execute("export_grids_to_failed_site", request.getFailedSite()
.toLowerCase(), request.getPrimarySite().toLowerCase());
return sr;
}
@Override
public JobProgress handleRequest(final ExportDataToFailedSiteRequest request)
throws Exception {
try {
SvcBackupUtil.execute("export_grids_to_failed_site", request
.getFailedSite().toLowerCase());
} catch (Exception e) {
statusHandler.error(
"Error running export_grids_to_failed_site for site "
+ request.getFailedSite(), e);
return JobProgress.FAILED;
}
return JobProgress.SUCCESS;
}
} }

View file

@ -21,11 +21,15 @@ package com.raytheon.edex.plugin.gfe.server.handler.svcbu;
import com.raytheon.edex.plugin.gfe.svcbackup.SvcBackupUtil; import com.raytheon.edex.plugin.gfe.svcbackup.SvcBackupUtil;
import com.raytheon.uf.common.dataplugin.gfe.request.ExportFailedSiteDataToCCRequest; import com.raytheon.uf.common.dataplugin.gfe.request.ExportFailedSiteDataToCCRequest;
import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse; import com.raytheon.uf.common.dataplugin.gfe.svcbu.JobProgress;
import com.raytheon.uf.common.serialization.comm.IRequestHandler; import com.raytheon.uf.common.serialization.comm.IRequestHandler;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
/** /**
* TODO Add Description * Request handler for {@code ExportFailedSiteDataToCCRequestHandler}. This
* handler will export the GFE grids for a failed site running in service backup
* mode and send them directly to the central server.
* *
* <pre> * <pre>
* *
@ -33,7 +37,8 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Aug 4, 2011 bphillip Initial creation * Aug 04, 2011 bphillip Initial creation
* Mar 17, 2015 #4103 dgilling Support new Service Backup GUI.
* *
* </pre> * </pre>
* *
@ -41,15 +46,24 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler;
* @version 1.0 * @version 1.0
*/ */
public class ExportFailedSiteDataToCCRequestHandler implements public final class ExportFailedSiteDataToCCRequestHandler implements
IRequestHandler<ExportFailedSiteDataToCCRequest> { IRequestHandler<ExportFailedSiteDataToCCRequest> {
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(ExportFailedSiteDataToCCRequestHandler.class);
@Override @Override
public Object handleRequest(ExportFailedSiteDataToCCRequest request) public JobProgress handleRequest(
throws Exception { final ExportFailedSiteDataToCCRequest request) throws Exception {
ServerResponse<String> sr = new ServerResponse<String>(); try {
SvcBackupUtil.execute("export_bksite_grids", request.getPrimarySite() SvcBackupUtil.execute("export_bksite_grids", request
.toLowerCase(), request.getFailedSite().toLowerCase()); .getFailedSite().toLowerCase());
return sr; } catch (Exception e) {
statusHandler.error("Error running export_bksite_grids for site "
+ request.getFailedSite(), e);
return JobProgress.FAILED;
}
return JobProgress.SUCCESS;
} }
} }

View file

@ -24,14 +24,17 @@ import java.util.Random;
import java.util.Timer; import java.util.Timer;
import com.raytheon.edex.plugin.gfe.svcbackup.ExportGridsTask; import com.raytheon.edex.plugin.gfe.svcbackup.ExportGridsTask;
import com.raytheon.edex.plugin.gfe.svcbackup.ServiceBackupNotificationManager;
import com.raytheon.edex.plugin.gfe.svcbackup.SvcBackupUtil; import com.raytheon.edex.plugin.gfe.svcbackup.SvcBackupUtil;
import com.raytheon.uf.common.dataplugin.gfe.request.ExportGridsRequest; import com.raytheon.uf.common.dataplugin.gfe.request.ExportGridsRequest;
import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse; import com.raytheon.uf.common.dataplugin.gfe.svcbu.JobProgress;
import com.raytheon.uf.common.serialization.comm.IRequestHandler; import com.raytheon.uf.common.serialization.comm.IRequestHandler;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
/** /**
* TODO Add Description * Request handler for {@code ExportGridsRequest}. This handler will export the
* GFE grids for a site and leaves them in the GFESuite/exportgrids folder for
* the central server to download via rsync.
* *
* <pre> * <pre>
* *
@ -42,6 +45,8 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler;
* Aug 04, 2011 bphillip Initial creation * Aug 04, 2011 bphillip Initial creation
* Apr 30, 2013 #1761 dgilling Support changes made to * Apr 30, 2013 #1761 dgilling Support changes made to
* ExportGridsRequest. * ExportGridsRequest.
* Mar 17, 2015 #4103 dgilling Stop using ServiceBackupNotificationManager,
* supoprt new Service Backup GUI.
* *
* </pre> * </pre>
* *
@ -49,23 +54,29 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler;
* @version 1.0 * @version 1.0
*/ */
public class ExportGridsRequestHandler implements public final class ExportGridsRequestHandler implements
IRequestHandler<ExportGridsRequest> { IRequestHandler<ExportGridsRequest> {
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(ExportGridsRequestHandler.class);
private static Timer exportGridsTimer = new Timer(true); private static Timer exportGridsTimer = new Timer(true);
@Override @Override
public Object handleRequest(ExportGridsRequest request) throws Exception { public JobProgress handleRequest(final ExportGridsRequest request)
ServerResponse<String> sr = new ServerResponse<String>(); throws Exception {
JobProgress progress = JobProgress.SUCCESS;
SvcBackupUtil.execute("export_grids", try {
request.getMode().getCmdLineArg(), request.getSite() SvcBackupUtil.execute("export_grids", request.getMode()
.toLowerCase()); .getCmdLineArg(), request.getSite().toLowerCase());
statusHandler.info("Digital data successfully exported.");
} catch (Exception e) {
statusHandler.error(
"Error digital data for site " + request.getSite(), e);
}
ServiceBackupNotificationManager return progress;
.sendMessageNotification("Digital data successfully exported.");
ServiceBackupNotificationManager.sendProgressNotification(100);
return sr;
} }
public void exportGridsCron() throws Exception { public void exportGridsCron() throws Exception {

View file

@ -19,17 +19,18 @@
**/ **/
package com.raytheon.edex.plugin.gfe.server.handler.svcbu; package com.raytheon.edex.plugin.gfe.server.handler.svcbu;
import java.io.BufferedReader; import java.util.Properties;
import java.io.FileReader;
import java.io.IOException;
import com.raytheon.edex.plugin.gfe.svcbackup.SvcBackupUtil; import com.raytheon.edex.plugin.gfe.svcbackup.SvcBackupUtil;
import com.raytheon.uf.common.dataplugin.gfe.request.GetGfeStartCmdRequest; import com.raytheon.uf.common.dataplugin.gfe.request.GetGfeStartCmdRequest;
import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse;
import com.raytheon.uf.common.serialization.comm.IRequestHandler; import com.raytheon.uf.common.serialization.comm.IRequestHandler;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
/** /**
* TODO Add Description * Request handler for {@code GetGfeStartCmdRequest}. Using the configuration
* file svcbu.properties, this determines the command needed to launch GFE as
* the failed site and returns it to the requester.
* *
* <pre> * <pre>
* *
@ -37,7 +38,8 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Aug 9, 2011 bphillip Initial creation * Aug 09, 2011 bphillip Initial creation
* Feb 13, 2015 #4103 dgilling Rewrite to stop using createGFEStartScript.
* *
* </pre> * </pre>
* *
@ -45,35 +47,36 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler;
* @version 1.0 * @version 1.0
*/ */
public class GetGfeStartCmdRequestHandler implements public final class GetGfeStartCmdRequestHandler implements
IRequestHandler<GetGfeStartCmdRequest> { IRequestHandler<GetGfeStartCmdRequest> {
@Override private final IUFStatusHandler statusHandler = UFStatus
public Object handleRequest(GetGfeStartCmdRequest request) throws Exception { .getHandler(CleanupSvcBuRequestHandler.class);
ServerResponse<String> sr = new ServerResponse<String>();
BufferedReader in = null;
try {
SvcBackupUtil.execute("createGFEStartScript", request.getSite());
String scriptFile = "/awips2/GFESuite/ServiceBackup/.launch_cave.sh"; @Override
in = new BufferedReader(new FileReader(scriptFile)); public String handleRequest(final GetGfeStartCmdRequest request)
String str = null; throws Exception {
while ((str = in.readLine()) != null) { Properties svcbuProps = SvcBackupUtil.getSvcBackupProperties();
sr.setPayload(str);
} String svcbuUser = (svcbuProps.getProperty("SVCBU_USER") != null) ? svcbuProps
in.close(); .getProperty("SVCBU_USER").trim() : "0";
} catch (Exception e) { String svcbuUserName = (svcbuProps.getProperty("SVCBU_USER_ID") != null) ? svcbuProps
sr.addMessage("Error generating GFE launch script! " .getProperty("SVCBU_USER_ID").trim() : "";
+ e.getLocalizedMessage());
} finally { if (svcbuUser.equals("1") && svcbuUserName.isEmpty()) {
if (in != null) { statusHandler
try { .info("You do not have a user id configured for ServiceBackup");
in.close(); statusHandler.info("GFE will start with your regular user id");
} catch (IOException e) {
sr.addMessage("Error closing input stream!");
}
}
} }
return sr;
StringBuilder cmdLine = new StringBuilder(
svcbuProps.getProperty("CAVE_LAUNCH_SCRIPT"));
cmdLine.append(" -site ").append(request.getSite());
if ((svcbuUser.equals("1")) && (!svcbuUserName.isEmpty())) {
cmdLine.append(" -u ").append(svcbuUserName);
}
cmdLine.append(" -perspective GFE");
return cmdLine.toString();
} }
} }

View file

@ -1,55 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.edex.plugin.gfe.server.handler.svcbu;
import java.util.List;
import com.raytheon.uf.common.dataplugin.gfe.request.GetSbLockFilesRequest;
import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse;
import com.raytheon.uf.common.serialization.comm.IRequestHandler;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 10, 2011 bphillip Initial creation
*
* </pre>
*
* @author bphillip
* @version 1.0
*/
public class GetSbLockFilesRequestHandler implements
IRequestHandler<GetSbLockFilesRequest> {
@Override
public Object handleRequest(GetSbLockFilesRequest request) throws Exception {
ServerResponse<List<String>> sr = new ServerResponse<List<String>>();
sr.setPayload(ServiceBackupLockManager.getInstance().getLockFiles());
return sr;
}
}

View file

@ -0,0 +1,198 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.edex.plugin.gfe.server.handler.svcbu;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.FileVisitOption;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import com.raytheon.edex.plugin.gfe.svcbackup.SvcBackupUtil;
import com.raytheon.uf.common.dataplugin.gfe.request.GetServiceBackupJobStatusRequest;
import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse;
import com.raytheon.uf.common.dataplugin.gfe.svcbu.JobProgress;
import com.raytheon.uf.common.dataplugin.gfe.svcbu.ServiceBackupJobStatus;
import com.raytheon.uf.common.serialization.comm.IRequestHandler;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
/**
* Request handler for {@code GetServiceBackupJobStatusRequest}. This handler
* will return the current status of service backup for the requested site (or
* alternatively all sites currently in service backup mode) by finding all
* service backup lock files in the file system and getting their internal
* status.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 10, 2011 bphillip Initial creation
* Feb 12, 2015 #4103 dgilling Renamed from GetSbLockFilesRequestHandler,
* rewrite using Java7 nio.
*
* </pre>
*
* @author bphillip
* @version 1.0
*/
public final class GetServiceBackupJobStatusHandler implements
IRequestHandler<GetServiceBackupJobStatusRequest> {
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(GetServiceBackupJobStatusHandler.class);
private static final class ListLockFiles extends SimpleFileVisitor<Path> {
private final Map<String, Collection<ServiceBackupJobStatus>> locksBySite;
private final Collection<Path> requestedLockDirs;
public ListLockFiles(Collection<String> siteIds) {
super();
this.locksBySite = new HashMap<>();
this.requestedLockDirs = new HashSet<>(siteIds.size());
for (String siteId : siteIds) {
this.requestedLockDirs.add(SvcBackupUtil.getLockDir(siteId));
}
}
/*
* (non-Javadoc)
*
* @see java.nio.file.SimpleFileVisitor#visitFile(java.lang.Object,
* java.nio.file.attribute.BasicFileAttributes)
*/
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
throws IOException {
super.visitFile(file, attrs);
String siteId = file.getParent().getFileName().toString()
.toUpperCase();
String lockName = file.getFileName().toString();
Collection<ServiceBackupJobStatus> siteLocks = locksBySite
.get(siteId);
if (siteLocks == null) {
siteLocks = new ArrayList<>();
locksBySite.put(siteId, siteLocks);
}
JobProgress status = getLockStatus(file);
Date lastModifiedTime = new Date(attrs.lastModifiedTime()
.toMillis());
siteLocks.add(new ServiceBackupJobStatus(lockName, status,
lastModifiedTime));
return FileVisitResult.CONTINUE;
}
/*
* (non-Javadoc)
*
* @see
* java.nio.file.SimpleFileVisitor#preVisitDirectory(java.lang.Object,
* java.nio.file.attribute.BasicFileAttributes)
*/
@Override
public FileVisitResult preVisitDirectory(Path dir,
BasicFileAttributes attrs) throws IOException {
super.preVisitDirectory(dir, attrs);
if ((requestedLockDirs.contains(dir))
|| (requestedLockDirs.isEmpty())
|| (dir.equals(SvcBackupUtil.getLockDir()))) {
return FileVisitResult.CONTINUE;
} else {
return FileVisitResult.SKIP_SUBTREE;
}
}
/*
* (non-Javadoc)
*
* @see
* java.nio.file.SimpleFileVisitor#visitFileFailed(java.lang.Object,
* java.io.IOException)
*/
@Override
public FileVisitResult visitFileFailed(Path file, IOException exc)
throws IOException {
statusHandler.error("Unable to read service backup lock file: "
+ file.toString(), exc);
return FileVisitResult.CONTINUE;
}
private JobProgress getLockStatus(final Path lockFile) {
JobProgress retVal = JobProgress.UNKNOWN;
try {
List<String> fileContents = Files.readAllLines(lockFile,
StandardCharsets.US_ASCII);
if (!fileContents.isEmpty()) {
retVal = JobProgress.valueOf(fileContents.get(0).trim());
}
} catch (IOException e) {
statusHandler.error("Unable to read lock status from file ["
+ lockFile.toString() + "].", e);
} catch (IllegalArgumentException e) {
statusHandler.error(
"Invalid status value specified in lock file ["
+ lockFile.toString() + "].", e);
}
return retVal;
}
public Map<String, Collection<ServiceBackupJobStatus>> getLocksBySite() {
return locksBySite;
}
}
@Override
public ServerResponse<Map<String, Collection<ServiceBackupJobStatus>>> handleRequest(
final GetServiceBackupJobStatusRequest request) throws Exception {
ServerResponse<Map<String, Collection<ServiceBackupJobStatus>>> sr = new ServerResponse<>();
sr.setPayload(getLockFiles(request.getRequestedSiteIds()));
return sr;
}
private static Map<String, Collection<ServiceBackupJobStatus>> getLockFiles(
final Collection<String> siteIds) throws IOException {
Path lockDir = SvcBackupUtil.getLockDir();
ListLockFiles lockFileLister = new ListLockFiles(siteIds);
Files.walkFileTree(lockDir, EnumSet.of(FileVisitOption.FOLLOW_LINKS),
2, lockFileLister);
return lockFileLister.getLocksBySite();
}
}

View file

@ -23,11 +23,15 @@ import org.apache.commons.lang.BooleanUtils;
import com.raytheon.edex.plugin.gfe.svcbackup.SvcBackupUtil; import com.raytheon.edex.plugin.gfe.svcbackup.SvcBackupUtil;
import com.raytheon.uf.common.dataplugin.gfe.request.ImportConfRequest; import com.raytheon.uf.common.dataplugin.gfe.request.ImportConfRequest;
import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse; import com.raytheon.uf.common.dataplugin.gfe.svcbu.JobProgress;
import com.raytheon.uf.common.serialization.comm.IRequestHandler; import com.raytheon.uf.common.serialization.comm.IRequestHandler;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
/** /**
* TODO Add Description * Request handler for {@code ImportConfRequest}. Causes an MHS request to be
* sent to have the configuration data for the specified site to be sent to this
* server. Should be used only during service backup mode.
* *
* <pre> * <pre>
* *
@ -38,6 +42,7 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler;
* Aug 04, 2011 bphillip Initial creation * Aug 04, 2011 bphillip Initial creation
* Mar 20, 2013 1447 dgilling Support troubleshooting mode * Mar 20, 2013 1447 dgilling Support troubleshooting mode
* added to match A1 DR 21404. * added to match A1 DR 21404.
* Mar 17, 2015 4103 dgilling Support new Service Backup GUI.
* *
* </pre> * </pre>
* *
@ -45,16 +50,28 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler;
* @version 1.0 * @version 1.0
*/ */
public class ImportConfRequestHandler implements public final class ImportConfRequestHandler implements
IRequestHandler<ImportConfRequest> { IRequestHandler<ImportConfRequest> {
@Override private final IUFStatusHandler statusHandler = UFStatus
public Object handleRequest(ImportConfRequest request) throws Exception { .getHandler(ImportConfRequestHandler.class);
ServerResponse<String> sr = new ServerResponse<String>(); @Override
SvcBackupUtil.execute("request_configuration", request.getPrimarySite() public JobProgress handleRequest(final ImportConfRequest request)
.toLowerCase(), request.getFailedSite().toLowerCase(), Integer throws Exception {
.toString(BooleanUtils.toInteger(request.isTrMode()))); try {
return sr; statusHandler.info("Requesting GFE configuration for site "
+ request.getFailedSite());
SvcBackupUtil.execute("request_configuration", request
.getFailedSite().toLowerCase(), Integer
.toString(BooleanUtils.toInteger(request.isTrMode())));
} catch (Exception e) {
statusHandler.error(
"Error executing request_configuration for site "
+ request.getFailedSite(), e);
return JobProgress.FAILED;
}
return JobProgress.SUCCESS;
} }
} }

View file

@ -21,11 +21,15 @@ package com.raytheon.edex.plugin.gfe.server.handler.svcbu;
import com.raytheon.edex.plugin.gfe.svcbackup.SvcBackupUtil; import com.raytheon.edex.plugin.gfe.svcbackup.SvcBackupUtil;
import com.raytheon.uf.common.dataplugin.gfe.request.ImportDigitalDataRequest; import com.raytheon.uf.common.dataplugin.gfe.request.ImportDigitalDataRequest;
import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse; import com.raytheon.uf.common.dataplugin.gfe.svcbu.JobProgress;
import com.raytheon.uf.common.serialization.comm.IRequestHandler; import com.raytheon.uf.common.serialization.comm.IRequestHandler;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
/** /**
* TODO Add Description * Request handler for {@code ImportDigitalDataRequest}. Causes an MHS request
* to be sent to have the GFE grids for the specified site to be sent to this
* server. Should be used only during service backup mode.
* *
* <pre> * <pre>
* *
@ -33,7 +37,8 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Aug 4, 2011 bphillip Initial creation * Aug 04, 2011 bphillip Initial creation
* Mar 17, 2015 4103 dgilling Support new Service Backup GUI.
* *
* </pre> * </pre>
* *
@ -41,15 +46,26 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler;
* @version 1.0 * @version 1.0
*/ */
public class ImportDigitalDataRequestHandler implements public final class ImportDigitalDataRequestHandler implements
IRequestHandler<ImportDigitalDataRequest> { IRequestHandler<ImportDigitalDataRequest> {
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(ImportDigitalDataRequestHandler.class);
@Override @Override
public Object handleRequest(ImportDigitalDataRequest request) public JobProgress handleRequest(final ImportDigitalDataRequest request)
throws Exception { throws Exception {
ServerResponse<String> sr = new ServerResponse<String>(); try {
SvcBackupUtil.execute("request_grids", request.getPrimarySite() statusHandler.info("Requesting GFE grids for site "
.toLowerCase(), request.getFailedSite().toLowerCase()); + request.getFailedSite());
return sr; SvcBackupUtil.execute("request_grids", request.getFailedSite()
.toLowerCase());
} catch (Exception e) {
statusHandler.error("Error executing request_grids for site "
+ request.getFailedSite(), e);
return JobProgress.FAILED;
}
return JobProgress.SUCCESS;
} }
} }

View file

@ -19,15 +19,20 @@
**/ **/
package com.raytheon.edex.plugin.gfe.server.handler.svcbu; package com.raytheon.edex.plugin.gfe.server.handler.svcbu;
import com.raytheon.edex.plugin.gfe.svcbackup.ServiceBackupNotificationManager;
import com.raytheon.edex.plugin.gfe.svcbackup.SvcBackupUtil; import com.raytheon.edex.plugin.gfe.svcbackup.SvcBackupUtil;
import com.raytheon.edex.site.SiteUtil; import com.raytheon.edex.plugin.gfe.util.SendNotifications;
import com.raytheon.uf.common.dataplugin.gfe.request.ProcessReceivedConfRequest; import com.raytheon.uf.common.dataplugin.gfe.request.ProcessReceivedConfRequest;
import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse; import com.raytheon.uf.common.dataplugin.gfe.server.notify.ServiceBackupJobStatusNotification;
import com.raytheon.uf.common.dataplugin.gfe.svcbu.JobProgress;
import com.raytheon.uf.common.serialization.comm.IRequestHandler; import com.raytheon.uf.common.serialization.comm.IRequestHandler;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
/** /**
* TODO Add Description * Request handler for {@code ProcessReceivedConfRequest}. Triggered when MHS
* sends the requested configuration data from {@code ImportConfRequestHandler}
* to this server. Will call the service backup script process_configuration to
* validate and install the site's configuration data.
* *
* <pre> * <pre>
* *
@ -35,7 +40,8 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Aug 4, 2011 bphillip Initial creation * Aug 04, 2011 bphillip Initial creation
* Feb 13, 2015 #4103 dgilling Pass site id to process_configuration.
* *
* </pre> * </pre>
* *
@ -43,27 +49,34 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler;
* @version 1.0 * @version 1.0
*/ */
public class ProcessReceivedConfRequestHandler implements public final class ProcessReceivedConfRequestHandler implements
IRequestHandler<ProcessReceivedConfRequest> { IRequestHandler<ProcessReceivedConfRequest> {
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(ProcessReceivedConfRequestHandler.class);
@Override @Override
public Object handleRequest(ProcessReceivedConfRequest request) public JobProgress handleRequest(final ProcessReceivedConfRequest request)
throws Exception { throws Exception {
ServerResponse<String> sr = new ServerResponse<String>();
try { try {
SvcBackupUtil.execute("createGFEStartScript", SiteUtil.getSite().toLowerCase());
SvcBackupUtil.execute("process_configuration", SvcBackupUtil.execute("process_configuration",
request.getReceivedConfFile()); request.getReceivedConfFile(), request.getSiteID());
ServiceBackupNotificationManager statusHandler.info("Import Configuration Complete for site "
.sendMessageNotification("Import Configuration Complete!"); + request.getSiteID());
} catch (Exception e) { } catch (Exception e) {
sr.addMessage("Error processing received grids. " statusHandler.error("Error Processing Configuration Data for site "
+ e.getLocalizedMessage()); + request.getSiteID(), e);
ServiceBackupNotificationManager.sendErrorMessageNotification( SendNotifications.send(new ServiceBackupJobStatusNotification(
"Error Processing Configuration Data!", e); "importConfiguration", JobProgress.FAILED, request
.getSiteID()));
return JobProgress.FAILED;
} }
return sr; SendNotifications
} .send(new ServiceBackupJobStatusNotification(
"importConfiguration", JobProgress.SUCCESS, request
.getSiteID()));
return JobProgress.SUCCESS;
}
} }

View file

@ -19,14 +19,20 @@
**/ **/
package com.raytheon.edex.plugin.gfe.server.handler.svcbu; package com.raytheon.edex.plugin.gfe.server.handler.svcbu;
import com.raytheon.edex.plugin.gfe.svcbackup.ServiceBackupNotificationManager;
import com.raytheon.edex.plugin.gfe.svcbackup.SvcBackupUtil; import com.raytheon.edex.plugin.gfe.svcbackup.SvcBackupUtil;
import com.raytheon.edex.plugin.gfe.util.SendNotifications;
import com.raytheon.uf.common.dataplugin.gfe.request.ProcessReceivedDigitalDataRequest; import com.raytheon.uf.common.dataplugin.gfe.request.ProcessReceivedDigitalDataRequest;
import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse; import com.raytheon.uf.common.dataplugin.gfe.server.notify.ServiceBackupJobStatusNotification;
import com.raytheon.uf.common.dataplugin.gfe.svcbu.JobProgress;
import com.raytheon.uf.common.serialization.comm.IRequestHandler; import com.raytheon.uf.common.serialization.comm.IRequestHandler;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
/** /**
* TODO Add Description * Request handler for {@code ProcessReceivedDigitalDataRequest}. Triggered when
* MHS sends the requested GFE grids from
* {@code ImportDigitalDataRequestHandler} to this server. Will call the service
* backup script process_grids to import the site's grids.
* *
* <pre> * <pre>
* *
@ -34,7 +40,8 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Aug 4, 2011 bphillip Initial creation * Aug 04, 2011 bphillip Initial creation
* Feb 13, 2015 #4103 dgilling Pass site id to process_grids.
* *
* </pre> * </pre>
* *
@ -42,26 +49,31 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler;
* @version 1.0 * @version 1.0
*/ */
public class ProcessReceivedDigitalDataRequestHandler implements public final class ProcessReceivedDigitalDataRequestHandler implements
IRequestHandler<ProcessReceivedDigitalDataRequest> { IRequestHandler<ProcessReceivedDigitalDataRequest> {
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(ProcessReceivedDigitalDataRequestHandler.class);
@Override @Override
public Object handleRequest(ProcessReceivedDigitalDataRequest request) public JobProgress handleRequest(
throws Exception { final ProcessReceivedDigitalDataRequest request) throws Exception {
ServerResponse<String> sr = new ServerResponse<String>();
try { try {
SvcBackupUtil.execute("process_grids", SvcBackupUtil.execute("process_grids",
request.getReceivedDataFile()); request.getReceivedDataFile(), request.getSiteID());
ServiceBackupNotificationManager statusHandler.info("Import Data Complete for site "
.sendMessageNotification("Import Data Complete!"); + request.getSiteID());
} catch (Exception e) { } catch (Exception e) {
sr.addMessage("Error processing received grids. " statusHandler.error("Error Processing Digital Data for site "
+ e.getLocalizedMessage()); + request.getSiteID(), e);
ServiceBackupNotificationManager SendNotifications.send(new ServiceBackupJobStatusNotification(
.sendErrorMessageNotification("Error Processing Digital Data!",e); "importGrids", JobProgress.FAILED, request.getSiteID()));
return JobProgress.FAILED;
} }
return sr; SendNotifications.send(new ServiceBackupJobStatusNotification(
} "importGrids", JobProgress.SUCCESS, request.getSiteID()));
return JobProgress.SUCCESS;
}
} }

View file

@ -1,97 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.edex.plugin.gfe.server.handler.svcbu;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import com.raytheon.edex.plugin.gfe.svcbackup.SvcBackupUtil;
import com.raytheon.uf.common.site.notify.ClusterActivationNotification;
import com.raytheon.uf.common.site.notify.SiteActivationNotification;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 10, 2011 bphillip Initial creation
*
* </pre>
*
* @author bphillip
* @version 1.0
*/
public class ServiceBackupLockManager {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(ServiceBackupLockManager.class);
private static ServiceBackupLockManager instance;
private ServiceBackupLockManager() {
}
public static ServiceBackupLockManager getInstance() {
if (instance == null) {
instance = new ServiceBackupLockManager();
}
return instance;
}
public void handleSiteActivationNotification(
SiteActivationNotification notify) {
String site = notify.getModifiedSite();
File waitLockFile = new File(SvcBackupUtil.getLockDir() + "/"
+ site.toLowerCase() + "waitMode");
if ((notify instanceof ClusterActivationNotification)) {
if (notify.isActivation() && waitLockFile.exists()) {
waitLockFile.delete();
}
} else if (notify.isActivation() && notify.isBegin()) {
try {
waitLockFile.createNewFile();
} catch (IOException e) {
statusHandler.error(
"Error creating service backup wait lock file!", e);
}
}
}
public List<String> getLockFiles() {
File lockDir = new File(SvcBackupUtil.getLockDir());
if (lockDir.exists()) {
return Arrays.asList(lockDir.list());
} else {
return Collections.emptyList();
}
}
}

View file

@ -25,6 +25,8 @@ import java.util.TimerTask;
import com.raytheon.edex.plugin.gfe.server.handler.svcbu.ExportGridsRequestHandler; import com.raytheon.edex.plugin.gfe.server.handler.svcbu.ExportGridsRequestHandler;
import com.raytheon.uf.common.dataplugin.gfe.request.ExportGridsRequest; import com.raytheon.uf.common.dataplugin.gfe.request.ExportGridsRequest;
import com.raytheon.uf.common.dataplugin.gfe.request.ExportGridsRequest.ExportGridsMode; import com.raytheon.uf.common.dataplugin.gfe.request.ExportGridsRequest.ExportGridsMode;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
/** /**
* Cron job that exports GFE's primary sites' grids. Primary sites are * Cron job that exports GFE's primary sites' grids. Primary sites are
@ -42,6 +44,7 @@ import com.raytheon.uf.common.dataplugin.gfe.request.ExportGridsRequest.ExportGr
* for from svcbu.properties. * for from svcbu.properties.
* May 02, 2013 #1762 dgilling Move code to read PRIMARY_SITES setting * May 02, 2013 #1762 dgilling Move code to read PRIMARY_SITES setting
* to SvcBackupUtil. * to SvcBackupUtil.
* Mar 17, 2015 #4103 dgilling Stop using ServiceBackupNotificationManager.
* *
* </pre> * </pre>
* *
@ -51,10 +54,12 @@ import com.raytheon.uf.common.dataplugin.gfe.request.ExportGridsRequest.ExportGr
public class ExportGridsTask extends TimerTask { public class ExportGridsTask extends TimerTask {
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(ExportGridsTask.class);
public ExportGridsTask(Date executionTime) { public ExportGridsTask(Date executionTime) {
ServiceBackupNotificationManager statusHandler.info("Export grids cron scheduled for execution at: "
.sendMessageNotification("Export grids cron scheduled for execution at: " + executionTime);
+ executionTime);
} }
/* /*
@ -67,14 +72,14 @@ public class ExportGridsTask extends TimerTask {
final ExportGridsRequestHandler reqHandler = new ExportGridsRequestHandler(); final ExportGridsRequestHandler reqHandler = new ExportGridsRequestHandler();
for (String site : SvcBackupUtil.getPrimarySites()) { for (String site : SvcBackupUtil.getPrimarySites()) {
ServiceBackupNotificationManager statusHandler
.sendMessageNotification("Export Grids to central server cron started for site " .info("Export Grids to central server cron started for site "
+ site + "."); + site + ".");
try { try {
reqHandler.handleRequest(new ExportGridsRequest(site, reqHandler.handleRequest(new ExportGridsRequest(site,
ExportGridsMode.CRON)); ExportGridsMode.CRON));
} catch (Exception e) { } catch (Exception e) {
ServiceBackupNotificationManager.sendErrorMessageNotification( statusHandler.error(
"Export Grids to central server cron failed to execute for site " "Export Grids to central server cron failed to execute for site "
+ site + ".", e); + site + ".", e);
} }

View file

@ -1,73 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.edex.plugin.gfe.svcbackup;
import com.raytheon.edex.plugin.gfe.util.SendNotifications;
import com.raytheon.edex.site.SiteUtil;
import com.raytheon.uf.common.dataplugin.gfe.server.notify.ServiceBackupMessageNotification;
import com.raytheon.uf.common.dataplugin.gfe.server.notify.ServiceBackupProgressNotification;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 4, 2011 bphillip Initial creation
*
* </pre>
*
* @author bphillip
* @version 1.0
*/
public class ServiceBackupNotificationManager {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(ServiceBackupNotificationManager.class);
public static void sendProgressNotification(int progress) {
ServiceBackupProgressNotification notification = new ServiceBackupProgressNotification(
progress);
notification.setSiteID(SiteUtil.getSite());
SendNotifications.send(notification);
}
public static void sendMessageNotification(String message) {
ServiceBackupMessageNotification notification = new ServiceBackupMessageNotification(
message);
notification.setSiteID(SiteUtil.getSite());
SendNotifications.send(notification);
statusHandler.info(message);
}
public static void sendErrorMessageNotification(String message, Exception e) {
ServiceBackupMessageNotification notification = new ServiceBackupMessageNotification(
message + "::" + e.getLocalizedMessage());
notification.setSiteID(SiteUtil.getSite());
SendNotifications.send(notification);
statusHandler.error(message,e);
}
}

View file

@ -20,10 +20,11 @@
package com.raytheon.edex.plugin.gfe.svcbackup; package com.raytheon.edex.plugin.gfe.svcbackup;
import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.HashSet; import java.util.HashSet;
import java.util.Properties; import java.util.Properties;
import java.util.Set; import java.util.Set;
@ -65,6 +66,8 @@ import com.raytheon.uf.edex.site.SiteAwareRegistry;
* sites. * sites.
* May 28, 2014 3211 njensen Use IAuthorizer instead of IRoleStorage * May 28, 2014 3211 njensen Use IAuthorizer instead of IRoleStorage
* Jul 10, 2014 2914 garmendariz Remove EnvProperties * Jul 10, 2014 2914 garmendariz Remove EnvProperties
* Feb 17, 2015 4103 dgilling Add getLockDir for specific site, code
* cleanup.
* *
* </pre> * </pre>
* *
@ -223,40 +226,29 @@ public class SvcBackupUtil {
return svcbuProperties; return svcbuProperties;
} }
public static boolean errorDetected() { /**
File[] fileList = new File(getLockDir()).listFiles(); * Returns the base lock directory for service backup. All site specific
* lock directories will be children to this directory.
for (File file : fileList) { *
if (file.getName().equals("svcbuerr")) { * @return The {@code Path} that represents the base directory for service
return true; * backup locks.
} */
} public static Path getLockDir() {
return false;
}
public static void removeErrorFile() {
File[] fileList = new File(getLockDir()).listFiles();
for (File file : fileList) {
if (file.getName().equals("svcbuerr")) {
file.delete();
}
}
}
public static void removeLocks() {
File[] fileList = new File(getLockDir()).listFiles();
for (File file : fileList) {
file.delete();
}
}
public static String getLockDir() {
String lockDir = SvcBackupUtil.getSvcBackupProperties().getProperty( String lockDir = SvcBackupUtil.getSvcBackupProperties().getProperty(
"LOCK_DIR") "LOCK_DIR");
+ File.separator; return Paths.get(lockDir);
return lockDir; }
/**
* Returns the site-specific lock directory for service backup.
*
* @param siteID
* The 3-character site identifier.
* @return he {@code Path} that represents the site-specific directory for
* service backup locks.
*/
public static Path getLockDir(final String siteID) {
return getLockDir().resolve(siteID.toUpperCase());
} }
public static AuthorizationResponse authorizeWithLocalization(IUser user, public static AuthorizationResponse authorizeWithLocalization(IUser user,

View file

@ -19,14 +19,16 @@
**/ **/
package com.raytheon.edex.plugin.gfe.svcbackup; package com.raytheon.edex.plugin.gfe.svcbackup;
import java.util.Date; import com.raytheon.uf.common.dataplugin.gfe.util.FilePurger;
import java.util.TimerTask; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.edex.plugin.gfe.server.handler.svcbu.CleanupSvcBuLogRequestHandler; import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.common.dataplugin.gfe.request.CleanupSvcBuLogRequest;
/** /**
* TODO Add Description * Bean to purge outdated log files from service backup logs directory. Expected
* to be scheduled by camel using a cron job. Can set the number of days to
* retain logs via the setting purge.svcbu.logs.retention in
* com.raytheon.edex.plugin.gfe.properties.
* *
* <pre> * <pre>
* *
@ -34,38 +36,38 @@ import com.raytheon.uf.common.dataplugin.gfe.request.CleanupSvcBuLogRequest;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jan 3, 2013 jdynina Initial creation * Jan 03, 2013 jdynina Initial creation
* Feb 24, 2015 #4103 dgilling Rewrite to use FilePurger.
* *
* </pre> * </pre>
* *
* @author jdynina * @author jdynina
* @version 1.0 * @version 1.0
*/ */
public final class SvcbuCleanupLogsTask {
public class SvcbuCleanupLogsTask extends TimerTask { private static final String DEFAULT_LOG_DIR = "/awips2/GFESuite/ServiceBackup/logs";
public SvcbuCleanupLogsTask(Date executionTime) { private final IUFStatusHandler statusHandler = UFStatus
ServiceBackupNotificationManager .getHandler(SvcbuCleanupLogsTask.class);
.sendMessageNotification("Service backup log cleanup cron scheduled for execution at: "
+ executionTime); private final FilePurger logPurger;
public SvcbuCleanupLogsTask(int daysToRetain) {
long purgeAge = daysToRetain * TimeUtil.MILLIS_PER_DAY;
String logDirectory = SvcBackupUtil.getSvcBackupProperties()
.getProperty("IFPS_LOG", DEFAULT_LOG_DIR);
this.logPurger = new FilePurger(logDirectory, purgeAge);
} }
/*
* (non-Javadoc)
*
* @see java.util.TimerTask#run()
*/
@Override
public void run() { public void run() {
ServiceBackupNotificationManager statusHandler.info("Cleanup service backup logs cron started.");
.sendMessageNotification("Cleanup service configuration logs cron started.");
try { try {
new CleanupSvcBuLogRequestHandler() logPurger.purge();
.handleRequest(new CleanupSvcBuLogRequest());
} catch (Exception e) { } catch (Exception e) {
ServiceBackupNotificationManager statusHandler
.sendErrorMessageNotification( .error("Cleanup service backup logs cron threw an unhandled exception.",
"Cleanup service backup logs cron failed to execute.",
e); e);
} }
} }

View file

@ -36,6 +36,7 @@ Export-Package: com.raytheon.uf.common.dataplugin.gfe,
com.raytheon.uf.common.dataplugin.gfe.server.notify, com.raytheon.uf.common.dataplugin.gfe.server.notify,
com.raytheon.uf.common.dataplugin.gfe.server.request, com.raytheon.uf.common.dataplugin.gfe.server.request,
com.raytheon.uf.common.dataplugin.gfe.slice, com.raytheon.uf.common.dataplugin.gfe.slice,
com.raytheon.uf.common.dataplugin.gfe.svcbu,
com.raytheon.uf.common.dataplugin.gfe.textproduct, com.raytheon.uf.common.dataplugin.gfe.textproduct,
com.raytheon.uf.common.dataplugin.gfe.time, com.raytheon.uf.common.dataplugin.gfe.time,
com.raytheon.uf.common.dataplugin.gfe.util, com.raytheon.uf.common.dataplugin.gfe.util,

View file

@ -32,6 +32,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Aug 12, 2011 bphillip Initial creation * Aug 12, 2011 bphillip Initial creation
* Feb 13, 2015 #4103 dgilling Force use of site id.
* *
* </pre> * </pre>
* *
@ -48,8 +49,9 @@ public class AbortOperationRequest extends AbstractGfeRequest {
public AbortOperationRequest() { public AbortOperationRequest() {
} }
public AbortOperationRequest(String operation) { public AbortOperationRequest(String operation, String siteID) {
this.operation = operation; this.operation = operation;
this.siteID = siteID;
} }
/** /**

View file

@ -1,48 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.dataplugin.gfe.request;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 3, 2013 jdynina Initial creation
*
* </pre>
*
* @author jdynina
* @version 1.0
*/
@DynamicSerialize
public class CleanupSvcBuLogRequest extends AbstractGfeRequest {
public CleanupSvcBuLogRequest() {
}
}

View file

@ -23,7 +23,9 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/** /**
* TODO Add Description * Request to delete all data for the specified site from the server. This
* includes GFE grids and all localization data. Should only be used when
* exiting service backup mode.
* *
* <pre> * <pre>
* *
@ -32,6 +34,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Aug 10, 2011 bphillip Initial creation * Aug 10, 2011 bphillip Initial creation
* Mar 18, 2015 #4103 dgilling Remove unnecessary primary site field.
* *
* </pre> * </pre>
* *
@ -40,10 +43,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*/ */
@DynamicSerialize @DynamicSerialize
public class CleanupSvcBuRequest extends AbstractGfeRequest { public final class CleanupSvcBuRequest extends AbstractGfeRequest {
@DynamicSerializeElement
private String primarySite;
@DynamicSerializeElement @DynamicSerializeElement
private String failedSite; private String failedSite;
@ -51,25 +51,10 @@ public class CleanupSvcBuRequest extends AbstractGfeRequest {
public CleanupSvcBuRequest() { public CleanupSvcBuRequest() {
} }
public CleanupSvcBuRequest(String primarySite, String failedSite) { public CleanupSvcBuRequest(String failedSite) {
this.primarySite = primarySite;
this.failedSite = failedSite; this.failedSite = failedSite;
} }
/**
* @return the primarySite
*/
public String getPrimarySite() {
return primarySite;
}
/**
* @param primarySite the primarySite to set
*/
public void setPrimarySite(String primarySite) {
this.primarySite = primarySite;
}
/** /**
* @return the failedSite * @return the failedSite
*/ */
@ -78,11 +63,10 @@ public class CleanupSvcBuRequest extends AbstractGfeRequest {
} }
/** /**
* @param failedSite the failedSite to set * @param failedSite
* the failedSite to set
*/ */
public void setFailedSite(String failedSite) { public void setFailedSite(String failedSite) {
this.failedSite = failedSite; this.failedSite = failedSite;
} }
} }

View file

@ -24,7 +24,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/** /**
* TODO Add Description * Request to export the specified site's configuration data and immediately
* send it to the central server.
* *
* <pre> * <pre>
* *

View file

@ -23,7 +23,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/** /**
* TODO Add Description * Request to export the specified failed site's GFE grids and immediately send
* them directly to the failed site.
* *
* <pre> * <pre>
* *
@ -31,7 +32,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Aug 4, 2011 bphillip Initial creation * Aug 04, 2011 bphillip Initial creation
* Mar 18, 2015 #4103 dgilling Remove unnecessary primary site field.
* *
* </pre> * </pre>
* *
@ -40,10 +42,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*/ */
@DynamicSerialize @DynamicSerialize
public class ExportDataToFailedSiteRequest extends AbstractGfeRequest { public final class ExportDataToFailedSiteRequest extends AbstractGfeRequest {
@DynamicSerializeElement
private String primarySite;
@DynamicSerializeElement @DynamicSerializeElement
private String failedSite; private String failedSite;
@ -51,26 +50,10 @@ public class ExportDataToFailedSiteRequest extends AbstractGfeRequest {
public ExportDataToFailedSiteRequest() { public ExportDataToFailedSiteRequest() {
} }
public ExportDataToFailedSiteRequest(String primarySite, String failedSite) { public ExportDataToFailedSiteRequest(String failedSite) {
this.primarySite = primarySite;
this.failedSite = failedSite; this.failedSite = failedSite;
} }
/**
* @return the primarySite
*/
public String getPrimarySite() {
return primarySite;
}
/**
* @param primarySite
* the primarySite to set
*/
public void setPrimarySite(String primarySite) {
this.primarySite = primarySite;
}
/** /**
* @return the failedSite * @return the failedSite
*/ */
@ -85,5 +68,4 @@ public class ExportDataToFailedSiteRequest extends AbstractGfeRequest {
public void setFailedSite(String failedSite) { public void setFailedSite(String failedSite) {
this.failedSite = failedSite; this.failedSite = failedSite;
} }
} }

View file

@ -23,7 +23,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/** /**
* TODO Add Description * Request to export the specified failed site's GFE grids and immediately send
* them to the central server.
* *
* <pre> * <pre>
* *
@ -31,7 +32,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Aug 4, 2011 bphillip Initial creation * Aug 04, 2011 bphillip Initial creation
* Mar 18, 2015 #4103 dgilling Remove unnecessary primary site field.
* *
* </pre> * </pre>
* *
@ -39,10 +41,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* @version 1.0 * @version 1.0
*/ */
@DynamicSerialize @DynamicSerialize
public class ExportFailedSiteDataToCCRequest extends AbstractGfeRequest { public final class ExportFailedSiteDataToCCRequest extends AbstractGfeRequest {
@DynamicSerializeElement
private String primarySite;
@DynamicSerializeElement @DynamicSerializeElement
private String failedSite; private String failedSite;
@ -50,26 +49,10 @@ public class ExportFailedSiteDataToCCRequest extends AbstractGfeRequest {
public ExportFailedSiteDataToCCRequest() { public ExportFailedSiteDataToCCRequest() {
} }
public ExportFailedSiteDataToCCRequest(String primarySite, String failedSite) { public ExportFailedSiteDataToCCRequest(String failedSite) {
this.primarySite = primarySite;
this.failedSite = failedSite; this.failedSite = failedSite;
} }
/**
* @return the primarySite
*/
public String getPrimarySite() {
return primarySite;
}
/**
* @param primarySite
* the primarySite to set
*/
public void setPrimarySite(String primarySite) {
this.primarySite = primarySite;
}
/** /**
* @return the failedSite * @return the failedSite
*/ */

View file

@ -23,7 +23,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/** /**
* TODO Add Description * Request to export the specified site's GFE grids for the central server's
* rsync process to download.
* *
* <pre> * <pre>
* *

View file

@ -23,7 +23,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/** /**
* TODO Add Description * Request to get the startup command for GFE for the specified site.
* *
* <pre> * <pre>
* *

View file

@ -19,11 +19,19 @@
**/ **/
package com.raytheon.uf.common.dataplugin.gfe.request; package com.raytheon.uf.common.dataplugin.gfe.request;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.common.serialization.comm.IServerRequest;
/** /**
* TODO Add Description * Request to get service backup status by job/task for the specified site. If
* no site is specified, status for all sites currently in service backup mode
* are returned.
* *
* <pre> * <pre>
* *
@ -31,32 +39,36 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Oct 26, 2010 dgilling Initial creation * Aug 10, 2011 bphillip Initial creation
* Feb 24, 2015 #4103 dgilling Allow requestor to specify site IDs.
* *
* </pre> * </pre>
* *
* @author dgilling * @author bphillip
* @version 1.0 * @version 1.0
*/ */
@DynamicSerialize @DynamicSerialize
public class ServiceBackupStatusUpdateRequest extends AbstractGfeRequest { public class GetServiceBackupJobStatusRequest implements IServerRequest {
@DynamicSerializeElement @DynamicSerializeElement
private String statusMessage; private Collection<String> requestedSiteIds;
/** public GetServiceBackupJobStatusRequest() {
* @param statusMessage this.requestedSiteIds = Collections.emptyList();
* the statusMessage to set
*/
public void setStatusMessage(String statusMessage) {
this.statusMessage = statusMessage;
} }
/** public GetServiceBackupJobStatusRequest(String siteId,
* @return the statusMessage String... moreSiteIds) {
*/ this.requestedSiteIds = new HashSet<>(Arrays.asList(moreSiteIds));
public String getStatusMessage() { this.requestedSiteIds.add(siteId);
return statusMessage; }
public Collection<String> getRequestedSiteIds() {
return requestedSiteIds;
}
public void setRequestedSiteIds(Collection<String> requestedSiteIds) {
this.requestedSiteIds = requestedSiteIds;
} }
} }

View file

@ -23,7 +23,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/** /**
* TODO Add Description * Request to request a failed site's configuration data via the MHS.
* *
* <pre> * <pre>
* *
@ -34,6 +34,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* Aug 04, 2011 bphillip Initial creation * Aug 04, 2011 bphillip Initial creation
* Mar 20, 2013 1447 dgilling Add support for service backup * Mar 20, 2013 1447 dgilling Add support for service backup
* troubleshooting mode from A1. * troubleshooting mode from A1.
* Mar 18, 2015 #4103 dgilling Remove unnecessary primary site field.
* *
* </pre> * </pre>
* *
@ -42,10 +43,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*/ */
@DynamicSerialize @DynamicSerialize
public class ImportConfRequest extends AbstractGfeRequest { public final class ImportConfRequest extends AbstractGfeRequest {
@DynamicSerializeElement
private String primarySite;
@DynamicSerializeElement @DynamicSerializeElement
private String failedSite; private String failedSite;
@ -57,28 +55,11 @@ public class ImportConfRequest extends AbstractGfeRequest {
} }
public ImportConfRequest(String primarySite, String failedSite, public ImportConfRequest(String failedSite, boolean trMode) {
boolean trMode) {
this.primarySite = primarySite;
this.failedSite = failedSite; this.failedSite = failedSite;
this.trMode = trMode; this.trMode = trMode;
} }
/**
* @return the primarySite
*/
public String getPrimarySite() {
return primarySite;
}
/**
* @param primarySite
* the primarySite to set
*/
public void setPrimarySite(String primarySite) {
this.primarySite = primarySite;
}
/** /**
* @return the failedSite * @return the failedSite
*/ */
@ -101,5 +82,4 @@ public class ImportConfRequest extends AbstractGfeRequest {
public boolean isTrMode() { public boolean isTrMode() {
return trMode; return trMode;
} }
} }

View file

@ -23,7 +23,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/** /**
* TODO Add Description * Request to request a failed site's GFE grids via the MHS.
* *
* <pre> * <pre>
* *
@ -31,7 +31,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Aug 4, 2011 bphillip Initial creation * Aug 04, 2011 bphillip Initial creation
* Mar 18, 2015 #4103 dgilling Remove unnecessary primary site field.
* *
* </pre> * </pre>
* *
@ -40,9 +41,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*/ */
@DynamicSerialize @DynamicSerialize
public class ImportDigitalDataRequest extends AbstractGfeRequest { public final class ImportDigitalDataRequest extends AbstractGfeRequest {
@DynamicSerializeElement
private String primarySite;
@DynamicSerializeElement @DynamicSerializeElement
private String failedSite; private String failedSite;
@ -51,26 +50,10 @@ public class ImportDigitalDataRequest extends AbstractGfeRequest {
} }
public ImportDigitalDataRequest(String primarySite, String failedSite) { public ImportDigitalDataRequest(String failedSite) {
this.primarySite = primarySite;
this.failedSite = failedSite; this.failedSite = failedSite;
} }
/**
* @return the primarySite
*/
public String getPrimarySite() {
return primarySite;
}
/**
* @param primarySite
* the primarySite to set
*/
public void setPrimarySite(String primarySite) {
this.primarySite = primarySite;
}
/** /**
* @return the failedSite * @return the failedSite
*/ */

View file

@ -23,7 +23,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/** /**
* TODO Add Description * Request to import the specified failed site's configuration data for service
* backup mode.
* *
* <pre> * <pre>
* *

View file

@ -23,7 +23,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/** /**
* TODO Add Description * Request to import the specified failed site's GFE grids for service backup
* mode.
* *
* <pre> * <pre>
* *

View file

@ -0,0 +1,92 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.dataplugin.gfe.server.notify;
import com.raytheon.uf.common.dataplugin.gfe.svcbu.JobProgress;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
* A {@code GfeNotification} for reporting status of asynchronous jobs utilized
* during the service backup process.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 17, 2015 #4103 dgilling Initial creation
*
* </pre>
*
* @author dgilling
* @version 1.0
*/
@DynamicSerialize
public class ServiceBackupJobStatusNotification extends GfeNotification {
@DynamicSerializeElement
private String name;
@DynamicSerializeElement
private JobProgress state;
/**
* Default constructor--should only be used by DynamicSerialize.
*/
public ServiceBackupJobStatusNotification() {
super();
}
/**
* Construct a new notification.
*
* @param name
* The name of the job to report status for.
* @param state
* A {@code JobProgress} instance containing the state of the
* job.
* @param siteId
* The site identifier for the site the job was running for.
*/
public ServiceBackupJobStatusNotification(String name, JobProgress state,
String siteId) {
super(siteId);
this.name = name;
this.state = state;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public JobProgress getState() {
return state;
}
public void setState(JobProgress state) {
this.state = state;
}
}

View file

@ -1,72 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.dataplugin.gfe.server.notify;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 4, 2011 bphillip Initial creation
*
* </pre>
*
* @author bphillip
* @version 1.0
*/
@DynamicSerialize
public class ServiceBackupMessageNotification extends GfeNotification implements
ISerializableObject {
@DynamicSerializeElement
private String message;
public ServiceBackupMessageNotification(){
}
public ServiceBackupMessageNotification(String message) {
this.message = message;
}
/**
* @return the message
*/
public String getMessage() {
return message;
}
/**
* @param message
* the message to set
*/
public void setMessage(String message) {
this.message = message;
}
}

View file

@ -1,73 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.dataplugin.gfe.server.notify;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 4, 2011 bphillip Initial creation
*
* </pre>
*
* @author bphillip
* @version 1.0
*/
@DynamicSerialize
public class ServiceBackupProgressNotification extends GfeNotification
implements ISerializableObject {
@DynamicSerializeElement
private int progress;
public ServiceBackupProgressNotification(){
}
public ServiceBackupProgressNotification(int progress) {
this.progress = progress;
}
/**
* @return the progress
*/
public int getProgress() {
return progress;
}
/**
* @param progress
* the progress to set
*/
public void setProgress(int progress) {
this.progress = progress;
}
}

View file

@ -17,12 +17,10 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * further licensing information.
**/ **/
package com.raytheon.uf.common.dataplugin.gfe.request; package com.raytheon.uf.common.dataplugin.gfe.svcbu;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
/** /**
* TODO Add Description * Enum that represents the different states of a service backup operation.
* *
* <pre> * <pre>
* *
@ -30,18 +28,15 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Aug 10, 2011 bphillip Initial creation * Feb 24, 2015 #4103 dgilling Initial creation
* *
* </pre> * </pre>
* *
* @author bphillip * @author dgilling
* @version 1.0 * @version 1.0
*/ */
@DynamicSerialize public enum JobProgress {
public class GetSbLockFilesRequest extends AbstractGfeRequest {
public GetSbLockFilesRequest() {
}
UNKNOWN, IN_PROGRESS, SUCCESS, FAILED;
} }

View file

@ -0,0 +1,101 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.dataplugin.gfe.svcbu;
import java.util.Date;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
* Object used to show state of a current service backup operation. Presents
* both the name and the progress of the operation.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 24, 2015 #4103 dgilling Initial creation
*
* </pre>
*
* @author dgilling
* @version 1.0
*/
@DynamicSerialize
public class ServiceBackupJobStatus {
@DynamicSerializeElement
private String jobName;
@DynamicSerializeElement
private JobProgress jobStatus;
@DynamicSerializeElement
private Date timeStamp;
public ServiceBackupJobStatus() {
// no-op
}
public ServiceBackupJobStatus(String jobName, JobProgress jobStatus,
Date date) {
this.jobName = jobName;
this.jobStatus = jobStatus;
this.timeStamp = date;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "ServiceBackupJobStatus [jobName=" + jobName + ", jobStatus="
+ jobStatus + ", timeStamp=" + timeStamp + "]";
}
public String getJobName() {
return jobName;
}
public void setJobName(String jobName) {
this.jobName = jobName;
}
public JobProgress getJobStatus() {
return jobStatus;
}
public void setJobStatus(JobProgress jobStatus) {
this.jobStatus = jobStatus;
}
public Date getTimeStamp() {
return timeStamp;
}
public void setTimeStamp(Date timeStamp) {
this.timeStamp = timeStamp;
}
}

View file

@ -1,85 +1,124 @@
#!/bin/bash #!/bin/bash
##
# This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
#
# U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination
# to non-U.S. persons whether in the United States or abroad requires
# an export license or other authorization.
#
# Contractor Name: Raytheon Company
# Contractor Address: 6825 Pine Street, Suite 340
# Mail Stop B8
# Omaha, NE 68106
# 402.291.0100
#
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information.
#
##
##
#
# SOFTWARE HISTORY
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# Feb 09, 2015 #4103 dgilling Cleans up lock files, refactored to
# support multiple svcbu sites.
#
##
if [ ${#AWIPS_HOME} = 0 ] if [ ${#AWIPS_HOME} = 0 ]
then then
path_to_script=`readlink -f $0` path_to_script=`readlink -f $0`
export AWIPS_HOME=$(dirname $(dirname $(dirname $(dirname $path_to_script)))) export AWIPS_HOME=$(dirname $(dirname $(dirname $(dirname $path_to_script))))
fi fi
# $1 = Primary site if [ $# -ne 1 ]
# $2 = Failed site
CAPS_FAILED_SITE=`echo ${2} | tr [a-z] [A-Z]`
. ${AWIPS_HOME}/GFESuite/ServiceBackup/configuration/svcbu.env
if [ $# -ne 2 ]
then then
log_msg "Incorrect number of arguments. Correct usage: cleanup_svcbk primary_site failed_site" echo "Incorrect number of arguments. Correct usage: cleanup_svcbk failed_site"
exit 1 exit 1
fi fi
# $1 = Failed site
CAPS_FAILED_SITE=`echo ${1} | tr [a-z] [A-Z]`
. ${AWIPS_HOME}/GFESuite/ServiceBackup/configuration/svcbu.env
source ${AWIPS_HOME}/GFESuite/ServiceBackup/scripts/serviceBackupUtil.sh
configureLogging "svcbu_cleanup_svcbk" ${CAPS_FAILED_SITE}
# #
#-- If the SVCBU_HOME directory exists, delete the contents of it #-- Remove the locks directory
# #
if [ -d $SVCBU_HOME ];then LOCK_DIR=$(getLockFile "" ${CAPS_FAILED_SITE})
echo "Removing the contents of $SVCBU_HOME" if [ -d ${LOCK_DIR} ];then
echo ${SVCBU_HOME}/* | xargs rm -rf echo "Removing the contents of ${LOCK_DIR}"
rm -rf ${LOCK_DIR}
fi
#
#-- If the site's temporary working directory exists, delete the contents of it
#
SCRATCH_AREA=$(getTempDirectory "" ${CAPS_FAILED_SITE})
if [ -d ${SCRATCH_AREA} ];then
echo "Removing the contents of ${SCRATCH_AREA}"
rm -rf ${SCRATCH_AREA}
fi fi
# DR 16362 # DR 16362
if [ -d ${LOCALIZATION_PATH}/common_static/site/${CAPS_FAILED_SITE}/gfe ]; then if [ -d ${LOCALIZATION_PATH}/common_static/site/${CAPS_FAILED_SITE}/gfe ]; then
log_msg "Removing common site configuration for site ${CAPS_FAILED_SITE}" echo "Removing common site configuration for site ${CAPS_FAILED_SITE}"
rm -fr ${LOCALIZATION_PATH}/common_static/site/${CAPS_FAILED_SITE}/gfe rm -fr ${LOCALIZATION_PATH}/common_static/site/${CAPS_FAILED_SITE}/gfe
fi fi
if [ -d ${LOCALIZATION_PATH}/common_static/site/${CAPS_FAILED_SITE}/vtec ]; then if [ -d ${LOCALIZATION_PATH}/common_static/site/${CAPS_FAILED_SITE}/vtec ]; then
log_msg "Removing common site vtec configuration for site ${CAPS_FAILED_SITE}" echo "Removing common site vtec configuration for site ${CAPS_FAILED_SITE}"
rm -fr ${LOCALIZATION_PATH}/common_static/site/${CAPS_FAILED_SITE}/vtec rm -fr ${LOCALIZATION_PATH}/common_static/site/${CAPS_FAILED_SITE}/vtec
fi fi
if [ -d ${LOCALIZATION_PATH}/edex_static/site/${CAPS_FAILED_SITE}/config/gfe ]; then if [ -d ${LOCALIZATION_PATH}/edex_static/site/${CAPS_FAILED_SITE}/config/gfe ]; then
log_msg "Removing edex site configuration for site ${CAPS_FAILED_SITE}" echo "Removing edex site configuration for site ${CAPS_FAILED_SITE}"
rm -fr ${LOCALIZATION_PATH}/edex_static/site/${CAPS_FAILED_SITE}/config/gfe rm -fr ${LOCALIZATION_PATH}/edex_static/site/${CAPS_FAILED_SITE}/config/gfe
fi fi
if [ -d ${LOCALIZATION_PATH}/edex_static/site/${CAPS_FAILED_SITE}/smartinit ]; then if [ -d ${LOCALIZATION_PATH}/edex_static/site/${CAPS_FAILED_SITE}/smartinit ]; then
log_msg "Removing edex smartinit for site ${CAPS_FAILED_SITE}" echo "Removing edex smartinit for site ${CAPS_FAILED_SITE}"
rm -fr ${LOCALIZATION_PATH}/edex_static/site/${CAPS_FAILED_SITE}/smartinit rm -fr ${LOCALIZATION_PATH}/edex_static/site/${CAPS_FAILED_SITE}/smartinit
fi fi
if [ -d ${LOCALIZATION_PATH}/cave_static/site/${CAPS_FAILED_SITE}/gfe ]; then if [ -d ${LOCALIZATION_PATH}/cave_static/site/${CAPS_FAILED_SITE}/gfe ]; then
log_msg "Removing cave site configuration for site ${CAPS_FAILED_SITE}" echo "Removing cave site configuration for site ${CAPS_FAILED_SITE}"
rm -fr ${LOCALIZATION_PATH}/cave_static/site/${CAPS_FAILED_SITE}/gfe rm -fr ${LOCALIZATION_PATH}/cave_static/site/${CAPS_FAILED_SITE}/gfe
fi fi
if [ -d ${LOCALIZATION_PATH}/cave_static/site/${CAPS_FAILED_SITE}/bundles/maps ]; then if [ -d ${LOCALIZATION_PATH}/cave_static/site/${CAPS_FAILED_SITE}/bundles/maps ]; then
log_msg "Removing cave site maps configuration for site ${CAPS_FAILED_SITE}" echo "Removing cave site maps configuration for site ${CAPS_FAILED_SITE}"
rm -fr ${LOCALIZATION_PATH}/cave_static/site/${CAPS_FAILED_SITE}/bundles/maps rm -fr ${LOCALIZATION_PATH}/cave_static/site/${CAPS_FAILED_SITE}/bundles/maps
fi fi
if [ -d ${LOCALIZATION_PATH}/cave_static/site/${CAPS_FAILED_SITE}/colormaps ]; then if [ -d ${LOCALIZATION_PATH}/cave_static/site/${CAPS_FAILED_SITE}/colormaps ]; then
log_msg "Removing cave site colormaps configuration for site ${CAPS_FAILED_SITE}" echo "Removing cave site colormaps configuration for site ${CAPS_FAILED_SITE}"
rm -fr ${LOCALIZATION_PATH}/cave_static/site/${CAPS_FAILED_SITE}/colormaps rm -fr ${LOCALIZATION_PATH}/common_static/site/${CAPS_FAILED_SITE}/colormaps
fi fi
# end DR 16362 # end DR 16362
# DR 16464 # DR 16464
if [ -d /awips2/GFESuite/ServiceBackup/data/${CAPS_FAILED_SITE} ]; then if [ -d /awips2/GFESuite/ServiceBackup/data/${CAPS_FAILED_SITE} ]; then
log_msg "Removing rsync_parms.site for site ${CAPS_FAILED_SITE}" echo "Removing rsync_parms.site for site ${CAPS_FAILED_SITE}"
rm -f /awips2/GFESuite/ServiceBackup/data/rsync_parms.${CAPS_FAILED_SITE} rm -f /awips2/GFESuite/ServiceBackup/data/rsync_parms.${CAPS_FAILED_SITE}
fi fi
# end DR 16464 # end DR 16464
#-- Remove the rsync grids #-- Remove the rsync grids
if [ "$CAPS_FAILED_SITE" = "aer" ] NETCDF_PATH=${GFESUITE_HOME}/exportgrids/backup
then if [ -f ${NETCDF_PATH}/${2}Grd.netcdf ]
NETCDF_PATH=${GFESUITE_HOME}/exportgrids2
else
NETCDF_PATH=${GFESUITE_HOME}/exportgrids
fi
if [ -e ${NETCDF_PATH}/${2}Grd.netcdf ]
then then
mv ${NETCDF_PATH}/${2}Grd.netcdf ${NETCDF_PATH}/${2}Grd.netcdf.rm mv ${NETCDF_PATH}/${2}Grd.netcdf ${NETCDF_PATH}/${2}Grd.netcdf.rm
rm ${NETCDF_PATH}/${2}Grd.netcdf.rm rm -f ${NETCDF_PATH}/${2}Grd.netcdf.rm
fi fi

View file

@ -1,20 +0,0 @@
#!/bin/bash
if [ ${#AWIPS_HOME} = 0 ]
then
path_to_script=`readlink -f $0`
export AWIPS_HOME=$(dirname $(dirname $(dirname $(dirname $path_to_script))))
fi
. ${AWIPS_HOME}/GFESuite/ServiceBackup/configuration/svcbu.env
if [ ${#IFPS_LOG} = 0 ]
then
echo "ERROR: environment variable IFPS_LOG is undfined, exit."
exit 1
fi
find ${IFPS_LOG}/* -mtime +7 -exec rm -fr {} \; 2>/dev/null

View file

@ -1,81 +0,0 @@
#!/bin/bash
##
# This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
#
# U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination
# to non-U.S. persons whether in the United States or abroad requires
# an export license or other authorization.
#
# Contractor Name: Raytheon Company
# Contractor Address: 6825 Pine Street, Suite 340
# Mail Stop B8
# Omaha, NE 68106
# 402.291.0100
#
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information.
##
##############################################################################
# Create GFE Start Script
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 03/20/14 #2933 randerso Fixed for Dual Domain
##############################################################################
if [ ${#AWIPS_HOME} = 0 ]
then
path_to_script=`readlink -f $0`
export AWIPS_HOME=$(dirname $(dirname $(dirname $(dirname $path_to_script))))
fi
# $1=failed site
SITE_CAPS=`echo ${1}|tr [a-z] [A-Z]`
. ${AWIPS_HOME}/GFESuite/ServiceBackup/configuration/svcbu.env
# Create the log file
logdir=${IFPS_LOG}/`date +%Y%m%d`
logfil=svcbu_createGFEStartScript`date +%H%M`
logfile=${logdir}/${logfil}
[ ! -d ${logdir} ] && (umask 000;mkdir ${logdir})
touch ${logdir}/${logfil}
exec 1>${logdir}/${logfil} 2>&1
LAUNCH_SCRIPT=${AWIPS_HOME}/GFESuite/ServiceBackup/.launch_cave.sh
log_msg "Creating GFE launch script for ${SITE_CAPS} at ${LAUNCH_SCRIPT}"
log_msg "CAVE location: ${CAVE_LAUNCH_SCRIPT}"
if [ $SVCBU_USER -eq 1 ] && [ "$SVCBU_USER_ID" = "" ]; then
log_msg "You do not have a user id configured for ServiceBackup"
log_msg "GFE will start with your regular user id"
fi
echo "#!/bin/bash">${LAUNCH_SCRIPT}
if [ $SVCBU_USER -eq 1 ] && [ "$SVCBU_USER_ID" != "" ]; then
echo "${CAVE_LAUNCH_SCRIPT} -site ${SITE_CAPS} -u $SVCBU_USER_ID -perspective GFE -server ec:9581/services" >> ${LAUNCH_SCRIPT}
else
echo "${CAVE_LAUNCH_SCRIPT} -site ${SITE_CAPS} -perspective GFE -server ec:9581/services" >> ${LAUNCH_SCRIPT}
fi
chmod +x ${LAUNCH_SCRIPT}
if [ -z $PRIMARY_SITES ]
then
LOCAL_SITE=${AW_SITE_IDENTIFIER}
else
IFS=','
site_list=($PRIMARY_SITES)
LOCAL_SITE=${site_list[0]}
fi
SITE_LOWER=`echo ${LOCAL_SITE}|tr [a-z] [A-Z]`
echo $SITE_LOWER > $SCRIPTS_DIR/siteID.txt
log_msg "GFE launch script created for ${SITE_CAPS}"

View file

@ -1,18 +0,0 @@
#!/bin/bash
if [ ${#AWIPS_HOME} = 0 ]
then
path_to_script=`readlink -f $0`
export AWIPS_HOME=$(dirname $(dirname $(dirname $(dirname $path_to_script))))
fi
. ${AWIPS_HOME}/GFESuite/ServiceBackup/configuration/svcbu.env
function is_number() {
printf "%d" $@ > /dev/null 2>&1
return $?
}
if ! is_number $@; then
echo "$@"
fi

View file

@ -1,42 +1,71 @@
#!/bin/bash #!/bin/bash
##
# This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
#
# U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination
# to non-U.S. persons whether in the United States or abroad requires
# an export license or other authorization.
#
# Contractor Name: Raytheon Company
# Contractor Address: 6825 Pine Street, Suite 340
# Mail Stop B8
# Omaha, NE 68106
# 402.291.0100
#
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information.
#
##
##
#
# SOFTWARE HISTORY
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# Feb 09, 2015 #4103 dgilling Refactored to support multiple svcbu
# sites.
#
##
if [ ${#AWIPS_HOME} = 0 ] if [ ${#AWIPS_HOME} = 0 ]
then then
path_to_script=`readlink -f $0` path_to_script=`readlink -f $0`
export AWIPS_HOME=$(dirname $(dirname $(dirname $(dirname $path_to_script)))) export AWIPS_HOME=$(dirname $(dirname $(dirname $(dirname $path_to_script))))
fi fi
# $1 = Primary Site name
# $2 = Failed Site Name
if [ $# -ne 2 ] # $1 = Failed Site Name
if [ $# -ne 1 ]
then then
log_msg "Incorrect number of arguments\nCorrect usage: export_bksite_grids primary_wfo failed_wfo" echo "Incorrect number of arguments\nCorrect usage: export_bksite_grids failed_wfo"
exit 1 exit 1
fi fi
. ${AWIPS_HOME}/GFESuite/ServiceBackup/configuration/svcbu.env . ${AWIPS_HOME}/GFESuite/ServiceBackup/configuration/svcbu.env
source ${AWIPS_HOME}/GFESuite/ServiceBackup/scripts/serviceBackupUtil.sh
PRIMARY_SITE=`echo ${1} | tr '[A-Z]' '[a-z]'` FAILED_SITE=`echo ${1} | tr '[A-Z]' '[a-z]'`
PRIMARY_CAPS_SITE=`echo ${1} | tr [a-z] [A-Z]` FAILED_CAPS_SITE=`echo ${1} | tr [a-z] [A-Z]`
FAILED_SITE=`echo ${2} | tr '[A-Z]' '[a-z]'`
FAILED_CAPS_SITE=`echo ${2} | tr [a-z] [A-Z]`
# Create the log file # Create the log file
logdir=${IFPS_LOG}/`date +%Y%m%d` configureLogging "svcbu_export_bksite_grids_central_server" ${FAILED_SITE}
logfil=svcbu_export_bksite_grids_`date +%H%M`
logfile=${logdir}/${logfil}
[ ! -d ${logdir} ] && (umask 000;mkdir ${logdir})
touch ${logdir}/${logfil}
exec 1>${logdir}/${logfil} 2>&1
# Check the status of the lock file to see if we are OK to proceed # Check the status of the lock file to see if we are OK to proceed.
if [ -f ${LOCK_DIR}/${FAILED_SITE}exportBksiteGridsCS ]; lock_file=$(getLockFile "exportBksiteGridsCS" ${FAILED_SITE})
lock_status=$(isOperationInProgress "exportBksiteGridsCS" ${FAILED_SITE})
if [[ "${lock_status}" = "true" ]]
then then
log_msg Cannot export grids for ${FAILED_CAPS_SITE}. Export grids process already in progress! echo "Cannot export grids for ${FAILED_CAPS_SITE}. Export grids process already in progress!"
exit 1 exit 1
fi fi
touch ${LOCK_DIR}/${FAILED_SITE}exportBksiteGridsCS echo "IN_PROGRESS" > ${lock_file}
# #
# If this is a non-wfo/non-rfc site, they may not have an edit area for clipping - handle it # If this is a non-wfo/non-rfc site, they may not have an edit area for clipping - handle it
@ -47,72 +76,70 @@ else
SVCBU_MASK="-m $SVCBU_GRIDAREA" SVCBU_MASK="-m $SVCBU_GRIDAREA"
fi fi
log_msg "Exporting $FAILED_CAPS_SITE grids to central server" echo "Exporting $FAILED_CAPS_SITE grids to central server"
log_msg 0
OUTPUT_DIR=$(getTempDirectory "export_bksite_grids" ${FAILED_SITE})
#Starting ifpnetCDF to pack the grids #Starting ifpnetCDF to pack the grids
log_msg "Running ifpnetCDF..." echo "Running ifpnetCDF...(May take awhile)"
log_msg 25 echo "${GFESUITE_BIN}/ifpnetCDF -o ${OUTPUT_DIR}/${FAILED_SITE}Grd.netcdf -h $SVCBU_HOST -r $CDSPORT -d ${FAILED_CAPS_SITE}_GRID__Official_00000000_0000 -k -t -c ${SVCBU_MASK}"
log_msg "Running ifpnetCDF...(May take awhile)" ${GFESUITE_BIN}/ifpnetCDF -o ${OUTPUT_DIR}/${FAILED_SITE}Grd.netcdf -h $SVCBU_HOST -r $CDSPORT -d ${FAILED_CAPS_SITE}_GRID__Official_00000000_0000 -k -t -c ${SVCBU_MASK}
log_msg "${GFESUITE_BIN}/ifpnetCDF -o ${logdir}/${FAILED_SITE}Grd.netcdf -h $SVCBU_HOST -r $CDSPORT -d ${FAILED_CAPS_SITE}_GRID__Official_00000000_0000 -k -t -c ${SVCBU_MASK}"
${GFESUITE_BIN}/ifpnetCDF -o ${logdir}/${FAILED_SITE}Grd.netcdf -h $SVCBU_HOST -r $CDSPORT -d ${FAILED_CAPS_SITE}_GRID__Official_00000000_0000 -k -t -c ${SVCBU_MASK}
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
log_msg "ifpnetCDF process failed to create grids to send to the central server. Exiting..." echo "ifpnetCDF process failed to create grids to send to the central server. Exiting..."
log_msg "ERROR: ifpnetCDF failed..." echo "ERROR: ifpnetCDF failed..."
rm -f ${LOCK_DIR}/${FAILED_SITE}exportBksiteGridsCS ${logdir}/${FAILED_SITE}Grd.netcdf* echo "FAILED" > ${lock_file}
rm -f ${OUTPUT_DIR}/${FAILED_SITE}Grd.netcdf*
exit 1 exit 1
fi fi
# Store the site-id in siteID.txt file to get tarred. # Store the site-id in siteID.txt file to get tarred.
echo $FAILED_SITE > ${logdir}/siteID.txt echo $FAILED_SITE > ${OUTPUT_DIR}/siteID.txt
# Switch to log directory to tarup the file. # Switch to log directory to tarup the file.
cd $logdir cd ${OUTPUT_DIR}
#tar the netcdf file again to preserve the file name so that when importing #tar the netcdf file again to preserve the file name so that when importing
#we can retrieve the site id from the file name #we can retrieve the site id from the file name
tar cvf ${FAILED_SITE}Grd.netcdf.tar ${FAILED_SITE}Grd.netcdf.gz siteID.txt tar cvf ${FAILED_SITE}Grd.netcdf.tar ${FAILED_SITE}Grd.netcdf.gz siteID.txt
log_msg "Preparing package for msg_send..." echo "Preparing package for msg_send..."
log_msg 60
#form the subject line for msg_send which uses it as the file name in the central server #form the subject line for msg_send which uses it as the file name in the central server
#h_mach=`hostname|cut -d- -f2` #h_mach=`hostname|cut -d- -f2`
subj=${FAILED_SITE}Grd subj=${FAILED_SITE}Grd
log_msg "The subject line of msg_send is $subj" echo "The subject line of msg_send is $subj"
# #
#calling msg_send to send the data to the central server #calling msg_send to send the data to the central server
log_msg "Sending the gridded data to the central server..." echo "Sending the gridded data to the central server..."
log_msg 90
log_msg "Sending the gridded data to the central server..."
# We need to add another -c command in message handling system. # We need to add another -c command in message handling system.
# Send the grids to the central server # Send the grids to the central server
# If we find a valid WMO Header, then add -i argument to msg_send call. # If we find a valid WMO Header, then add -i argument to msg_send call.
# Otherwise, don't add it. # Otherwise, don't add it.
if [ -n "${SVCBU_WMO_HEADER}" ]; then if [ -n "${SVCBU_WMO_HEADER}" ]; then
msgSendOutput=$($MSG_SEND_COMMAND -e ${logdir}/${FAILED_SITE}Grd.netcdf.tar -a ${SVCBU_ADDRESSEE} -i ${SVCBU_WMO_HEADER} -s $subj -c 20) msgSendOutput=$($MSG_SEND_COMMAND -e ${OUTPUT_DIR}/${FAILED_SITE}Grd.netcdf.tar -a ${SVCBU_ADDRESSEE} -i ${SVCBU_WMO_HEADER} -s $subj -c 20)
exitValue=$? exitValue=$?
if [ $exitValue -ne 0 ] if [ $exitValue -ne 0 ]
then then
log_msg "msg_send has failed to send ${logdir}/${FAILED_SITE}Grd.netcdf.tar" echo "msg_send has failed to send ${OUTPUT_DIR}/${FAILED_SITE}Grd.netcdf.tar"
log_msg "msg_send FAILED with exit value $exitValue and the following error: $msgSendOutput" echo "msg_send FAILED with exit value $exitValue and the following error: $msgSendOutput"
rm -f ${LOCK_DIR}/${FAILED_SITE}exportBksiteGridsCS ${logdir}/${FAILED_SITE}Grd.netcdf* echo "FAILED" > ${lock_file}
rm -f ${OUTPUT_DIR}/${FAILED_SITE}Grd.netcdf*
exit 1 exit 1
fi fi
else else
msgSendOutput=$($MSG_SEND_COMMAND -e ${logdir}/${FAILED_SITE}Grd.netcdf.tar -a ${SVCBU_ADDRESSEE} -s $subj -c 20) msgSendOutput=$($MSG_SEND_COMMAND -e ${OUTPUT_DIR}/${FAILED_SITE}Grd.netcdf.tar -a ${SVCBU_ADDRESSEE} -s $subj -c 20)
exitValue=$? exitValue=$?
if [ $exitValue -ne 0 ] if [ $exitValue -ne 0 ]
then then
log_msg "msg_send has failed to send ${logdir}/${FAILED_SITE}Grd.netcdf.tar" echo "msg_send has failed to send ${OUTPUT_DIR}/${FAILED_SITE}Grd.netcdf.tar"
log_msg "msg_send FAILED with exit value $exitValue and the following error: $msgSendOutput" echo "msg_send FAILED with exit value $exitValue and the following error: $msgSendOutput"
rm -f ${LOCK_DIR}/${FAILED_SITE}exportBksiteGridsCS ${logdir}/${FAILED_SITE}Grd.netcdf* echo "FAILED" > ${lock_file}
rm -f ${OUTPUT_DIR}/${FAILED_SITE}Grd.netcdf*
exit 1 exit 1
fi fi
fi fi
log_msg Successfully sent message. MESSAGE ID: $msgSendOutput echo "Successfully sent message. MESSAGE ID: $msgSendOutput"
log_msg 100 echo "SUCCESS" > ${lock_file}
rm -f ${LOCK_DIR}/${FAILED_SITE}exportBksiteGridsCS
#delete the temporary netCDF file as well. #delete the temporary netCDF file as well.
rm -f ${logdir}/${FAILED_SITE}Grd.netcdf.* rm -f ${OUTPUT_DIR}/${FAILED_SITE}Grd.netcdf.*
log_msg "All done. Export Gridded data has completed" echo "All done. Export Gridded data has completed"
exit 0 exit 0

View file

@ -1,4 +1,37 @@
#!/bin/bash #!/bin/bash
##
# This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
#
# U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination
# to non-U.S. persons whether in the United States or abroad requires
# an export license or other authorization.
#
# Contractor Name: Raytheon Company
# Contractor Address: 6825 Pine Street, Suite 340
# Mail Stop B8
# Omaha, NE 68106
# 402.291.0100
#
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information.
#
##
##
#
# SOFTWARE HISTORY
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# Feb 09, 2015 #4103 dgilling Refactored to support multiple svcbu
# sites.
#
##
if [ ${#AWIPS_HOME} = 0 ] if [ ${#AWIPS_HOME} = 0 ]
then then
path_to_script=`readlink -f $0` path_to_script=`readlink -f $0`
@ -8,167 +41,144 @@ fi
# $1 = Site name # $1 = Site name
. ${AWIPS_HOME}/GFESuite/ServiceBackup/configuration/svcbu.env . ${AWIPS_HOME}/GFESuite/ServiceBackup/configuration/svcbu.env
source ${AWIPS_HOME}/GFESuite/ServiceBackup/scripts/serviceBackupUtil.sh
SITE=`echo ${1} | tr '[A-Z]' '[a-z]'` SITE=`echo ${1} | tr '[A-Z]' '[a-z]'`
CAPS_SITE=`echo ${1} | tr [a-z] [A-Z]` CAPS_SITE=`echo ${1} | tr [a-z] [A-Z]`
export SITE export SITE
if [ -f ${LOCK_DIR}/${SITE}exportConfig ]; configureLogging "svcbu_export_config" ${SITE}
lock_file=$(getLockFile "exportConfig" ${SITE})
lock_status=$(isOperationInProgress "exportConfig" ${SITE})
if [[ "${lock_status}" = "true" ]]
then then
log_msg Cannot export configuration for ${CAPS_SITE}. Export configuration process already in progress! echo "Cannot export configuration for ${CAPS_SITE}. Export configuration process already in progress!"
exit 1 exit 1
fi fi
touch ${LOCK_DIR}/${SITE}exportConfig echo "IN_PROGRESS" > ${lock_file}
# Create the log file OUTPUT_DIR=$(getTempDirectory "export_configuration" ${CAPS_SITE})
logdir=${IFPS_LOG}/`date +%Y%m%d`
logfil=svcbu_export_config_`date +%H%M`
logfile=${logdir}/${logfil}
[ ! -d ${logdir} ] && (umask 000;mkdir ${logdir})
touch ${logdir}/${logfil}
exec 1>${logdir}/${logfil} 2>&1
# Update status percent to 0 echo "Changing to output directory: ${OUTPUT_DIR}"
log_msg 0 cd ${OUTPUT_DIR}
log_msg Changing to SVCBU_HOME directory: ${SVCBU_HOME} echo "Clearing contents of ${OUTPUT_DIR}"
cd ${SVCBU_HOME} rm -rf ${OUTPUT_DIR}/*
log_msg Clearing contents of ${SVCBU_HOME} echo "Writing site ID to text file..."
echo ${SVCBU_HOME}/* | xargs rm -rf echo $SITE > ${OUTPUT_DIR}/siteID.txt
log_msg Writing site ID to text file... echo "Preparing configuration files for export..."
echo $SITE > ${SVCBU_HOME}/siteID.txt
log_msg 10
log_msg Preparing configuration files for export...
edexDest=GFEconfig/edex_static edexDest=GFEconfig/edex_static
commonDest=GFEconfig/common_static commonDest=GFEconfig/common_static
caveDest=GFEconfig/cave_static caveDest=GFEconfig/cave_static
rsyncParms=GFEConfig # DR 16464 rsyncParms=GFEConfig # DR 16464
log_msg 15
log_msg Making temporary edex configuration directories... echo "Making temporary edex configuration directories..."
mkdir -p $edexDest/site mkdir -p $edexDest/site
log_msg 20
log_msg Making temporary common configuration directories... echo "Making temporary common configuration directories..."
mkdir -p $commonDest/site mkdir -p $commonDest/site
log_msg 25
log_msg Making temporary cave configuration directories echo "Making temporary cave configuration directories"
mkdir -p $caveDest/site mkdir -p $caveDest/site
log_msg 30
# DR 16464 # DR 16464
log_msg Making temporary rsync_parms directory echo "Making temporary rsync_parms directory"
mkdir -p $rsyncParms/site mkdir -p $rsyncParms/site
log_msg 35
# Copies the localization information to the staging area # Copies the localization information to the staging area
log_msg Copying common site configuration for site ${CAPS_SITE} to temporary directory... echo "Copying common site configuration for site ${CAPS_SITE} to temporary directory..."
cp -r ${LOCALIZATION_PATH}/common_static/site/${CAPS_SITE}/gfe $commonDest/site cp -r ${LOCALIZATION_PATH}/common_static/site/${CAPS_SITE}/gfe $commonDest/site
cp -r ${LOCALIZATION_PATH}/common_static/site/${CAPS_SITE}/vtec $commonDest/site cp -r ${LOCALIZATION_PATH}/common_static/site/${CAPS_SITE}/vtec $commonDest/site
log_msg 40 cp -r ${LOCALIZATION_PATH}/common_static/site/${CAPS_SITE}/mixedCase $commonDest/site
log_msg Copying edex site configuration for site ${CAPS_SITE} to temporary directory... echo "Copying edex site configuration for site ${CAPS_SITE} to temporary directory..."
cp -r ${LOCALIZATION_PATH}/edex_static/site/${CAPS_SITE}/config/gfe $edexDest/site cp -r ${LOCALIZATION_PATH}/edex_static/site/${CAPS_SITE}/config/gfe $edexDest/site
log_msg 50
log_msg Copying edex smartinit for site ${CAPS_SITE} to temporary directory... echo "Copying edex smartinit for site ${CAPS_SITE} to temporary directory..."
cp -r ${LOCALIZATION_PATH}/edex_static/site/${CAPS_SITE}/smartinit $edexDest/site cp -r ${LOCALIZATION_PATH}/edex_static/site/${CAPS_SITE}/smartinit $edexDest/site
log_msg 60
log_msg Copying cave site configuration for site ${CAPS_SITE} to temporary directory... echo "Copying cave site configuration for site ${CAPS_SITE} to temporary directory..."
cp -r ${LOCALIZATION_PATH}/cave_static/site/${CAPS_SITE}/gfe $caveDest/site cp -r ${LOCALIZATION_PATH}/cave_static/site/${CAPS_SITE}/gfe $caveDest/site
log_msg 70
log_msg Copying cave site maps configuration for site ${CAPS_SITE} to temporary directory... echo "Copying cave site maps configuration for site ${CAPS_SITE} to temporary directory..."
mkdir $caveDest/site/bundles mkdir $caveDest/site/bundles
cp -r ${LOCALIZATION_PATH}/cave_static/site/${CAPS_SITE}/bundles/maps $caveDest/site/bundles cp -r ${LOCALIZATION_PATH}/cave_static/site/${CAPS_SITE}/bundles/maps $caveDest/site/bundles
log_msg 75
log_msg Copying cave site colormaps configuration for site ${CAPS_SITE} to temporary directory... echo "Copying cave site colormaps configuration for site ${CAPS_SITE} to temporary directory..."
cp -r ${LOCALIZATION_PATH}/cave_static/site/${CAPS_SITE}/colormaps $caveDest/site cp -r ${LOCALIZATION_PATH}/common_static/site/${CAPS_SITE}/colormaps $commonDest/site
log_msg 80
# DR 16464 # DR 16464
if [ -f /awips2/GFESuite/ServiceBackup/data/rsync_parms.${CAPS_SITE} ]; then if [ -f /awips2/GFESuite/ServiceBackup/data/rsync_parms.${CAPS_SITE} ]; then
log_msg Copying the rsync_parms file for site ${CAPS_SITE} to temporary directory... echo "Copying the rsync_parms file for site ${CAPS_SITE} to temporary directory..."
cp -a /awips2/GFESuite/ServiceBackup/data/rsync_parms.${CAPS_SITE} $rsyncParms/site cp -a /awips2/GFESuite/ServiceBackup/data/rsync_parms.${CAPS_SITE} $rsyncParms/site
log_msg 83
fi fi
# Tar up everything. # Tar up everything.
log_msg 85 echo "Tarring and zipping configuration to file GFEconfig.${SITE}.tar.gz"
log_msg Tarring and zipping configuration to file GFEconfig.${SITE}.tar.gz
tar cf - GFEconfig|gzip -9 - > GFEconfig.${SITE}.tar.gz tar cf - GFEconfig|gzip -9 - > GFEconfig.${SITE}.tar.gz
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
log_msg "Failed to make GFEConfig tar file.Program exits now." echo "Failed to make GFEConfig tar file.Program exits now."
rm -f ${LOCK_DIR}/${SITE}exportConfig echo "FAILED" > ${lock_file}
exit 1 exit 1
fi fi
# Cleanup # Cleanup
log_msg Cleaning up temporary files echo "Cleaning up temporary files"
rm -fR GFEconfig rm -fr GFEconfig
log_msg 90 echo "Preparing compressed file for exporting to central server..."
log_msg Preparing compressed file for exporting to central server... echo "Compressing to file svc_bkup_${SITE}.tar"
log_msg Compressing to file svc_bkup_${SITE}.tar
tar cf svc_bkup_${SITE}.tar *.gz siteID.txt tar cf svc_bkup_${SITE}.tar *.gz siteID.txt
log_msg 93
#check for failure of the tar file #check for failure of the tar file
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
log_msg "failed to make the tar file. Program exits." echo "failed to make the tar file. Program exits."
rm -f ${LOCK_DIR}/${SITE}exportConfig echo "FAILED" > ${lock_file}
exit 1 exit 1
fi fi
# Cleanup zip files # Cleanup zip files
# #
log_msg Cleaning up zip files echo "Cleaning up zip files"
rm -fr *.gz rm -f *.gz
rm siteID.txt rm siteID.txt
log_msg Sending the tar file to the central server... echo "Sending the tar file to the central server..."
log_msg 95
# Check to see if ${SVCBU_WMO_HEADER} is assigned a value. If so, call msg_send with -i. # Check to see if ${SVCBU_WMO_HEADER} is assigned a value. If so, call msg_send with -i.
# Otherwise, don't call it with -i # Otherwise, don't call it with -i
if [ -n "${SVCBU_WMO_HEADER}" ]; then if [ -n "${SVCBU_WMO_HEADER}" ]; then
log_msg $MSG_SEND_COMMAND -e ${SVCBU_HOME}/svc_bkup_${SITE}.tar -a ${SVCBU_ADDRESSEE} -i ${SVCBU_WMO_HEADER} -s ${SITE}2 -c 20 echo "$MSG_SEND_COMMAND -e ${OUTPUT_DIR}/svc_bkup_${SITE}.tar -a ${SVCBU_ADDRESSEE} -i ${SVCBU_WMO_HEADER} -s ${SITE}2 -c 20"
msgSendOutput=$($MSG_SEND_COMMAND -e ${SVCBU_HOME}/svc_bkup_${SITE}.tar -a ${SVCBU_ADDRESSEE} -i ${SVCBU_WMO_HEADER} -s ${SITE}2 -c 20) msgSendOutput=$($MSG_SEND_COMMAND -e ${OUTPUT_DIR}/svc_bkup_${SITE}.tar -a ${SVCBU_ADDRESSEE} -i ${SVCBU_WMO_HEADER} -s ${SITE}2 -c 20)
exitValue=$? exitValue=$?
if [ $exitValue -ne 0 ] if [ $exitValue -ne 0 ]
then then
log_msg "msg_send FAILED with exit value $exitValue and the following error: $msgSendOutput" echo "msg_send FAILED with exit value $exitValue and the following error: $msgSendOutput"
rm -f ${LOCK_DIR}/${SITE}exportConfig echo "FAILED" > ${lock_file}
exit 1 exit 1
fi fi
else else
log_msg $MSG_SEND_COMMAND -e ${SVCBU_HOME}/svc_bkup_${SITE}.tar -a ${SVCBU_ADDRESSEE} -s ${SITE}2 -c 20 echo "$MSG_SEND_COMMAND -e ${OUTPUT_DIR}/svc_bkup_${SITE}.tar -a ${SVCBU_ADDRESSEE} -s ${SITE}2 -c 20"
msgSendOutput=$($MSG_SEND_COMMAND -e ${SVCBU_HOME}/svc_bkup_${SITE}.tar -a ${SVCBU_ADDRESSEE} -s ${SITE}2 -c 20) msgSendOutput=$($MSG_SEND_COMMAND -e ${OUTPUT_DIR}/svc_bkup_${SITE}.tar -a ${SVCBU_ADDRESSEE} -s ${SITE}2 -c 20)
exitValue=$? exitValue=$?
if [ $exitValue -ne 0 ] if [ $exitValue -ne 0 ]
then then
log_msg "msg_send FAILED with exit value $exitValue and the following error: $msgSendOutput" echo "msg_send FAILED with exit value $exitValue and the following error: $msgSendOutput"
rm -f ${LOCK_DIR}/${SITE}exportConfig echo "FAILED" > ${lock_file}
exit 1 exit 1
fi fi
fi fi
log_msg Successfully sent message. MESSAGE ID: $msgSendOutput echo "Successfully sent message. MESSAGE ID: $msgSendOutput"
#echo ${SVCBU_HOME}/* | xargs rm -rf echo "SUCCESS" > ${lock_file}
rm -f ${LOCK_DIR}/${SITE}exportConfig echo "Configuration data has been exported!"
log_msg Configuration data has been exported!
log_msg 100
exit 0 exit 0

View file

@ -13,6 +13,9 @@
# 05/16/13 #2009 dgilling New backup structure: # 05/16/13 #2009 dgilling New backup structure:
# PRIMARY_SITES go to exportgrids/primary/ # PRIMARY_SITES go to exportgrids/primary/
# and all other go to exportgrids/backup/. # and all other go to exportgrids/backup/.
# 02/12/15 #4103 dgilling Refactored to support multiple service
# backup sites.
#
############################################################################## ##############################################################################
if [ ${#AWIPS_HOME} = 0 ] if [ ${#AWIPS_HOME} = 0 ]
@ -29,34 +32,29 @@ fi
# $2 = wfo ID. # $2 = wfo ID.
# #
# #
if [ $# -ne 2 ]
then
log_msg "Incorrect number of arguments\nCorrect usage: export_grids [-c|-m|-g] wfo"
exit 1
fi
. ${AWIPS_HOME}/GFESuite/ServiceBackup/configuration/svcbu.env . ${AWIPS_HOME}/GFESuite/ServiceBackup/configuration/svcbu.env
source ${AWIPS_HOME}/GFESuite/ServiceBackup/scripts/serviceBackupUtil.sh
# Create the log file
logdir=${IFPS_LOG}/`date +%Y%m%d`
logfil=svcbu_export_grids_`date +%H%M`
logfile=${logdir}/${logfil}
[ ! -d ${logdir} ] && (umask 000;mkdir ${logdir})
touch ${logdir}/${logfil}
exec 1>${logdir}/${logfil} 2>&1
SITE=`echo ${2} | tr '[A-Z]' '[a-z]'` SITE=`echo ${2} | tr '[A-Z]' '[a-z]'`
CAPS_SITE=`echo ${2} | tr [a-z] [A-Z]` CAPS_SITE=`echo ${2} | tr [a-z] [A-Z]`
export SITE export SITE
manuallockFile=${LOCK_DIR}/${SITE}exportGrids # Create the log file
cronLockFile=${LOCK_DIR}/${SITE}exportGridscron configureLogging "svcbu_export_grids" ${SITE}
if [ $# -ne 2 ]
then
echo "Incorrect number of arguments\nCorrect usage: export_grids [-c|-m|-g] wfo"
exit 1
fi
manuallockFile=$(getLockFile "exportGrids" ${SITE})
cronLockFile=$(getLockFile "exportGridscron" ${SITE})
lockFile=${manuallockFile} lockFile=${manuallockFile}
LOGGER=log_msg
if [ $1 = "-c" ] if [ $1 = "-c" ]
then then
LOGGER=echo_msg
lockFile=${cronLockFile} lockFile=${cronLockFile}
fi fi
@ -64,31 +62,28 @@ fi
# #
if [ $EXPORT_GRID -eq 0 ] if [ $EXPORT_GRID -eq 0 ]
then then
$LOGGER "You turned off the export grid option. Check EXPORT_GRID." echo "You turned off the export grid option. Check EXPORT_GRID."
$LOGGER 100
exit 1 exit 1
elif [ "$1" = "-c" ] && [ $EXPORT_GRID -ne 1 ] elif [ "$1" = "-c" ] && [ $EXPORT_GRID -ne 1 ]
then then
$LOGGER "Cannot execute grid export since you have disabled the cron job. Check EXPORT_GRID." echo "Cannot execute grid export since you have disabled the cron job. Check EXPORT_GRID."
$LOGGER 100
exit 1 exit 1
elif [ -z "$EXPORT_GRID" ] elif [ -z "$EXPORT_GRID" ]
then then
$LOGGER "EXPORT_GRID not defined. Export grids failed" echo "EXPORT_GRID not defined. Export grids failed"
$LOGGER 100
exit 1 exit 1
fi fi
if [ -f ${manuallockFile} ] lock_status=$(isOperationInProgress "exportGrids" ${SITE})
if [[ "${lock_status}" = "true" ]]
then then
$LOGGER Cannot export grids for ${CAPS_SITE}. Export grids process already in progress! Cron will not run this hour. echo "Cannot export grids for ${CAPS_SITE}. Export grids process already in progress! Cron will not run this hour."
exit 1 exit 1
fi fi
touch ${lockFile} echo "IN_PROGRESS" > ${lock_file}
$LOGGER "Starting exporting grids..." echo "Starting exporting grids..."
$LOGGER 0
# #
# If this is a non-wfo/non-rfc site, they may not have an edit area for clipping - handle it # If this is a non-wfo/non-rfc site, they may not have an edit area for clipping - handle it
@ -104,8 +99,8 @@ fi
starttime=`date -d "24 hours ago" +%Y%m%d`_`date -d "24 hours ago" +%H00` starttime=`date -d "24 hours ago" +%Y%m%d`_`date -d "24 hours ago" +%H00`
endtime=`date -d "+8 days 6 hours" +%Y%m%d`_`date -d "+8 days 6 hours" +%H00` endtime=`date -d "+8 days 6 hours" +%Y%m%d`_`date -d "+8 days 6 hours" +%H00`
# #
$LOGGER 25
$LOGGER "Running ifpnetCDF..." echo "Running ifpnetCDF..."
# Name of the database to use in ifpServer to grab grids from. # Name of the database to use in ifpServer to grab grids from.
# NOTE: SVCBU_DB must be defined in ifps-ccc.env file. Defaults to Official. # NOTE: SVCBU_DB must be defined in ifps-ccc.env file. Defaults to Official.
@ -115,7 +110,7 @@ then
else else
DB_NAME=${CAPS_SITE}_GRID__Official_00000000_0000 DB_NAME=${CAPS_SITE}_GRID__Official_00000000_0000
fi fi
$LOGGER ${DB_NAME} echo ${DB_NAME}
# use PRIMARY_SITES setting to determine NETCDF_PATH # use PRIMARY_SITES setting to determine NETCDF_PATH
IFS=',' read -ra PRI_SITES <<< "${PRIMARY_SITES}" IFS=',' read -ra PRI_SITES <<< "${PRIMARY_SITES}"
@ -175,17 +170,16 @@ then
if [ "$netcdf_error" != "" ]; then if [ "$netcdf_error" != "" ]; then
NETCDF_SUCCESS=1 NETCDF_SUCCESS=1
else else
$LOGGER "ifpnetCDF failed. Export exits." echo "ifpnetCDF failed. Export exits."
rm -f ${lockFile} echo "FAILED" > ${lock_file}
$LOGGER 100
exit 1 exit 1
fi fi
fi fi
fi fi
else else
$LOGGER "export_grids was not able to find ${IFPS_DATA}/svcbu_export_elements.${SITE} file." echo "export_grids was not able to find ${IFPS_DATA}/svcbu_export_elements.${SITE} file."
$LOGGER "Without this file, ifpnetCDF will not know how to trim for needed weather elements." echo "Without this file, ifpnetCDF will not know how to trim for needed weather elements."
$LOGGER "ifpnetCDF will run without doing any trimming." echo "ifpnetCDF will run without doing any trimming."
#Starting ifpnetCDF to pack the grids (netcdf file is stored in the IFPS_LOG dir) #Starting ifpnetCDF to pack the grids (netcdf file is stored in the IFPS_LOG dir)
${GFESUITE_BIN}/ifpnetCDF -o ${NETCDF_TMP_PATH}/${SITE}Grd.netcdf -h $SVCBU_HOST -r ${CDSPORT} -d ${DB_NAME} -k -t ${SVCBU_MASK} ${GFESUITE_BIN}/ifpnetCDF -o ${NETCDF_TMP_PATH}/${SITE}Grd.netcdf -h $SVCBU_HOST -r ${CDSPORT} -d ${DB_NAME} -k -t ${SVCBU_MASK}
#check if the netcdf file is there;if not,exit #check if the netcdf file is there;if not,exit
@ -198,9 +192,8 @@ then
if [ "$netcdf_error" != "" ]; then if [ "$netcdf_error" != "" ]; then
NETCDF_SUCCESS=1 NETCDF_SUCCESS=1
else else
$LOGGER "ifpnetCDF failed. Export exits." echo "ifpnetCDF failed. Export exits."
rm -f ${lockFile} echo "FAILED" > ${lock_file}
$LOGGER 100
exit 1 exit 1
fi fi
fi fi
@ -220,9 +213,8 @@ else
if [ "$netcdf_error" != "" ]; then if [ "$netcdf_error" != "" ]; then
NETCDF_SUCCESS=1 NETCDF_SUCCESS=1
else else
$LOGGER "ifpnetCDF failed." echo "ifpnetCDF failed."
rm -f ${lockFile} echo "FAILED" > ${lock_file}
$LOGGER 100
exit 1 exit 1
fi fi
fi fi
@ -231,19 +223,18 @@ fi
if [ $NETCDF_SUCCESS = 1 ] if [ $NETCDF_SUCCESS = 1 ]
then then
$LOGGER "Copying ${NETCDF_TMP_PATH}/${SITE}Grd.netcdf to ${NETCDF_PATH}/${SITE}Grd.netcdf" echo "Copying ${NETCDF_TMP_PATH}/${SITE}Grd.netcdf to ${NETCDF_PATH}/${SITE}Grd.netcdf"
cp ${NETCDF_TMP_PATH}/${SITE}Grd.netcdf ${NETCDF_PATH}/${SITE}Grd.netcdf cp ${NETCDF_TMP_PATH}/${SITE}Grd.netcdf ${NETCDF_PATH}/${SITE}Grd.netcdf
fi fi
if [ -f ${NETCDF_TMP_PATH}/${SITE}Grd.netcdf ] if [ -f ${NETCDF_TMP_PATH}/${SITE}Grd.netcdf ]
then then
$LOGGER "Removing ${NETCDF_TMP_PATH}/${SITE}Grd.netcdf" echo "Removing ${NETCDF_TMP_PATH}/${SITE}Grd.netcdf"
rm -f ${NETCDF_TMP_PATH}/${SITE}Grd.netcdf rm -f ${NETCDF_TMP_PATH}/${SITE}Grd.netcdf
fi fi
rm -f ${lockFile} echo "SUCCESS" > ${lock_file}
$LOGGER 100
# Completed successfully # Completed successfully
$LOGGER "All done. Export Gridded data has completed" echo "All done. Export Gridded data has completed"
exit 0 exit 0

View file

@ -1,45 +1,70 @@
#!/bin/bash #!/bin/bash
##
# This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
#
# U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination
# to non-U.S. persons whether in the United States or abroad requires
# an export license or other authorization.
#
# Contractor Name: Raytheon Company
# Contractor Address: 6825 Pine Street, Suite 340
# Mail Stop B8
# Omaha, NE 68106
# 402.291.0100
#
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information.
#
##
##
#
# SOFTWARE HISTORY
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# Feb 09, 2015 #4103 dgilling Refactored to support multiple svcbu
# sites.
#
##
if [ ${#AWIPS_HOME} = 0 ] if [ ${#AWIPS_HOME} = 0 ]
then then
path_to_script=`readlink -f $0` path_to_script=`readlink -f $0`
export AWIPS_HOME=$(dirname $(dirname $(dirname $(dirname $path_to_script)))) export AWIPS_HOME=$(dirname $(dirname $(dirname $(dirname $path_to_script))))
fi fi
# $1 = Failed site . ${AWIPS_HOME}/GFESuite/ServiceBackup/configuration/svcbu.env
# $2 = Primary site source ${AWIPS_HOME}/GFESuite/ServiceBackup/scripts/serviceBackupUtil.sh
if [ $# -ne 2 ] if [ $# -ne 1 ]
then then
log_msg "Incorrect number of arguments\nCorrect usage: export_grids_to_failed_site primary_site failed_site" echo "Incorrect number of arguments\nCorrect usage: export_grids_to_failed_site failed_site"
exit 1 exit 1
fi fi
. ${AWIPS_HOME}/GFESuite/ServiceBackup/configuration/svcbu.env # $1 = Failed site
PRIMARY_SITE=`echo ${2} | tr '[A-Z]' '[a-z]'`
PRIMARY_CAPS_SITE=`echo ${2} | tr [a-z] [A-Z]`
export PRIMARY_SITE
FAILED_SITE=`echo ${1} | tr '[A-Z]' '[a-z]'` FAILED_SITE=`echo ${1} | tr '[A-Z]' '[a-z]'`
FAILED_CAPS_SITE=`echo ${1} | tr [a-z] [A-Z]` FAILED_CAPS_SITE=`echo ${1} | tr [a-z] [A-Z]`
export FAILED_SITE export FAILED_SITE
# Create the log file # Create the log file
logdir=${IFPS_LOG}/`date +%Y%m%d` configureLogging "svcbu_export_bksite_grids" ${FAILED_SITE}
logfil=svcbu_export_bksite_grids_`date +%H%M`
logfile=${logdir}/${logfil}
[ ! -d ${logdir} ] && (umask 000;mkdir ${logdir})
touch ${logdir}/${logfil}
exec 1>${logdir}/${logfil} 2>&1
# Check the status of the lock file to see if we are OK to proceed # Check the status of the lock file to see if we are OK to proceed
if [ -f ${LOCK_DIR}/${PRIMARY_SITE}exportBkSiteGrids ]; lock_file=$(getLockFile "exportBkSiteGrids" ${FAILED_SITE})
lock_status=$(isOperationInProgress "exportBkSiteGrids" ${FAILED_SITE})
if [[ "${lock_status}" = "true" ]]
then then
log_msg Cannot export grids back to ${PRIMARY_CAPS_SITE}. Export grids process already in progress! echo "Cannot export grids back to ${FAILED_SITE}. Export grids process already in progress!"
exit 1 exit 1
fi fi
touch ${LOCK_DIR}/${PRIMARY_SITE}exportBkSiteGrids echo "IN_PROGRESS" > ${lock_file}
# #
# If this is a non-wfo/non-rfc site, they may not have an edit area for clipping - handle it # If this is a non-wfo/non-rfc site, they may not have an edit area for clipping - handle it
@ -50,34 +75,31 @@ else
SVCBU_MASK="-m $SVCBU_GRIDAREA" SVCBU_MASK="-m $SVCBU_GRIDAREA"
fi fi
log_msg Starting exporting grids... echo "Starting exporting grids..."
log_msg 0
OUTPUT_DIR=$(getTempDirectory "export_grids_to_failed_site" ${FAILED_SITE})
#Starting ifpnetCDF to pack the grids #Starting ifpnetCDF to pack the grids
log_msg Running ifpnetCDF... echo "Running ifpnetCDF..."
log_msg 25 ${GFESUITE_BIN}/ifpnetCDF -o ${OUTPUT_DIR}/${FAILED_SITE}Grd.netcdf -h $SVCBU_HOST -r $CDSPORT -d ${FAILED_CAPS_SITE}_GRID__Official_00000000_0000 -k -t -c ${SVCBU_MASK}
${GFESUITE_BIN}/ifpnetCDF -o ${SVCBU_HOME}/${FAILED_SITE}Grd.netcdf -h $SVCBU_HOST -r $CDSPORT -d ${FAILED_CAPS_SITE}_GRID__Official_00000000_0000 -k -t -c ${SVCBU_MASK}
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
log_msg "ERROR: ifpnetCDF failed." echo "ERROR: ifpnetCDF failed."
rm -f ${LOCK_DIR}/${PRIMARY_SITE}exportBkSiteGrids echo "FAILED" > ${lock_file}
exit 1 exit 1
fi fi
# #
log_msg Preparing package for msg_send. echo "Preparing package for msg_send."
log_msg 60
subj=${FAILED_SITE}Grd subj=${FAILED_SITE}Grd
log_msg "The subject line of msg_send is $subj" echo "The subject line of msg_send is $subj"
# #
#calling msg_send to send the data to the failed site #calling msg_send to send the data to the failed site
log_msg "Sending the gridded data to ${FAILED_CAPS_SITE}..." echo "Sending the gridded data to ${FAILED_CAPS_SITE}..."
log_msg 90
# We need to add another -c command in message hanlding system. # We need to add another -c command in message hanlding system.
# Send the grids to the failed site # Send the grids to the failed site
cd ${SVCBU_HOME} cd ${OUTPUT_DIR}
# these lines are commented out for DR14441 # these lines are commented out for DR14441
# A1 expects to receive a file in gz format # A1 expects to receive a file in gz format
@ -86,7 +108,7 @@ cd ${SVCBU_HOME}
# #
# echo ${FAILED_SITE} > siteID.txt # echo ${FAILED_SITE} > siteID.txt
# tar cf Grd.tar ${FAILED_SITE}Grd.netcdf.gz siteID.txt # tar cf Grd.tar ${FAILED_SITE}Grd.netcdf.gz siteID.txt
# msgSendOutput=$($MSG_SEND_COMMAND -e ${SVCBU_HOME}/Grd.tar -a ${FAILED_CAPS_SITE} -s $subj -c 25) # msgSendOutput=$($MSG_SEND_COMMAND -e ${OUTPUT_DIR}/Grd.tar -a ${FAILED_CAPS_SITE} -s $subj -c 25)
# begin changes for 14441 # begin changes for 14441
msgSendOutput=$($MSG_SEND_COMMAND -e ${FAILED_SITE}Grd.netcdf.gz -a ${FAILED_CAPS_SITE} -s $subj -c 25) msgSendOutput=$($MSG_SEND_COMMAND -e ${FAILED_SITE}Grd.netcdf.gz -a ${FAILED_CAPS_SITE} -s $subj -c 25)
@ -95,19 +117,18 @@ msgSendOutput=$($MSG_SEND_COMMAND -e ${FAILED_SITE}Grd.netcdf.gz -a ${FAILED_CAP
exitValue=$? exitValue=$?
if [ $exitValue -ne 0 ] if [ $exitValue -ne 0 ]
then then
log_msg "msg_send has failed to send ${logdir}/Grd.tar" echo "msg_send has failed to send ${OUTPUT_DIR}/Grd.tar"
log_msg "msg_send FAILED with exit value $exitValue and the following error: $msgSendOutput" echo "msg_send FAILED with exit value $exitValue and the following error: $msgSendOutput"
rm -f ${SVCBU_HOME}/${FAILED_SITE}Grd.netcdf* echo "FAILED" > ${lock_file}
rm -f ${LOCK_DIR}/${PRIMARY_SITE}exportBkSiteGrids rm -f ${OUTPUT_DIR}/${FAILED_SITE}Grd.netcdf*
exit 1 exit 1
fi fi
log_msg Successfully sent message. MESSAGE ID: $msgSendOutput echo "Successfully sent message. MESSAGE ID: $msgSendOutput"
log_msg "Grids successfully exported" echo "Grids successfully exported"
log_msg 100 echo "SUCCESS" > ${lock_file}
rm -f ${LOCK_DIR}/${PRIMARY_SITE}exportBkSiteGrids
#delete the temporary netCDF file as well. #delete the temporary netCDF file as well.
rm -f ${SVCBU_HOME}/${FAILED_SITE}Grd.netcdf.* rm -f ${OUTPUT_DIR}/${FAILED_SITE}Grd.netcdf.*
rm -f ${SVCBU_HOME}/Grd.tar rm -f ${OUTPUT_DIR}/Grd.tar
log_msg "All done. Export Gridded data has completed" echo "All done. Export Gridded data has completed"
exit 0 exit 0

View file

@ -1,17 +0,0 @@
#!/bin/bash
if [ ${#AWIPS_HOME} = 0 ]
then
path_to_script=`readlink -f $0`
export AWIPS_HOME=$(dirname $(dirname $(dirname $(dirname $path_to_script))))
fi
LOCK_DIR=/awips2/GFESuite/ServiceBackup/locks
cd $LOCK_DIR
for fileName in `ls`
do
if [[ $fileName != *svcbuMode ]]
then
rm -f $fileName
fi
done

View file

@ -1,20 +0,0 @@
#!/bin/bash
if [ ${#AWIPS_HOME} = 0 ]
then
path_to_script=`readlink -f $0`
export AWIPS_HOME=$(dirname $(dirname $(dirname $(dirname $path_to_script))))
fi
. ${AWIPS_HOME}/GFESuite/ServiceBackup/configuration/svcbu.env
function is_number() {
printf "%d" $@ > /dev/null 2>&1
return $?
}
log_msg_python $@
if ! is_number $@; then
echo "$@"
fi

View file

@ -1,74 +0,0 @@
#!/usr/bin/env python
##
# This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
#
# U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination
# to non-U.S. persons whether in the United States or abroad requires
# an export license or other authorization.
#
# Contractor Name: Raytheon Company
# Contractor Address: 6825 Pine Street, Suite 340
# Mail Stop B8
# Omaha, NE 68106
# 402.291.0100
#
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information.
##
import sys
import os
from dynamicserialize.dstypes.com.raytheon.uf.common.dataplugin.gfe.request import ServiceBackupStatusUpdateRequest
from dynamicserialize.dstypes.com.raytheon.uf.common.message import WsId
from dynamicserialize import DynamicSerializationManager
from ufpy import ThriftClient, ConfigFileUtil
#
# TODO: ADD DESCRIPTION
#
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 10/26/10 dgilling Initial Creation.
#
#
#
def main():
connectionParams = getConnectionParams()
try:
statusRequest = createRequest()
thriftClient = ThriftClient.ThriftClient(connectionParams["SVCBU_HOST"], int(connectionParams["CDSPORT"]), "/services")
serverResponse = thriftClient.sendRequest(statusRequest)
except Exception, e:
print "Unhandled exception thrown: \n", str(e)
sys.exit(1)
if (not serverResponse.isOkay()):
print "Errors occurred during log_msg processing: ", serverResponse.message()
sys.exit(1)
def getConnectionParams():
return ConfigFileUtil.parseKeyValueFile(os.path.join(sys.path[0], "../configuration/svcbu.properties"))
def createRequest():
obj = ServiceBackupStatusUpdateRequest()
wsId = WsId(progName="log_msg")
obj.setWorkstationID(wsId)
obj.setSiteID("")
obj.setStatusMessage(" ".join(sys.argv[1:]))
return obj
if __name__ == '__main__':
main()

View file

@ -8,38 +8,26 @@ fi
. ${AWIPS_HOME}/GFESuite/ServiceBackup/configuration/svcbu.env . ${AWIPS_HOME}/GFESuite/ServiceBackup/configuration/svcbu.env
# Create the log file # Create the log file
logdir=${IFPS_LOG}/`date +%Y%m%d` configureLogging "ndfd_mhs" ${AW_SITE_IDENTIFIER}
logfil=ndfd_mhs`date +%H%M`
logfile=${logdir}/${logfil}
[ ! -d ${logdir} ] && (umask 000;mkdir ${logdir})
touch ${logdir}/${logfil}
exec 1>${logdir}/${logfil} 2>&1
log_msg 0
# Retrieve the name of the site from the tar file. # Retrieve the name of the site from the tar file.
ndfd_msg=${1} ndfd_msg=${1}
if [ -a ${ndfd_msg} ] if [ -a ${ndfd_msg} ]
then then
log_msg "Received NDFD banner message" echo "Received NDFD banner message"
mv ${ndfd_msg} ${GFESUITE_HOME}/ndfdMsg mv ${ndfd_msg} ${GFESUITE_HOME}/ndfdMsg
msg=`cat ${GFESUITE_HOME}/ndfdMsg` msg=`cat ${GFESUITE_HOME}/ndfdMsg`
# Generate a GFE message saying an alert was received from NDFD. # Generate a GFE message saying an alert was received from NDFD.
${GFESUITE_BIN}/sendGfeMessage -h ${SVCBU_HOST} -p ${CDSPORT} -c NDFD -m "$msg" -s ${GFESUITE_BIN}/sendGfeMessage -h ${SVCBU_HOST} -p ${CDSPORT} -c NDFD -m "$msg" -s
else else
log_msg "Unable to locate the NDFD banner message" echo "Unable to locate the NDFD banner message"
log_msg 100
exit 1 exit 1
fi fi
log_msg 50
#clean-up. #clean-up.
rm -f ${GFESUITE_HOME}/ndfdMsg rm -f ${GFESUITE_HOME}/ndfdMsg
log_msg 100
#ALL well, send a msg and get out of here
log_msg "$msg successfully sent to GFE."
exit 0
#ALL well, send a msg and get out of here
echo "$msg successfully sent to GFE."
exit 0

View file

@ -1,246 +0,0 @@
#!/bin/bash
##
# This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
#
# U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination
# to non-U.S. persons whether in the United States or abroad requires
# an export license or other authorization.
#
# Contractor Name: Raytheon Company
# Contractor Address: 6825 Pine Street, Suite 340
# Mail Stop B8
# Omaha, NE 68106
# 402.291.0100
#
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information.
##
##############################################################################
# Process Received Configuration
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 03/20/14 #2933 randerso Changed PRDDIR and LOGDIR to use
# Backup site's configuration
# 01/30/15 #17081 lshi Added backup vtec
##############################################################################
import_file=${1}
log_msg The import_file is: $import_file
FILESIZE=$(stat -c%s "$import_file")
log_msg "File Size is: $FILESIZE bytes."
if [ -a ${import_file} ]
then
log_msg Unpacking configuration data.
if [ -d ${SVCBU_HOME} ]
then
cd ${SVCBU_HOME}
echo ${SVCBU_HOME}/* | xargs rm -rf
else
mkdir -m 777 ${SVCBU_HOME}
fi
# Determine the 3 letter failed site id
log_msg Service Backup location: ${SVCBU_HOME}
cd ${SVCBU_HOME}
tar xvf ${import_file} siteID.txt
if [ $? -eq 0 ] && [ -a ${SVCBU_HOME}/siteID.txt ];
then
log_msg "Using the siteID.txt method"
# siteID.txt file exists.
SITE=`cat siteID.txt`
rm -f ${SVCBU_HOME}/siteID.txt
else
log_msg "Using the old tar/cut method"
tar -tf ${import_file} | while read line
do
SITE=`echo $line | cut -d. -f2`
break
done
fi
log_msg Recieved configuration data is from $SITE
SITE_CAPS=`echo ${SITE}|tr [a-z] [A-Z]`
#
#determine local site id
#
my_site=$(cat $SCRIPTS_DIR/siteID.txt)
my_site_caps=`echo ${my_site}|tr [a-z] [A-Z]`
log_msg My site is: $my_site
# Determine which host service backup was run from
# if my_site is the same as the failed site, stop
if [ "$my_site" = "$SITE" ]
then
log_msg You cannot import configuration data for your own site.
rm -f ${LOCK_DIR}/importConfiguration
rm -f ${LOCK_DIR}/trMode
touch ${LOCK_DIR}/svcbuerr
log_msg 100
exit 1
fi
# Retrieve the file from the MHS x400 directory
log_msg Moving ${import_file} to ${SVCBU_HOME}/svc_bkup_${SITE}.tar
mv -f ${import_file} ${SVCBU_HOME}/svc_bkup_${SITE}.tar
# Update owner and permissions from root to ifps
#chown awips:awips ${SVCBU_HOME}/svc_bkup_${SITE}.tar
chmod 777 ${SVCBU_HOME}/svc_bkup_${SITE}.tar
# File was not found so EXIT
else
log_msg "Unable to locate ${import_file}. Service backup exits now"
rm -f ${LOCK_DIR}/importConfiguration
rm -f ${LOCK_DIR}/trMode
touch ${LOCK_DIR}/svcbuerr
log_msg 100
exit 1
fi
log_msg 50
log_msg "Extracting files..."
tar -xvf svc_bkup_${SITE}.tar
gunzip -c GFEconfig.${SITE}.tar.gz | tar xf -
if [ $? -ne 0 ]; then
log_msg -e "\nERROR: Could not explode GFEconfig.${SITE_CAPS}.tar.gz..."
rm -f ${LOCK_DIR}/importConfiguration
rm -f ${LOCK_DIR}/trMode
touch ${LOCK_DIR}/svcbuerr
log_msg 100
exit 1
fi
log_msg "Checking format of received configuration data..."
if [ -d GFEconfig ]; then
log_msg "AWIPS II configuration received. OK to proceed!"
else
log_msg "Incorrectly formatted configuration received. Cannot continue!"
rm -f ${LOCK_DIR}/importConfiguration
rm -f ${LOCK_DIR}/trMode
touch ${LOCK_DIR}/svcbuerr
log_msg 100
exit 1
fi
log_msg "Copying files into position..."
log_msg "Checking if localization directories exist for ${SITE_CAPS}"
edex_site_dest=${LOCALIZATION_PATH}/edex_static/site/${SITE_CAPS}/config
edex_site_si_dest=${LOCALIZATION_PATH}/edex_static/site/${SITE_CAPS}
common_site_dest=${LOCALIZATION_PATH}/common_static/site/${SITE_CAPS}
cave_site_dest=${LOCALIZATION_PATH}/cave_static/site/${SITE_CAPS}
rsync_parms_dest=/awips2/GFESuite/ServiceBackup/data # DR 16464
if [ -d ${edex_site_dest} ]; then
log_msg "edex_static site directory exists for ${SITE_CAPS}"
else
log_msg "Creating edex_static site directory for ${SITE_CAPS}"
mkdir -p ${edex_site_dest}
fi
log_msg 53
if [ -d ${common_site_dest} ]; then
log_msg "common_static site directory exists for ${SITE_CAPS}"
else
log_msg "Creating common_static site directory for ${SITE_CAPS}"
mkdir -p ${common_site_dest}
fi
log_msg 56
if [ -d ${cave_site_dest} ]; then
log_msg "cave_static site directory exists for ${SITE_CAPS}"
else
log_msg "Creating cave_static site directory for ${SITE_CAPS}"
mkdir -p ${cave_site_dest}
fi
# DR 16464
if [ -d ${rsync_parms_dest} ]; then
log_msg "rsync_parms_dest directory exists for ${SITE_CAPS}"
else
log_msg "Creating rsync_parms_dest directory for ${SITE_CAPS}"
mkdir -p ${rsync_parms_dest}
fi
log msg 59
log_msg "${SITE_CAPS}'s localization directories have been verified"
log_msg 60
cp -r GFEconfig/common_static/site/gfe ${common_site_dest}
log_msg 70
cp -r GFEconfig/edex_static/site/gfe ${edex_site_dest}
log_msg 80
cp -r GFEconfig/edex_static/site/smartinit ${edex_site_si_dest}
log_msg 90
cp -r GFEconfig/cave_static/site/* ${cave_site_dest}
# DR 17081
log_msg 91
cp -r GFEconfig/common_static/site/vtec ${common_site_dest}
log_msg 93
# DR 16464
cp -a GFEConfig/site/rsync_parms.${SITE_CAPS} ${rsync_parms_dest}.${SITE_CAPS}
log_msg 94
log_msg "Files successfully copied!"
log_msg "Changing ownership of received configuration"
if [ $USER = "root" ]
then
chown -R awips:fxalpha ${LOCALIZATION_PATH}/edex_static/site/${SITE_CAPS}
chown -R awips:fxalpha ${LOCALIZATION_PATH}/common_static/site/${SITE_CAPS}
chown -R awips:fxalpha ${LOCALIZATION_PATH}/cave_static/site/${SITE_CAPS}
chown -R awips:fxalpha /awips2/GFESuite/ServiceBackup/data # DR 16464
elif [ $USER = "awips" ]
then
log_msg "Files already owned by awips"
else
log_msg "Script must be run as user root or awips"
fi
log_msg 95
#
# DR21404 - disable ISC/VTEC for troubleshooting mode
#
if [ -f ${LOCK_DIR}/trMode ]; then
log_msg "Activating troubleshooting mode..."
rm -f ${LOCALIZATION_PATH}/common_static/site/${SITE_CAPS}/vtec/localVTECPartners.py*
echo "serverConfig.REQUEST_ISC = 0" >> ${LOCALIZATION_PATH}/edex_static/site/${SITE_CAPS}/config/gfe/localConfig.py
echo "serverConfig.SEND_ISC_ON_SAVE = 0" >> ${LOCALIZATION_PATH}/edex_static/site/${SITE_CAPS}/config/gfe/localConfig.py
echo "serverConfig.SEND_ISC_ON_PUBLISH = 0" >> ${LOCALIZATION_PATH}/edex_static/site/${SITE_CAPS}/config/gfe/localConfig.py
fi
log_msg "Updating siteConfig.py..."
#Change the MHS ID of the received configuration
backup_config=${LOCALIZATION_PATH}/edex_static/site/${my_site_caps}/config/gfe/siteConfig.py
failed_config=${LOCALIZATION_PATH}/edex_static/site/${SITE_CAPS}/config/gfe/siteConfig.py
sed -i "s/ / /" $failed_config
sed -i "s/ / /" $failed_config
BACKUP_MHSID=$(egrep "GFESUITE_MHSID" ${backup_config})
FAILED_MHSID=$(egrep "GFESUITE_MHSID" ${failed_config})
BACKUP_SERVER=$(egrep "GFESUITE_SERVER" ${backup_config})
FAILED_SERVER=$(egrep "GFESUITE_SERVER" ${failed_config})
BACKUP_LOGDIR=$(egrep "GFESUITE_LOGDIR" ${backup_config})
FAILED_LOGDIR=$(egrep "GFESUITE_LOGDIR" ${failed_config})
BACKUP_PRDDIR=$(egrep "GFESUITE_PRDDIR" ${backup_config})
FAILED_PRDDIR=$(egrep "GFESUITE_PRDDIR" ${failed_config})
sed -i "s/$FAILED_MHSID/$BACKUP_MHSID/" ${failed_config}
sed -i "s/$FAILED_SERVER/$BACKUP_SERVER/" ${failed_config}
sed -i "s/$FAILED_LOGDIR/$BACKUP_LOGDIR/" ${failed_config}
sed -i "s/$FAILED_PRDDIR/$BACKUP_PRDDIR/" ${failed_config}
sed -i "s/98000000/$SVCBU_FAILED_SITE_PORT/" ${failed_config}
cd ${SVCBU_HOME}
rm -rf *
rm -f ${LOCK_DIR}/importConfiguration
rm -f ${LOCK_DIR}/trMode
log_msg 100
touch ${LOCK_DIR}/${SITE}svcbuMode
log_msg "Configuration Import Complete!"

View file

@ -1,146 +0,0 @@
#!/bin/bash
##
# This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
#
# U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination
# to non-U.S. persons whether in the United States or abroad requires
# an export license or other authorization.
#
# Contractor Name: Raytheon Company
# Contractor Address: 6825 Pine Street, Suite 340
# Mail Stop B8
# Omaha, NE 68106
# 402.291.0100
#
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information.
##
##############################################################################
# Process Received Digital Grids
# This is run at the backup site to merge the failed site's grids into the
# Fcst database.
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 06/16/15 3276 randerso Added -T to iscMosaic call
##############################################################################
import_file=${1}
log_msg Processing file: $import_file
FILESIZE=$(stat -c%s "$import_file")
log_msg "File Size is: $FILESIZE bytes."
if [ -a ${import_file} ]
then
#
# Create a Service Backup directory
#
#
if [ ! -d ${SVCBU_HOME} ]
then
mkdir ${SVCBU_HOME}
else
rm -rf ${SVCBU_HOME}/*.txt
fi
#
# Determine the 3 letter failed site id
#
log_msg "import_file ${import_file}"
sleep 2
cd ${SVCBU_HOME}
tar xvf ${import_file} siteID.txt
if [ $? -eq 0 ] && [ -a ${SVCBU_HOME}/siteID.txt ];
then
log_msg siteID.txt found. Using it...
export failed_site=`cat ${SVCBU_HOME}/siteID.txt`
if [ -z "${failed_site}" ];
then
log_msg "failed site id not found."
log_msg 100
rm -f ${LOCK_DIR}/importGrids
touch ${LOCK_DIR}/svcbuerr
exit 1
fi
log_msg "failed_site=$failed_site"
else
#Still need to do this the old way for backward compatibility
tar tvf ${import_file} | while read line
do
log_msg "Using old tar/cut method."
log_msg "line is $line"
# Can we get rid of this ugly thing somehow???
export failed_site=`echo $line | cut -d' ' -f8|cut -d'G' -f1|cut -d'/' -f6`
log_msg "failed site $failed_site"
break
done
fi
log_msg 50
#
# Retrieve the file from the MHS x400 directory
#
log_msg Retrieving the file from the MHS x400 directory...
mv ${import_file} ${SVCBU_HOME}/${failed_site}Grd.tar
cd ${SVCBU_HOME}
#
# Update owner and permissions from root to ifps
#
chmod 777 ${SVCBU_HOME}/${failed_site}Grd.tar
else
log_msg Unable to locate the gridded data of failed site: ${import_file} You will need to initialize your grids from models and guidance
rm -f ${LOCK_DIR}/importGrids
touch ${LOCK_DIR}/svcbuerr
log_msg 100
exit 1
fi
#
log_msg 60
log_msg File copied. Continuing grid processing...
log_msg Unzipping/untarring netcdf file...
sleep 2
tar xOf ${failed_site}Grd.tar > ${failed_site}Grd.netcdf.gz --exclude siteID.txt
if [ $? -ne 0 ]
then
log_msg "ERROR: tar failed to untar ${failed_site}Grd.tar."
rm -f ${LOCK_DIR}/importGrids
touch ${LOCK_DIR}/svcbuerr
log_msg 100
exit 1
fi
rm -f ${failed_site}Grd.netcdf.tar
# use iscMosaic to load grids into databases
log_msg 60
log_msg "Running iscMosaic to unpack gridded data..."
SITE=`echo ${failed_site} | tr '[a-z]' '[A-Z]'`
log_msg "SVCBU_HOST is $SVCBU_HOST"
log_msg "CDSPORT is $CDSPORT"
log_msg Beginning iscMosaic
log_msg 75
${GFESUITE_BIN}/iscMosaic -h $SVCBU_HOST -r $CDSPORT -d ${SITE}_GRID__Fcst_00000000_0000 -f ${SVCBU_HOME}/${failed_site}Grd.netcdf.gz -n -T
if [ $? -ne 0 ]
then
log_msg "ERROR: iscMosaic failed to import grids from ${SITE}_GRID__Fcst_00000000_0000"
log_msg 100
rm -f ${LOCK_DIR}/importGrids
touch ${LOCK_DIR}/svcbuerr
exit 1
fi
log_msg Cleaning up netcdf file
rm ${failed_site}Grd*
log_msg 100
rm -f ${LOCK_DIR}/importGrids
log_msg Digital Data Import Complete!
exit 0

View file

@ -1,4 +1,23 @@
#!/bin/bash #!/bin/bash
##############################################################################
# Process Received Configuration
# This is run at the backup site to import the failed site's grids into the
# localization store.
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 03/20/14 #2933 randerso Changed PRDDIR and LOGDIR to use
# Backup site's configuration
# 01/30/15 #17081 lshi Added backup vtec
# 02/13/15 #4103 dgilling Consolidated process_configuration and
# proc_receive_config into 1 script.
#
##############################################################################
if [ ${#AWIPS_HOME} = 0 ] if [ ${#AWIPS_HOME} = 0 ]
then then
path_to_script=`readlink -f $0` path_to_script=`readlink -f $0`
@ -6,51 +25,209 @@ then
fi fi
. ${AWIPS_HOME}/GFESuite/ServiceBackup/configuration/svcbu.env . ${AWIPS_HOME}/GFESuite/ServiceBackup/configuration/svcbu.env
source ${AWIPS_HOME}/GFESuite/ServiceBackup/scripts/serviceBackupUtil.sh
# $1 = Path to packaged configuration data from MHS
# $2 = site ID for the file
import_file=${1}
SITE_ID=`echo ${2} | tr '[A-Z]' '[a-z]'`
SITE_ID_CAPS=`echo ${SITE_ID}|tr [a-z] [A-Z]`
# Create the log file # Create the log file
logdir=${IFPS_LOG}/`date +%Y%m%d` configureLogging "svcbu_receive_configuration" ${SITE_ID}
logfil=svcbu_receive_configuration_`date +%H%M`
logfile=${logdir}/${logfil}
[ ! -d ${logdir} ] && (umask 000;mkdir ${logdir})
touch ${logdir}/${logfil}
exec 1>${logdir}/${logfil} 2>&1
# Check the status of the lock file to see if we are OK to proceed # Check the status of the lock file to see if we are OK to proceed
if [ ! -f ${LOCK_DIR}/importConfiguration ]; lock_file=$(getLockFile "importConfiguration" ${SITE_ID})
trmode_lock_file=$(getLockFile "trMode" ${SITE_ID})
svcbu_lock_file=$(getLockFile "svcbuMode" ${SITE_ID})
lock_status=$(isOperationInProgress "importConfiguration" ${SITE_ID})
if [[ "${lock_status}" = "false" ]]
then then
log_msg Lock file not present for importing configuration! Cannot continue! echo "Lock file not present for importing configuration! Cannot continue!"
touch ${LOCK_DIR}/svcbuerr echo "FAILED" > ${svcbu_lock_file}
rm -f ${LOCK_DIR}/importConfiguration echo "FAILED" > ${lock_file}
rm -f ${LOCK_DIR}/trMode echo "FAILED" > ${trmode_lock_file}
log_msg 100
exit 1 exit 1
fi fi
USER=$(whoami) USER=$(whoami)
if [ $USER = "root" ] if [ $USER = "root" ]
then then
log_msg "Running script as root" echo "Running script as root"
elif [ $USER = "awips" ] elif [ $USER = "awips" ]
then then
log_msg "Running script as user awips" echo "Running script as user awips"
else else
log_msg "Script must be run as user root or awips" echo "Script must be run as user root or awips"
touch ${LOCK_DIR}/svcbuerr echo "FAILED" > ${svcbu_lock_file}
rm -f ${LOCK_DIR}/importConfiguration echo "FAILED" > ${lock_file}
rm -f ${LOCK_DIR}/trMode echo "FAILED" > ${trmode_lock_file}
log_msg 100
exit 1 exit 1
fi fi
. $SCRIPTS_DIR/proc_receive_config ${1} echo "The import_file is: $import_file"
exitValue=($?) FILESIZE=$(stat -c%s "$import_file")
if [ $exitValue -ne 0 ]; then echo "File Size is: $FILESIZE bytes."
log_msg "Receive configuration returned with errors..."
touch ${LOCK_DIR}/svcbuerr #
rm -f ${LOCK_DIR}/importConfiguration # determine local site id(s) using PRIMARY_SITES
rm -f ${LOCK_DIR}/trMode #
log_msg 100 IFS=',' read -ra PRI_SITES <<< "${PRIMARY_SITES}"
if [ ${#PRI_SITES[@]} -eq 0 ]
then
declare -a PRI_SITES=( "${AW_SITE_IDENTIFIER}" )
fi
echo "My primary GFE sites are: ${PRI_SITES[@]}"
# Determine which host service backup was run from
# if my_site is the same as the failed site, stop
for primary_site in "${PRI_SITES[@]}"
do
primary_site=`echo $primary_site | tr [A-Z] [a-z]`
if [[ "$primary_site" = "${SITE_ID}" ]]
then
echo "You cannot import configuration data for your own site."
echo "FAILED" > ${svcbu_lock_file}
echo "FAILED" > ${lock_file}
echo "FAILED" > ${trmode_lock_file}
exit 1
fi
done
# Retrieve the file from the MHS x400 directory
OUTPUT_DIR=$(getTempDirectory "receive_config" ${SITE_ID})
rm -rf "${OUTPUT_DIR}/*"
echo "Moving ${import_file} to ${OUTPUT_DIR}/svc_bkup_${SITE_ID}.tar"
mv -f ${import_file} ${OUTPUT_DIR}/svc_bkup_${SITE_ID}.tar
# Update owner and permissions from root to ifps
#chown awips:awips ${SVCBU_HOME}/svc_bkup_${SITE}.tar
chmod 777 ${OUTPUT_DIR}/svc_bkup_${SITE_ID}.tar
echo "Extracting files..."
cd ${OUTPUT_DIR}
tar -xvf svc_bkup_${SITE_ID}.tar
gunzip -c GFEconfig.${SITE_ID}.tar.gz | tar xf -
if [ $? -ne 0 ]; then
echo "\nERROR: Could not explode GFEconfig.${SITE_ID}.tar.gz..."
echo "FAILED" > ${svcbu_lock_file}
echo "FAILED" > ${lock_file}
echo "FAILED" > ${trmode_lock_file}
exit 1 exit 1
fi fi
exit 0
echo "Checking format of received configuration data..."
if [ -d GFEconfig ]; then
echo "AWIPS II configuration received. OK to proceed!"
else
echo "Incorrectly formatted configuration received. Cannot continue!"
echo "FAILED" > ${svcbu_lock_file}
echo "FAILED" > ${lock_file}
echo "FAILED" > ${trmode_lock_file}
exit 1
fi
echo "Copying files into position..."
echo "Checking if localization directories exist for ${SITE_ID_CAPS}"
edex_site_dest=${LOCALIZATION_PATH}/edex_static/site/${SITE_ID_CAPS}/config
edex_site_si_dest=${LOCALIZATION_PATH}/edex_static/site/${SITE_ID_CAPS}
common_site_dest=${LOCALIZATION_PATH}/common_static/site/${SITE_ID_CAPS}
cave_site_dest=${LOCALIZATION_PATH}/cave_static/site/${SITE_ID_CAPS}
rsync_parms_dest=/awips2/GFESuite/ServiceBackup/data # DR 16464
if [ -d ${edex_site_dest} ]; then
echo "edex_static site directory exists for ${SITE_ID_CAPS}"
else
echo "Creating edex_static site directory for ${SITE_ID_CAPS}"
mkdir -p ${edex_site_dest}
fi
if [ -d ${common_site_dest} ]; then
echo "common_static site directory exists for ${SITE_ID_CAPS}"
else
echo "Creating common_static site directory for ${SITE_ID_CAPS}"
mkdir -p ${common_site_dest}
fi
if [ -d ${cave_site_dest} ]; then
echo "cave_static site directory exists for ${SITE_ID_CAPS}"
else
echo "Creating cave_static site directory for ${SITE_ID_CAPS}"
mkdir -p ${cave_site_dest}
fi
# DR 16464
if [ -d ${rsync_parms_dest} ]; then
echo "rsync_parms_dest directory exists for ${SITE_ID_CAPS}"
else
echo "Creating rsync_parms_dest directory for ${SITE_ID_CAPS}"
mkdir -p ${rsync_parms_dest}
fi
echo "${SITE_ID_CAPS}'s localization directories have been verified"
cp -r GFEconfig/common_static/site/gfe ${common_site_dest}
cp -r GFEconfig/common_static/site/vtec ${common_site_dest}
cp -r GFEconfig/common_static/site/mixedCase ${common_site_dest}
cp -r GFEconfig/edex_static/site/gfe ${edex_site_dest}
cp -r GFEconfig/edex_static/site/smartinit ${edex_site_si_dest}
cp -r GFEconfig/cave_static/site/* ${cave_site_dest}
# DR 16464
cp -a GFEConfig/site/rsync_parms.${SITE_ID_CAPS} ${rsync_parms_dest}.${SITE_ID_CAPS}
echo "Files successfully copied!"
echo "Changing ownership of received configuration"
if [ $USER = "root" ]
then
chown -R awips:fxalpha ${LOCALIZATION_PATH}/edex_static/site/${SITE_ID_CAPS}
chown -R awips:fxalpha ${LOCALIZATION_PATH}/common_static/site/${SITE_ID_CAPS}
chown -R awips:fxalpha ${LOCALIZATION_PATH}/cave_static/site/${SITE_ID_CAPS}
chown -R awips:fxalpha /awips2/GFESuite/ServiceBackup/data # DR 16464
elif [ $USER = "awips" ]
then
echo "Files already owned by awips"
fi
#
# DR21404 - disable ISC/VTEC for troubleshooting mode
#
if [ -f ${trmode_lock_file} ]; then
echo "Activating troubleshooting mode..."
rm -f ${LOCALIZATION_PATH}/common_static/site/${SITE_ID_CAPS}/vtec/localVTECPartners.py*
echo "serverConfig.REQUEST_ISC = 0" >> ${LOCALIZATION_PATH}/edex_static/site/${SITE_ID_CAPS}/config/gfe/localConfig.py
echo "serverConfig.SEND_ISC_ON_SAVE = 0" >> ${LOCALIZATION_PATH}/edex_static/site/${SITE_ID_CAPS}/config/gfe/localConfig.py
echo "serverConfig.SEND_ISC_ON_PUBLISH = 0" >> ${LOCALIZATION_PATH}/edex_static/site/${SITE_ID_CAPS}/config/gfe/localConfig.py
fi
echo "Updating siteConfig.py..."
#Change the MHS ID of the received configuration
my_site_id=`echo ${PRI_SITES[0]} |tr [a-z] [A-Z]`
backup_config=${LOCALIZATION_PATH}/edex_static/site/${my_site_id}/config/gfe/siteConfig.py
failed_config=${LOCALIZATION_PATH}/edex_static/site/${SITE_ID_CAPS}/config/gfe/siteConfig.py
sed -i "s/ / /" $failed_config
sed -i "s/ / /" $failed_config
BACKUP_MHSID=$(egrep "GFESUITE_MHSID" ${backup_config})
FAILED_MHSID=$(egrep "GFESUITE_MHSID" ${failed_config})
BACKUP_SERVER=$(egrep "GFESUITE_SERVER" ${backup_config})
FAILED_SERVER=$(egrep "GFESUITE_SERVER" ${failed_config})
BACKUP_LOGDIR=$(egrep "GFESUITE_LOGDIR" ${backup_config})
FAILED_LOGDIR=$(egrep "GFESUITE_LOGDIR" ${failed_config})
BACKUP_PRDDIR=$(egrep "GFESUITE_PRDDIR" ${backup_config})
FAILED_PRDDIR=$(egrep "GFESUITE_PRDDIR" ${failed_config})
sed -i "s/$FAILED_MHSID/$BACKUP_MHSID/" ${failed_config}
sed -i "s/$FAILED_SERVER/$BACKUP_SERVER/" ${failed_config}
sed -i "s/$FAILED_LOGDIR/$BACKUP_LOGDIR/" ${failed_config}
sed -i "s/$FAILED_PRDDIR/$BACKUP_PRDDIR/" ${failed_config}
sed -i "s/98000000/$SVCBU_FAILED_SITE_PORT/" ${failed_config}
# Cleanup
rm -rf "${OUTPUT_DIR}/*"
echo "SUCCESS" > ${lock_file}
echo "SUCCESS" > ${trmode_lock_file}
echo "SUCCESS" > ${svcbu_lock_file}
echo "Configuration Import Complete!"
exit 0

View file

@ -1,4 +1,40 @@
#!/bin/bash #!/bin/bash
##
# This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
#
# U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination
# to non-U.S. persons whether in the United States or abroad requires
# an export license or other authorization.
#
# Contractor Name: Raytheon Company
# Contractor Address: 6825 Pine Street, Suite 340
# Mail Stop B8
# Omaha, NE 68106
# 402.291.0100
#
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information.
##
##############################################################################
# Process Received Digital Grids
# This is run at the backup site to merge the failed site's grids into the
# Fcst database.
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 06/16/14 3276 randerso Added -T to iscMosaic call
# 02/12/15 4103 dgilling Consolidated process_grids and
# proc_receive_grids into 1 script.
#
##############################################################################
if [ ${#AWIPS_HOME} = 0 ] if [ ${#AWIPS_HOME} = 0 ]
then then
path_to_script=`readlink -f $0` path_to_script=`readlink -f $0`
@ -6,32 +42,74 @@ then
fi fi
. ${AWIPS_HOME}/GFESuite/ServiceBackup/configuration/svcbu.env . ${AWIPS_HOME}/GFESuite/ServiceBackup/configuration/svcbu.env
source ${AWIPS_HOME}/GFESuite/ServiceBackup/scripts/serviceBackupUtil.sh
# $1 = Path to packaged netcdf file received from MHS
# $2 = site ID for the file
import_file=${1}
SITE_ID=`echo ${2} | tr '[A-Z]' '[a-z]'`
# Create the log file # Create the log file
logdir=${IFPS_LOG}/`date +%Y%m%d` configureLogging "svcbu_receive_grids" ${SITE_ID}
logfil=svcbu_receive_grids_`date +%H%M`
logfile=${logdir}/${logfil}
[ ! -d ${logdir} ] && (umask 000;mkdir ${logdir})
touch ${logdir}/${logfil}
exec 1>${logdir}/${logfil} 2>&1
# Check the status of the lock file to see if we are OK to proceed # Check the status of the lock file to see if we are OK to proceed
if [ ! -f ${LOCK_DIR}/importGrids ]; lock_file=$(getLockFile "importGrids" ${SITE_ID})
lock_status=$(isOperationInProgress "importGrids" ${SITE_ID})
if [[ "${lock_status}" = "false" ]]
then then
log_msg Lock file not present for importing grids! Cannot continue! echo "Lock file not present for importing grids! Cannot continue!"
touch ${LOCK_DIR}/svcbuerr echo "FAILED" > ${lock_file}
rm -f ${LOCK_DIR}/importGrids
log_msg 100
exit 1 exit 1
fi fi
. $SCRIPTS_DIR/proc_receive_grids ${1} echo "Processing file: $import_file"
exitValue=($?) FILESIZE=$(stat -c%s "$import_file")
if [ $exitValue -ne 0 ]; then echo "File Size is: $FILESIZE bytes."
log_msg "Receive grids returned with errors..."
touch ${LOCK_DIR}/svcbuerr #
rm -f ${LOCK_DIR}/importGrids # Retrieve the file from the MHS x400 directory
log_msg 100 #
echo "Retrieving the file from the MHS x400 directory..."
OUTPUT_DIR=$(getTempDirectory "receive_grids" ${SITE_ID})
mv ${import_file} ${OUTPUT_DIR}/${SITE_ID}Grd.tar
cd ${OUTPUT_DIR}
#
# Update owner and permissions from root to ifps
#
chmod 777 ${OUTPUT_DIR}/${SITE_ID}Grd.tar
echo "File copied. Continuing grid processing..."
echo "Unzipping/untarring netcdf file..."
sleep 2
tar -xOf ${SITE_ID}Grd.tar > ${SITE_ID}Grd.netcdf.gz --exclude siteID.txt
if [ $? -ne 0 ]
then
echo "ERROR: tar failed to untar ${SITE_ID}Grd.tar."
echo "FAILED" > ${lock_file}
exit 1
fi
rm -f ${SITE_ID}Grd.tar
# use iscMosaic to load grids into databases
echo "Running iscMosaic to unpack gridded data..."
SITE_ID_CAPS=`echo ${SITE_ID} | tr '[a-z]' '[A-Z]'`
echo "SVCBU_HOST is $SVCBU_HOST"
echo "CDSPORT is $CDSPORT"
echo "Beginning iscMosaic"
${GFESUITE_BIN}/iscMosaic -h $SVCBU_HOST -r $CDSPORT -d ${SITE_ID_CAPS}_GRID__Fcst_00000000_0000 -f ${OUTPUT_DIR}/${SITE_ID}Grd.netcdf.gz -n -T
if [ $? -ne 0 ]
then
echo "ERROR: iscMosaic failed to import grids from ${SITE_ID_CAPS}_GRID__Fcst_00000000_0000"
echo "FAILED" > ${lock_file}
exit 1 exit 1
fi fi
echo "Cleaning up netcdf file"
rm -f ${SITE_ID}Grd*
echo "SUCCESS" > ${lock_file}
echo "Digital Data Import Complete!"
exit 0 exit 0

View file

@ -19,13 +19,16 @@
# further licensing information. # further licensing information.
## ##
############################################################################## ##############################################################################
# TODO: ADD DESCRIPTION # This script is triggered by MHS when the requested failed site's
# localization data is sent to the backup site.
# #
# SOFTWARE HISTORY # SOFTWARE HISTORY
# #
# Date Ticket# Engineer Description # Date Ticket# Engineer Description
# ------------ ---------- ----------- -------------------------- # ------------ ---------- ----------- --------------------------
# 05/10/11 8688 dgilling Initial Creation. # 05/10/11 8688 dgilling Initial Creation.
# 02/12/15 4103 dgilling Pre-emptively determine site id.
#
############################################################################## ##############################################################################
# this allows you to run this script from outside of ./bin # this allows you to run this script from outside of ./bin
@ -36,6 +39,7 @@ BASE_AWIPS_DIR=`dirname $RUN_FROM_DIR`
# get the base environment # get the base environment
source /awips2/GFESuite/bin/setup.env source /awips2/GFESuite/bin/setup.env
source /awips2/GFESuite/ServiceBackup/scripts/serviceBackupUtil.sh
# setup the environment needed to run the the Python # setup the environment needed to run the the Python
export LD_LIBRARY_PATH=${PYTHON_INSTALL}/lib export LD_LIBRARY_PATH=${PYTHON_INSTALL}/lib
@ -45,6 +49,25 @@ export PYTHONPATH=${RUN_FROM_DIR}/src:$PYTHONPATH
_PYTHON="${PYTHON_INSTALL}/bin/python" _PYTHON="${PYTHON_INSTALL}/bin/python"
_MODULE="/awips2/GFESuite/ServiceBackup/scripts/receive_configuration.py" _MODULE="/awips2/GFESuite/ServiceBackup/scripts/receive_configuration.py"
# quoting of '$@' is used to prevent command line interpretation # Determine the 3 letter failed site id
$_PYTHON $_MODULE -h localhost -r 9581 "$@" RECEIVED_FILE=${1}
if [[ -f ${RECEIVED_FILE} ]]
then
SITE_ID=$(getSiteIdFromTarFile "${RECEIVED_FILE}")
if [[ -z "${SITE_ID}" ]]
then
#Still need to do this the old way for backward compatibility
echo "Using the old tar/cut method"
tar -tf ${RECEIVED_FILE} | while read line
do
SITE_ID=`echo $line | cut -d. -f2`
break
done
fi
else
echo "Unable to locate ${RECEIVED_FILE}. Service backup exits now"
exit 1
fi
$_PYTHON $_MODULE -h localhost -r 9581 ${RECEIVED_FILE} ${SITE_ID}

View file

@ -24,7 +24,6 @@ import os
from dynamicserialize.dstypes.com.raytheon.uf.common.dataplugin.gfe.request import ProcessReceivedConfRequest from dynamicserialize.dstypes.com.raytheon.uf.common.dataplugin.gfe.request import ProcessReceivedConfRequest
from dynamicserialize.dstypes.com.raytheon.uf.common.message import WsId from dynamicserialize.dstypes.com.raytheon.uf.common.message import WsId
from dynamicserialize import DynamicSerializationManager
from ufpy import ThriftClient, ConfigFileUtil from ufpy import ThriftClient, ConfigFileUtil
@ -37,6 +36,7 @@ from ufpy import ThriftClient, ConfigFileUtil
# Date Ticket# Engineer Description # Date Ticket# Engineer Description
# ------------ ---------- ----------- -------------------------- # ------------ ---------- ----------- --------------------------
# 08/04/11 bphillip Initial Creation. # 08/04/11 bphillip Initial Creation.
# 02/12/15 #4103 dgilling Set site ID field.
# #
# #
# #
@ -66,8 +66,8 @@ def createRequest():
wsId = WsId(progName="receive_configuration") wsId = WsId(progName="receive_configuration")
obj.setWorkstationID(wsId) obj.setWorkstationID(wsId)
obj.setSiteID("") obj.setSiteID(str(sys.argv[6]).upper())
obj.setReceivedConfFile(sys.argv[5]) obj.setReceivedConfFile(str(sys.argv[5]))
return obj return obj
if __name__ == '__main__': if __name__ == '__main__':

View file

@ -19,13 +19,16 @@
# further licensing information. # further licensing information.
## ##
############################################################################## ##############################################################################
# TODO: ADD DESCRIPTION # This script is triggered by MHS when the requested failed site's grids are
# sent to the backup site.
# #
# SOFTWARE HISTORY # SOFTWARE HISTORY
# #
# Date Ticket# Engineer Description # Date Ticket# Engineer Description
# ------------ ---------- ----------- -------------------------- # ------------ ---------- ----------- --------------------------
# 05/10/11 8688 dgilling Initial Creation. # 05/10/11 8688 dgilling Initial Creation.
# 02/12/15 4103 dgilling Pre-emptively determine site id.
#
############################################################################## ##############################################################################
# this allows you to run this script from outside of ./bin # this allows you to run this script from outside of ./bin
@ -36,6 +39,7 @@ BASE_AWIPS_DIR=`dirname $RUN_FROM_DIR`
# get the base environment # get the base environment
source /awips2/GFESuite/bin/setup.env source /awips2/GFESuite/bin/setup.env
source /awips2/GFESuite/ServiceBackup/scripts/serviceBackupUtil.sh
# setup the environment needed to run the the Python # setup the environment needed to run the the Python
export LD_LIBRARY_PATH=${PYTHON_INSTALL}/lib export LD_LIBRARY_PATH=${PYTHON_INSTALL}/lib
@ -45,6 +49,27 @@ export PYTHONPATH=${RUN_FROM_DIR}/src:$PYTHONPATH
_PYTHON="${PYTHON_INSTALL}/bin/python" _PYTHON="${PYTHON_INSTALL}/bin/python"
_MODULE="/awips2/GFESuite/ServiceBackup/scripts/receive_grids.py" _MODULE="/awips2/GFESuite/ServiceBackup/scripts/receive_grids.py"
# quoting of '$@' is used to prevent command line interpretation RECEIVED_FILE=${1}
$_PYTHON $_MODULE -h localhost -r 9581 "$@" if [[ -f ${RECEIVED_FILE} ]]
then
SITE_ID=$(getSiteIdFromTarFile "${RECEIVED_FILE}")
if [[ -z "${SITE_ID}" ]]
then
#Still need to do this the old way for backward compatibility
tar -tvf ${import_file} | while read line
do
echo "Using old tar/cut method."
echo "line is $line"
# Can we get rid of this ugly thing somehow???
SITE_ID=`echo $line | cut -d' ' -f8|cut -d'G' -f1|cut -d'/' -f6`
echo "failed site $SITE_ID"
break
done
fi
else
echo "Unable to locate the gridded data of failed site: ${import_file}. You will need to initialize your grids from models and guidance"
exit 1
fi
$_PYTHON $_MODULE -h localhost -r 9581 ${RECEIVED_FILE} ${SITE_ID}

View file

@ -24,7 +24,6 @@ import os
from dynamicserialize.dstypes.com.raytheon.uf.common.dataplugin.gfe.request import ProcessReceivedDigitalDataRequest from dynamicserialize.dstypes.com.raytheon.uf.common.dataplugin.gfe.request import ProcessReceivedDigitalDataRequest
from dynamicserialize.dstypes.com.raytheon.uf.common.message import WsId from dynamicserialize.dstypes.com.raytheon.uf.common.message import WsId
from dynamicserialize import DynamicSerializationManager
from ufpy import ThriftClient, ConfigFileUtil from ufpy import ThriftClient, ConfigFileUtil
@ -37,6 +36,7 @@ from ufpy import ThriftClient, ConfigFileUtil
# Date Ticket# Engineer Description # Date Ticket# Engineer Description
# ------------ ---------- ----------- -------------------------- # ------------ ---------- ----------- --------------------------
# 08/04/11 bphillip Initial Creation. # 08/04/11 bphillip Initial Creation.
# 02/12/15 #4103 dgilling Set site ID field.
# #
# #
# #
@ -67,8 +67,8 @@ def createRequest():
wsId = WsId(progName="receive_grids") wsId = WsId(progName="receive_grids")
obj.setWorkstationID(wsId) obj.setWorkstationID(wsId)
obj.setSiteID("") obj.setSiteID(str(sys.argv[6]).upper())
obj.setReceivedDataFile(sys.argv[5]) obj.setReceivedDataFile(str(sys.argv[5]))
return obj return obj
if __name__ == '__main__': if __name__ == '__main__':

View file

@ -27,7 +27,8 @@
# #
# Date Ticket# Engineer Description # Date Ticket# Engineer Description
# ------------ ---------- ----------- -------------------------- # ------------ ---------- ----------- --------------------------
# 06/16/15 3276 randerso Added -T to iscMosaic call # 06/16/14 3276 randerso Added -T to iscMosaic call
# 02/12/15 4103 dgilling Support multiple service backup sites.
############################################################################## ##############################################################################
if [ ${#AWIPS_HOME} = 0 ] if [ ${#AWIPS_HOME} = 0 ]
@ -37,121 +38,109 @@ then
fi fi
. ${AWIPS_HOME}/GFESuite/ServiceBackup/configuration/svcbu.env . ${AWIPS_HOME}/GFESuite/ServiceBackup/configuration/svcbu.env
source ${AWIPS_HOME}/GFESuite/ServiceBackup/scripts/serviceBackupUtil.sh
# Create the log file # Create the log file
logdir=${IFPS_LOG}/`date +%Y%m%d` configureLogging "svcbu_receive_grids_from_bksite" ${AW_SITE_IDENTIFIER}
logfil=svcbu_receive_grids_from_bksite`date +%H%M`
logfile=${logdir}/${logfil}
[ ! -d ${logdir} ] && (umask 000;mkdir ${logdir})
touch ${logdir}/${logfil}
exec 1>${logdir}/${logfil} 2>&1
# Check the status of the lock file to see if we are OK to proceed
if [ -f ${LOCK_DIR}/importBkSiteGrids ];
then
log_msg Cannot process grids.
exit 1
fi
touch ${LOCK_DIR}/importBkSiteGrids
log_msg 0
# Retrieve the name of the site from the tar file. # Retrieve the name of the site from the tar file.
import_grd_file=${1} import_grd_file=${1}
if [ -a ${import_grd_file} ] if [ -f ${import_grd_file} ]
then then
echo "Import Grids file is ${import_grd_file}"
log_msg "Import Grids file is ${import_grd_file}" TEMP_DIR=`mktemp -d`
mv ${import_grd_file} ${GFESUITE_HOME}/Grd mv ${import_grd_file} ${TEMP_DIR}/Grd
cd ${GFESUITE_HOME} cd ${TEMP_DIR}
tar xf Grd SITE_ID=$(getSiteIdFromTarFile "${TEMP_DIR}/Grd")
if [ $? -eq 0 ]; then if [[ -n "${SITE_ID}" ]]
SITE=`cat siteID.txt | tr '[a-z]' '[A-Z]'` then
site=`echo $SITE | tr '[A-Z]' '[a-z]'` tar -xf Grd
gunzip -f ${site}Grd.netcdf.gz gunzip -f ${SITE_ID}Grd.netcdf.gz
else NETCDF_FILE="${TEMP_DIR}/${SITE_ID}Grd.netcdf"
# move the file to appropriate directory. else
mv -f Grd Grd.netcdf.gz mv -f Grd Grd.netcdf.gz
chmod 777 Grd.netcdf.gz chmod 777 Grd.netcdf.gz
log_msg "Gunzipping ${GFESUITE_HOME}/Grd.netcdf.gz" echo "Gunzipping ${TEMP_DIR}/Grd.netcdf.gz"
gunzip -f Grd.netcdf.gz gunzip -f Grd.netcdf.gz
if [ $? -ne 0 ]; if [ $? -ne 0 ];
then then
log_msg "ERROR: Could not gunzip ${GFESUITE_HOME}/Grd.netcdf.gz" echo "ERROR: Could not gunzip ${TEMP_DIR}/Grd.netcdf.gz"
rm -f ${LOCK_DIR}/importBkSiteGrids exit 1
log_msg 100
exit 1
fi fi
log_msg "Done Gunzipping!" echo "Done Gunzipping!"
log_msg "Finding site-id using ncdump method." echo "Finding site-id using ncdump method."
hdr=`mktemp` site=`ncdump -h "${TEMP_DIR}/Grd.netcdf" | grep siteID | head -1 | cut -d'"' -f2`
ncdump -h ${GFESUITE_HOME}/Grd.netcdf > $hdr if [[ -z "${site}" ]]
SITE=`grep siteID $hdr | head -1 | cut -d'"' -f2`
site=`echo $SITE | tr '[A-Z]' '[a-z]'`
if [ -z $site ]
then then
log_msg "ERROR: Could not find out the site from ncdump method..." echo "ERROR: Could not find out the site from ncdump method..."
rm -f $hdr exit 1
rm -f ${LOCK_DIR}/importBkSiteGrids
log_msg 100
exit 1
fi fi
SITE_ID=`echo $site | tr '[A-Z]' '[a-z]'`
mv -f ${GFESUITE_HOME}/Grd.netcdf ${GFESUITE_HOME}/${site}Grd.netcdf NETCDF_FILE="${TEMP_DIR}/${SITE_ID}Grd.netcdf"
rm -f $hdr mv -f "${TEMP_DIR}/Grd.netcdf" ${NETCDF_FILE}
fi fi
log_msg "site is $site"
SITE_ID_CAPS=`echo ${SITE_ID} | tr [a-z] [A-Z]`
echo "site is ${SITE_ID_CAPS}"
else else
log_msg "Unable to locate the gridded data of the site, ${import_grd_file}" echo "Unable to locate the gridded data of the site, ${import_grd_file}"
log_msg "You will need to request your backup site to send grids again." echo "You will need to request your backup site to send grids again."
log_msg 100
rm -f ${LOCK_DIR}/importBkSiteGrids
exit 1 exit 1
fi fi
# Check the status of the lock file to see if we are OK to proceed
LOCK_FILE=$(getLockFile "importBkSiteGrids" ${SITE_ID})
lock_status=$(isOperationInProgress "importBkSiteGrids" ${SITE_ID})
if [[ "${lock_status}" = "true" ]]
then
echo "Cannot process grids."
exit 1
fi
echo "IN_PROGRESS" > ${LOCK_FILE}
# extract grids from package file
OUTPUT_DIR=$(getTempDirectory "receive_grids_from_backup_site" ${SITE_ID})
mv "${NETCDF_FILE}" "${OUTPUT_DIR}/${SITE_ID}Grd.netcdf"
log_msg 50
# Check if import file was supplied correctly by msg_send. # Check if import file was supplied correctly by msg_send.
import_file=${GFESUITE_HOME}/${site}Grd.netcdf import_file=${OUTPUT_DIR}/${SITE_ID}Grd.netcdf
log_msg "import_file=${import_file}" echo "import_file=${import_file}"
SITE=`echo ${SITE} | tr '[a-z]' '[A-Z]'`
if [ -a ${import_file} ] if [ -f ${import_file} ]
then then
#use iscMosaic to load grids into databases #use iscMosaic to load grids into databases
log_msg "Running iscMosaic to unpack griddded data..." echo "Running iscMosaic to unpack griddded data..."
${GFESUITE_BIN}/iscMosaic -h $SVCBU_HOST -r $CDSPORT -d ${SITE}_GRID__Restore_00000000_0000 -f ${import_file} -n -T -x ${GFESUITE_BIN}/iscMosaic -h $SVCBU_HOST -r $CDSPORT -d ${SITE_ID_CAPS}_GRID__Restore_00000000_0000 -f ${import_file} -n -T -x
if [ $? -ne 0 ]; if [ $? -ne 0 ];
then then
log_msg "ERROR: iscMosaic failed to run correctly. Please re-run iscMosaic manually." echo "ERROR: iscMosaic failed to run correctly. Please re-run iscMosaic manually."
log_msg 100 echo "FAILED" > ${LOCK_FILE}
rm -f ${LOCK_DIR}/importBkSiteGrids
exit 1 exit 1
fi fi
log_msg "Finished running iscMosaic..." echo "Finished running iscMosaic..."
# Generate a GFE message saying new Grids have arrived in Restore database. # Generate a GFE message saying new Grids have arrived in Restore database.
cd ${GFESUITE_BIN} cd ${GFESUITE_BIN}
./sendGfeMessage -h ${SVCBU_HOST} -p ${CDSPORT} -u -m "Restore database has been populated with new grids." ./sendGfeMessage -h ${SVCBU_HOST} -p ${CDSPORT} -u -m "Restore database has been populated with new grids."
else else
log_msg "Unable to locate the gridded data of the site,${import_file} You will need to request your backup site to send grids again." echo "Unable to locate the gridded data of the site,${import_file} You will need to request your backup site to send grids again."
log_msg 100 echo "FAILED" > ${LOCK_FILE}
rm -f ${LOCK_DIR}/importBkSiteGrids
exit 1 exit 1
fi fi
#clean-up. #clean-up.
rm -f ${GFESUITE_HOME}/Grd rm -f ${import_file}
rm -f ${GFESUITE_HOME}/${SITE}Grd* siteID.txt rm -rf ${TEMP_DIR}
log_msg 100 echo "SUCCESS" > ${LOCK_FILE}
rm -f ${LOCK_DIR}/importBkSiteGrids
#ALL well, send a msg and get out of here #ALL well, send a msg and get out of here
log_msg "Importing Grids from backup site is completed. You may start your GFE now." echo "Importing Grids from backup site is completed. You may start your GFE now."
log_msg "Grids received from backup site are stored in ${SITE}_GRID__Restore_00000000_0000 database." echo "Grids received from backup site are stored in ${SITE_ID_CAPS}_GRID__Restore_00000000_0000 database."
exit 0 exit 0

View file

@ -1,69 +1,100 @@
#!/bin/bash #!/bin/bash
##
# This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
#
# U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination
# to non-U.S. persons whether in the United States or abroad requires
# an export license or other authorization.
#
# Contractor Name: Raytheon Company
# Contractor Address: 6825 Pine Street, Suite 340
# Mail Stop B8
# Omaha, NE 68106
# 402.291.0100
#
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information.
#
##
##
#
# SOFTWARE HISTORY
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# Feb 09, 2015 #4103 dgilling Refactored to support multiple svcbu
# sites.
#
##
if [ ${#AWIPS_HOME} = 0 ] if [ ${#AWIPS_HOME} = 0 ]
then then
path_to_script=`readlink -f $0` path_to_script=`readlink -f $0`
export AWIPS_HOME=$(dirname $(dirname $(dirname $(dirname $path_to_script)))) export AWIPS_HOME=$(dirname $(dirname $(dirname $(dirname $path_to_script))))
fi fi
# $1 = Primary site # $1 = Failed site
# $2 = Failed site # $2 = enable/disable troubleshooting mode
# $3 = enable/disable troubleshooting mode
if [ $# -ne 3 ] if [ $# -ne 2 ]
then then
log_msg "Incorrect number of arguments\nCorrect usage: request_configuration primary_site failed_site trMode" echo "Incorrect number of arguments\nCorrect usage: request_configuration failed_site trMode"
exit 1 exit 1
fi fi
. ${AWIPS_HOME}/GFESuite/ServiceBackup/configuration/svcbu.env . ${AWIPS_HOME}/GFESuite/ServiceBackup/configuration/svcbu.env
source ${AWIPS_HOME}/GFESuite/ServiceBackup/scripts/serviceBackupUtil.sh
FAILED_SITE="${1}"
# Create the log file # Create the log file
logdir=${IFPS_LOG}/`date +%Y%m%d` configureLogging "svcbu_request_configuration" ${FAILED_SITE}
logfil=svcbu_request_configuration_`date +%H%M`
logfile=${logdir}/${logfil}
[ ! -d ${logdir} ] && (umask 000;mkdir ${logdir})
touch ${logdir}/${logfil}
exec 1>${logdir}/${logfil} 2>&1
# Check the status of the lock file to see if we are OK to proceed # Check the status of the lock file to see if we are OK to proceed
if [ -f ${LOCK_DIR}/importConfiguration ]; import_lock_file=$(getLockFile "importConfiguration" ${FAILED_SITE})
import_lock_status=$(isOperationInProgress "importConfiguration" ${FAILED_SITE})
trmode_lock_file=$(getLockFile "trMode" ${FAILED_SITE})
if [[ "${import_lock_status}" = "true" ]]
then then
log_msg Cannot import configuration for $2. Import configuration process already in progress! echo "Cannot import configuration for ${FAILED_SITE}. Import configuration process already in progress!"
exit 1 exit 1
fi fi
touch ${LOCK_DIR}/importConfiguration echo "IN_PROGRESS" > ${import_lock_file}
if [ $3 -eq 1 ]; then if [ $2 -eq 1 ]; then
touch ${LOCK_DIR}/trMode echo "IN_PROGRESS" > ${trmode_lock_file}
log_msg "You are in troubleshooting mode - no ISC/VTEC will be available" echo "You are in troubleshooting mode - no ISC/VTEC will be available"
fi fi
log_msg Contacting central server to get configuration for ${2} echo "Contacting central server to get configuration for ${FAILED_SITE}"
log_msg 0
if [ -n "${SVCBU_WMO_HEADER}" ]; then if [ -n "${SVCBU_WMO_HEADER}" ]; then
msgSendOutput=$($MSG_SEND_COMMAND -a "DEFAULTNCF" -i ${SVCBU_WMO_HEADER} -s ${2}2 -c 21 -p 1) msgSendOutput=$($MSG_SEND_COMMAND -a "DEFAULTNCF" -i ${SVCBU_WMO_HEADER} -s ${FAILED_SITE}2 -c 21 -p 1)
exitValue=$? exitValue=$?
if [ $exitValue -ne 0 ]; then if [ $exitValue -ne 0 ]; then
log_msg "msg_send failed while requesting configuration for ${CAPS_SITE}`date`" echo "msg_send failed while requesting configuration for ${FAILED_SITE}`date`"
rm -f ${LOCK_DIR}/importConfiguration echo "FAILED" > ${import_lock_file}
rm -f ${LOCK_DIR}/trMode echo "FAILED" > ${trmode_lock_file}
log_msg "msg_send FAILED with exit value $exitValue and the following error: $msgSendOutput" echo "msg_send FAILED with exit value $exitValue and the following error: $msgSendOutput"
exit 1 exit 1
fi fi
else else
msgSendOutput=$($MSG_SEND_COMMAND -a "DEFAULTNCF" -s ${SITE}2 -c 21 -p 1) msgSendOutput=$($MSG_SEND_COMMAND -a "DEFAULTNCF" -s ${FAILED_SITE}2 -c 21 -p 1)
exitValue=$? exitValue=$?
if [ $exitValue -ne 0 ]; then if [ $exitValue -ne 0 ]; then
log_msg "msg_send failed while requesting configuration for ${2}`date`" echo "msg_send failed while requesting configuration for ${FAILED_SITE}`date`"
rm -f ${LOCK_DIR}/importConfiguration echo "FAILED" > ${import_lock_file}
rm -f ${LOCK_DIR}/trMode echo "FAILED" > ${trmode_lock_file}
log_msg "msg_send FAILED with exit value $exitValue and the following error: $msgSendOutput" echo "msg_send FAILED with exit value $exitValue and the following error: $msgSendOutput"
exit 1 exit 1
fi fi
fi fi
log_msg Successfully sent message. MESSAGE ID: $msgSendOutput echo "Successfully sent message. MESSAGE ID: $msgSendOutput"
log_msg 30 echo "Waiting to receive configuration..."
log_msg "Waiting to receive configuration..."
exit 0 exit 0

View file

@ -1,42 +1,73 @@
#!/bin/bash #!/bin/bash
##
# This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
#
# U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination
# to non-U.S. persons whether in the United States or abroad requires
# an export license or other authorization.
#
# Contractor Name: Raytheon Company
# Contractor Address: 6825 Pine Street, Suite 340
# Mail Stop B8
# Omaha, NE 68106
# 402.291.0100
#
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information.
#
##
##
#
# SOFTWARE HISTORY
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# Feb 09, 2015 #4103 dgilling Refactored to support multiple svcbu
# sites.
#
##
if [ ${#AWIPS_HOME} = 0 ] if [ ${#AWIPS_HOME} = 0 ]
then then
path_to_script=`readlink -f $0` path_to_script=`readlink -f $0`
export AWIPS_HOME=$(dirname $(dirname $(dirname $(dirname $path_to_script)))) export AWIPS_HOME=$(dirname $(dirname $(dirname $(dirname $path_to_script))))
fi fi
# $1 = Primary site # $1 = Failed site
# $2 = Failed site
if [ $# -ne 2 ] if [ $# -ne 1 ]
then then
log_msg "Incorrect number of arguments\nCorrect usage: request_grids primary_site failed_site" echo "Incorrect number of arguments\nCorrect usage: request_grids failed_site"
exit 1 exit 1
fi fi
. ${AWIPS_HOME}/GFESuite/ServiceBackup/configuration/svcbu.env . ${AWIPS_HOME}/GFESuite/ServiceBackup/configuration/svcbu.env
source ${AWIPS_HOME}/GFESuite/ServiceBackup/scripts/serviceBackupUtil.sh
FAILED_SITE="${1}"
# Create the log file # Create the log file
logdir=${IFPS_LOG}/`date +%Y%m%d` configureLogging "svcbu_request_grids" ${FAILED_SITE}
logfil=svcbu_request_grids_`date +%H%M`
logfile=${logdir}/${logfil}
[ ! -d ${logdir} ] && (umask 000;mkdir ${logdir})
touch ${logdir}/${logfil}
exec 1>${logdir}/${logfil} 2>&1
# Check the status of the lock file to see if we are OK to proceed # Check the status of the lock file to see if we are OK to proceed
if [ -f ${LOCK_DIR}/importGrids ]; lock_file=$(getLockFile "importGrids" ${FAILED_SITE})
lock_status=$(isOperationInProgress "importGrids" ${FAILED_SITE})
if [[ "${lock_status}" = "true" ]]
then then
log_msg Cannot import grids for $2. Import grids process already in progress! echo "Cannot import grids for ${FAILED_SITE}. Import grids process already in progress!"
exit 1 exit 1
fi fi
touch ${LOCK_DIR}/importGrids echo "IN_PROGRESS" > ${lock_file}
log_msg Contacting central server to get grids for ${2} echo "Contacting central server to get grids for ${FAILED_SITE}"
log_msg 0
sub=${2}Grd sub=${FAILED_SITE}Grd
if [ ! -d ${SVCBU_HOME} ] if [ ! -d ${SVCBU_HOME} ]
then then
mkdir ${SVCBU_HOME} mkdir ${SVCBU_HOME}
@ -46,21 +77,20 @@ if [ -n "${SVCBU_WMO_HEADER}" ]; then
msgSendOutput=$($MSG_SEND_COMMAND -a "DEFAULTNCF" -i ${SVCBU_WMO_HEADER} -s $sub -c 23) msgSendOutput=$($MSG_SEND_COMMAND -a "DEFAULTNCF" -i ${SVCBU_WMO_HEADER} -s $sub -c 23)
exitValue=$? exitValue=$?
if [ $exitValue -ne 0 ]; then if [ $exitValue -ne 0 ]; then
log_msg "msg_send FAILED with exit value $exitValue and the following error: $msgSendOutput" echo "msg_send FAILED with exit value $exitValue and the following error: $msgSendOutput"
rm -f ${LOCK_DIR}/importGrids echo "FAILED" > ${lock_file}
exit 1 exit 1
fi fi
else else
msgSendOutput=$($MSG_SEND_COMMAND -a "DEFAULTNCF" -s $sub -c 23) msgSendOutput=$($MSG_SEND_COMMAND -a "DEFAULTNCF" -s $sub -c 23)
exitValue=$? exitValue=$?
if [ $exitValue -ne 0 ]; then if [ $exitValue -ne 0 ]; then
log_msg "msg_send FAILED with exit value $exitValue and the following error: $msgSendOutput" echo "msg_send FAILED with exit value $exitValue and the following error: $msgSendOutput"
rm -f ${LOCK_DIR}/importGrids echo "FAILED" > ${lock_file}
exit 1 exit 1
fi fi
fi fi
log_msg Successfully sent message. MESSAGE ID: $msgSendOutput echo "Successfully sent message. MESSAGE ID: $msgSendOutput"
log_msg 30 echo "Waiting to receive digital data..."
log_msg "Waiting to receive digital data..."
exit 0 exit 0

View file

@ -0,0 +1,125 @@
#!/bin/bash
##
# This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
#
# U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination
# to non-U.S. persons whether in the United States or abroad requires
# an export license or other authorization.
#
# Contractor Name: Raytheon Company
# Contractor Address: 6825 Pine Street, Suite 340
# Mail Stop B8
# Omaha, NE 68106
# 402.291.0100
#
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information.
#
##
##
#
# SOFTWARE HISTORY
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# Feb 09, 2015 #4103 dgilling Initial Creation.
#
##
if [ ${#AWIPS_HOME} = 0 ]
then
path_to_script=`readlink -f $0`
AWIPS_HOME=$(dirname $(dirname $(dirname $(dirname $path_to_script))))
fi
. ${AWIPS_HOME}/GFESuite/ServiceBackup/configuration/svcbu.properties
function configureLogging()
{
local program_name="$1"
if [[ -n "$2" ]]
then
local siteid=`echo ${2} | tr [a-z] [A-Z]`
fi
if [[ -n "${siteid}" ]]
then
local log_dir=${IFPS_LOG}/${siteid}/`date +%Y%m%d`
else
local log_dir=${IFPS_LOG}/`date +%Y%m%d`
fi
local log_basename=${program_name}_`date +%H%M`
local log_file=${log_dir}/${log_basename}
ensurePathExists "${log_dir}"
touch ${log_file}
exec 1>${log_file} 2>&1
}
function ensurePathExists()
{
if [[ -n "$1" ]]
then
local path="$1"
[ ! -d ${path} ] && (umask 000;mkdir -p ${path})
fi
}
function getLockFile()
{
local lockname="$1"
local siteid=`echo ${2} | tr [a-z] [A-Z]`
local site_lock_path="${LOCK_DIR}/${siteid}"
ensurePathExists "${site_lock_path}"
echo "${site_lock_path}/${lockname}"
}
function isOperationInProgress()
{
local lockname="$1"
local siteid=`echo ${2} | tr [a-z] [A-Z]`
local site_lock_path=$(getLockFile ${lockname} ${siteid})
local retval=false
if [[ -f ${site_lock_path} ]]
then
local status=`cat ${site_lock_path} | head -n 1`
if [[ "${status}" = "IN_PROGRESS" ]]
then
retval=true
fi
fi
echo "${retval}"
}
function getTempDirectory()
{
local program_name=`echo ${1} | tr [A-Z] [a-z]`
local siteid=`echo ${2} | tr [a-z] [A-Z]`
local prog_temp_path="${SVCBU_HOME}/${siteid}/${program_name}"
ensurePathExists "${prog_temp_path}"
echo "${prog_temp_path}"
}
function getSiteIdFromTarFile()
{
local tar_file="$1"
local siteid=""
if [[ -f ${tar_file} ]]
then
siteid=`tar -xOf ${tar_file} siteID.txt | tr '[A-Z]' '[a-z]'`
fi
echo "${siteid}"
}

View file

@ -1,47 +0,0 @@
##
# This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
#
# U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination
# to non-U.S. persons whether in the United States or abroad requires
# an export license or other authorization.
#
# Contractor Name: Raytheon Company
# Contractor Address: 6825 Pine Street, Suite 340
# Mail Stop B8
# Omaha, NE 68106
# 402.291.0100
#
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information.
##
# File auto-generated against equivalent DynamicSerialize Java class
class ServiceBackupStatusUpdateRequest(object):
def __init__(self):
self.statusMessage = None
self.workstationID = None
self.siteID = None
def getStatusMessage(self):
return self.statusMessage
def setStatusMessage(self, statusMessage):
self.statusMessage = statusMessage
def getWorkstationID(self):
return self.workstationID
def setWorkstationID(self, workstationID):
self.workstationID = workstationID
def getSiteID(self):
return self.siteID
def setSiteID(self, siteID):
self.siteID = siteID

View file

@ -45,7 +45,6 @@ __all__ = [
'ProcessReceivedDigitalDataRequest', 'ProcessReceivedDigitalDataRequest',
'PurgeGfeGridsRequest', 'PurgeGfeGridsRequest',
'SaveASCIIGridsRequest', 'SaveASCIIGridsRequest',
'ServiceBackupStatusUpdateRequest',
'SmartInitRequest' 'SmartInitRequest'
] ]
@ -73,6 +72,5 @@ from ProcessReceivedConfRequest import ProcessReceivedConfRequest
from ProcessReceivedDigitalDataRequest import ProcessReceivedDigitalDataRequest from ProcessReceivedDigitalDataRequest import ProcessReceivedDigitalDataRequest
from PurgeGfeGridsRequest import PurgeGfeGridsRequest from PurgeGfeGridsRequest import PurgeGfeGridsRequest
from SaveASCIIGridsRequest import SaveASCIIGridsRequest from SaveASCIIGridsRequest import SaveASCIIGridsRequest
from ServiceBackupStatusUpdateRequest import ServiceBackupStatusUpdateRequest
from SmartInitRequest import SmartInitRequest from SmartInitRequest import SmartInitRequest