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 77b87f33b5
commit fd5b270fdd
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 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.NotificationException;
import com.raytheon.uf.common.jms.notification.NotificationMessage;
@ -89,11 +87,13 @@ public class ProgressDlg extends CaveJFACEDialog implements
newShell.setText("Progress Bar");
}
@Override
public int open() {
NotificationManagerJob.addObserver(ServiceBackupDlg.NOTIFY_TOPIC, this);
return super.open();
}
@Override
public boolean close() {
NotificationManagerJob.removeObserver(ServiceBackupDlg.NOTIFY_TOPIC,
this);
@ -181,13 +181,21 @@ public class ProgressDlg extends CaveJFACEDialog implements
ArrayList<GfeNotification> notifications = (ArrayList<GfeNotification>) msg
.getMessagePayload();
for (GfeNotification notification : notifications) {
if (notification instanceof ServiceBackupMessageNotification) {
ServiceBackupMessageNotification notify = (ServiceBackupMessageNotification) notification;
updateMessage(notify.getMessage());
} else if (notification instanceof ServiceBackupProgressNotification) {
ServiceBackupProgressNotification notify = (ServiceBackupProgressNotification) notification;
updateProgress(notify.getProgress());
}
/*
* FIXME: If we're going to continue to use this dialog fix
* this notificationArrived handler.
*/
// if (notification instanceof
// ServiceBackupMessageNotification) {
// ServiceBackupMessageNotification notify =
// (ServiceBackupMessageNotification) notification;
// updateMessage(notify.getMessage());
// } else if (notification instanceof
// ServiceBackupProgressNotification) {
// ServiceBackupProgressNotification notify =
// (ServiceBackupProgressNotification) notification;
// updateProgress(notify.getProgress());
// }
}
}
} catch (NotificationException e) {

View file

@ -21,7 +21,11 @@ package com.raytheon.viz.gfe.dialogs.sbu;
import java.io.FileNotFoundException;
import java.net.URL;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IProgressMonitor;
@ -54,8 +58,9 @@ import org.eclipse.swt.widgets.Shell;
import org.osgi.framework.Bundle;
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.svcbu.ServiceBackupJobStatus;
import com.raytheon.uf.common.site.requests.GetActiveSitesRequest;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
@ -99,7 +104,8 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
* May 01, 2013 1762 dgilling Remove national center check.
* Jul 22, 2013 1762 dgilling Fix running as primary check.
* 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>
*
@ -167,15 +173,14 @@ public class ServiceBackupDlg extends CaveJFACEDialog {
private boolean authorized;
private SVCBU_OP currentOperation = SVCBU_OP.no_backup;
private boolean isTerminated = false;
public boolean isTerminated() {
return isTerminated;
}
return isTerminated;
}
/**
/**
* @param parentShell
*/
public ServiceBackupDlg(Shell parentShell) {
@ -183,13 +188,14 @@ public class ServiceBackupDlg extends CaveJFACEDialog {
authorized = CheckPermissions.getAuthorization();
this.site = LocalizationManager.getInstance().getCurrentSite();
this.runningAsPrimary = CheckPermissions.runningAsPrimary(this.site);
if (!CheckPermissions.getPrimarySites().contains(this.site)) {
displayMessage("You cannot run Service Backup as " + this.site + " - EXITING!!!");
isTerminated = true;
return;
if (!CheckPermissions.getPrimarySites().contains(this.site)) {
displayMessage("You cannot run Service Backup as " + this.site
+ " - EXITING!!!");
isTerminated = true;
return;
}
if (!ServiceBackupJobManager.getInstance().isRunning()) {
ServiceBackupJobManager.getInstance().start();
}
@ -244,7 +250,7 @@ public class ServiceBackupDlg extends CaveJFACEDialog {
@Override
public boolean close() {
updateJob.cancel();
return super.close();
return super.close();
}
/*
@ -495,7 +501,7 @@ public class ServiceBackupDlg extends CaveJFACEDialog {
}
private void doImportConfig() {
switch (currentOperation) {
case svcbuMode:
displayMessage("" + this.failedSite.toUpperCase()
@ -551,7 +557,7 @@ public class ServiceBackupDlg extends CaveJFACEDialog {
if (startGFE) {
jobManager.addJob(new SvcbuStartGfeJob(failedSite,
this.site));
}
}
}
}
}
@ -779,7 +785,7 @@ public class ServiceBackupDlg extends CaveJFACEDialog {
jobManager.addJob(new SvcbuExitJob(this, this.site));
}
}
}
private void doClean(boolean showMessage) {
@ -860,54 +866,73 @@ public class ServiceBackupDlg extends CaveJFACEDialog {
@SuppressWarnings("unchecked")
private void doRefresh() {
GetSbLockFilesRequest request = new GetSbLockFilesRequest();
List<String> lockFiles = null;
/*
* FIXME: this code needs to be further modified to handle multiple
* 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 {
ServerResponse<List<String>> response = (ServerResponse<List<String>>) ThriftClient
ServerResponse<Map<String, Collection<ServiceBackupJobStatus>>> response = (ServerResponse<Map<String, Collection<ServiceBackupJobStatus>>>) ThriftClient
.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) {
statusHandler.handle(Priority.PROBLEM,
"Error processing site activation request", e);
}
String theFailedSite = null;
if (this.failedSite != null) {
this.failedSite.toLowerCase();
}
boolean lock_file = lockFiles.contains(theFailedSite + "svcbuMode");
/*
* FIXME: lock file handling in this function is now completely broken
* with the move to using the ServiceBackupJobStatus class. Needs to
* check the names of the locks in the collection instead of the current
* contains() check.
*/
boolean lock_file = (failedSiteLockFiles.contains("svcbuMode") && siteIdForLocks
.equalsIgnoreCase(failedSite));
if (!lock_file) {
for (String file : lockFiles) {
if (file.contains("svcbuMode")) {
this.failedSite = file.replace("svcbuMode", "")
.toUpperCase();
theFailedSite = this.failedSite.toLowerCase();
lock_file = true;
break;
} else {
this.failedSite = null;
}
this.failedSite = null;
if (failedSiteLockFiles.contains("svcbuMode")) {
failedSite = siteIdForLocks;
lock_file = true;
}
}
if (lockFiles.isEmpty()) {
this.failedSite = null;
}
boolean ghg_lock_file = false;
boolean wait_lock_file = lockFiles.contains(theFailedSite + "waitMode");
boolean export_lock_file = lockFiles.contains(this.site.toLowerCase()
+ "exportGrids")
|| lockFiles.contains(theFailedSite + "exportGridsCron");
boolean grd_lock_file = lockFiles.contains("importGrids")
|| lockFiles.contains("procGrids");
boolean imp_lock_file = lockFiles.contains("importConfiguration");
boolean cs_lock_file = lockFiles.contains(theFailedSite
+ "exportBksiteGridsCS");
boolean excon_lock_file = lockFiles.contains(this.site.toLowerCase()
+ "exportConfig");
boolean bksite_lock_file = lockFiles.contains(this.site.toLowerCase()
+ "exportBkSiteGrids");
boolean wait_lock_file = failedSiteLockFiles.contains("waitMode");
boolean export_lock_file = thisSitesLockFiles.contains("exportGrids")
|| failedSiteLockFiles.contains("exportGridsCron");
boolean grd_lock_file = failedSiteLockFiles.contains("importGrids");
boolean imp_lock_file = failedSiteLockFiles
.contains("importConfiguration");
boolean cs_lock_file = failedSiteLockFiles
.contains("exportBksiteGridsCS");
boolean excon_lock_file = thisSitesLockFiles.contains("exportConfig");
boolean bksite_lock_file = thisSitesLockFiles
.contains("exportBkSiteGrids");
if (ghg_lock_file) {
updateBanner("CURRENTLY RUNNING\nEMERGENCY GFE", bigFont, black,

View file

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

View file

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

View file

@ -33,6 +33,7 @@ import com.raytheon.viz.gfe.GFEServerException;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 10, 2011 bphillip Initial creation
* Mar 18, 2015 #4103 dgilling Remove unnecessary primary site field.
*
* </pre>
*
@ -60,7 +61,7 @@ public class SvcbuExportFailedSiteDataJob extends ServiceBackupJob {
@Override
public void run() {
ExportFailedSiteDataToCCRequest request = new ExportFailedSiteDataToCCRequest(
primarySite, failedSite);
failedSite);
try {
makeRequest(request);
} 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.server.message.ServerResponse;
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.NotificationException;
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
* Mar 20, 2013 1447 dgilling Add support for service backup
* 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>
*
@ -85,8 +86,7 @@ public class SvcbuImportConfJob extends ServiceBackupJob implements
@Override
public void run() {
ImportConfRequest request = new ImportConfRequest(primarySite,
failedSite, trMode);
ImportConfRequest request = new ImportConfRequest(failedSite, trMode);
try {
VizApp.runAsync(new Runnable() {
@ -126,7 +126,7 @@ public class SvcbuImportConfJob extends ServiceBackupJob implements
if (aborted) {
AbortOperationRequest abortRequest = new AbortOperationRequest(
"importConfiguration");
"importConfiguration", failedSite);
try {
Object obj = ThriftClient.sendRequest(abortRequest);
if (obj instanceof ServerResponse) {
@ -175,18 +175,24 @@ public class SvcbuImportConfJob extends ServiceBackupJob implements
ArrayList<GfeNotification> notifications = (ArrayList<GfeNotification>) msg
.getMessagePayload();
for (GfeNotification notification : notifications) {
if (notification instanceof ServiceBackupMessageNotification) {
ServiceBackupMessageNotification notify = (ServiceBackupMessageNotification) notification;
if (notify.getMessage().equals(
"Import Configuration Complete!")) {
complete = true;
} else if (notify.getMessage().startsWith(
"Error Processing Configuration Data!")) {
complete = true;
failed = true;
errorMsg = notify.getMessage();
}
}
/*
* FIXME: If we're going to continue to use this class, fix
* this notificationArrived handler.
*/
// if (notification instanceof
// ServiceBackupMessageNotification) {
// ServiceBackupMessageNotification notify =
// (ServiceBackupMessageNotification) notification;
// if (notify.getMessage().equals(
// "Import Configuration Complete!")) {
// complete = true;
// } else if (notify.getMessage().startsWith(
// "Error Processing Configuration Data!")) {
// complete = true;
// failed = true;
// errorMsg = notify.getMessage();
// }
// }
}
}
} 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.server.message.ServerResponse;
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.NotificationException;
import com.raytheon.uf.common.jms.notification.NotificationMessage;
@ -49,7 +48,9 @@ import com.raytheon.viz.gfe.dialogs.sbu.ServiceBackupDlg;
*
* 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>
*
@ -89,7 +90,7 @@ public class SvcbuImportDataJob extends ServiceBackupJob implements
@Override
public void run() {
ImportDigitalDataRequest request = new ImportDigitalDataRequest(
primarySite, failedSite);
failedSite);
try {
VizApp.runAsync(new Runnable() {
@ -129,7 +130,7 @@ public class SvcbuImportDataJob extends ServiceBackupJob implements
if (aborted) {
AbortOperationRequest abortRequest = new AbortOperationRequest(
"importGrids");
"importGrids", failedSite);
try {
Object obj = ThriftClient.sendRequest(abortRequest);
if (obj instanceof ServerResponse) {
@ -178,17 +179,24 @@ public class SvcbuImportDataJob extends ServiceBackupJob implements
ArrayList<GfeNotification> notifications = (ArrayList<GfeNotification>) msg
.getMessagePayload();
for (GfeNotification notification : notifications) {
if (notification instanceof ServiceBackupMessageNotification) {
ServiceBackupMessageNotification notify = (ServiceBackupMessageNotification) notification;
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();
}
}
/*
* FIXME: If we're going to continue to use this class, fix
* this notificationArrived handler.
*/
// if (notification instanceof
// ServiceBackupMessageNotification) {
// ServiceBackupMessageNotification notify =
// (ServiceBackupMessageNotification) notification;
// 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) {

View file

@ -192,11 +192,6 @@
<constructor-arg value="com.raytheon.uf.common.dataplugin.gfe.request.GetSiteTimeZoneInfoRequest"/>
<constructor-arg ref="siteTimeZoneHandler"/>
</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 factory-bean="handlerRegistry" factory-method="register">
<constructor-arg value="com.raytheon.uf.common.dataplugin.gfe.request.SmartInitRequest"/>
@ -261,10 +256,10 @@
<constructor-arg ref="AbortOperationRequestHandler"/>
</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">
<constructor-arg value="com.raytheon.uf.common.dataplugin.gfe.request.GetSbLockFilesRequest"/>
<constructor-arg ref="GetSbLockFilesRequestHandler"/>
<constructor-arg value="com.raytheon.uf.common.dataplugin.gfe.request.GetServiceBackupJobStatusRequest"/>
<constructor-arg ref="GetSvcBuJobStatusHandler"/>
</bean>
<bean id="CleanupSvcBuRequestHandler" class="com.raytheon.edex.plugin.gfe.server.handler.svcbu.CleanupSvcBuRequestHandler"/>
@ -291,13 +286,6 @@
<constructor-arg ref="GetServiceBackupPrimarySitesHandler"/>
</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 factory-bean="handlerRegistry" factory-method="register">
<constructor-arg value="com.raytheon.uf.common.dataplugin.gfe.request.ExportConfRequest"/>
@ -418,9 +406,10 @@
<!-- End Additional ISC Beans -->
<bean id="logPurger" class="com.raytheon.edex.plugin.gfe.log.LogPurger"/>
<bean id="sbLockMgr" class="com.raytheon.edex.plugin.gfe.server.handler.svcbu.ServiceBackupLockManager"
factory-method="getInstance"/>
<bean id="svcBuLogPurger" class="com.raytheon.edex.plugin.gfe.svcbackup.SvcbuCleanupLogsTask">
<constructor-arg value="${purge.svcbu.logs.retention}" />
</bean>
<bean id="productIscPurger" class="com.raytheon.uf.common.dataplugin.gfe.util.FilePurger">
<constructor-arg value="/awips2/GFESuite/products/ISC"/> <!-- directory to be purged -->
@ -457,12 +446,6 @@
</doTry>
</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">
<from uri="gfeLogPurgeCron"/>
<to uri="jms-generic:queue:purgeGfeLogWork"/>
@ -518,7 +501,7 @@
<route id="purgeSvcbuLogWork">
<from uri="jms-generic:queue:purgeSvcbuLogWork"/>
<doTry>
<bean ref="CleanupSvcBuLogRequestHandler" method="svcbuLogCleanupCron"/>
<bean ref="svcBuLogPurger" method="run"/>
<doCatch>
<exception>java.lang.Throwable</exception>
<to

View file

@ -10,6 +10,9 @@ purge.gfe.logs.cron=0+30+0+*+*+?
# Interval at which the service backup logs are purged
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
purge.gfe.products.isc.cron=0+45+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;
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.uf.common.dataplugin.gfe.request.AbortOperationRequest;
@ -36,6 +37,7 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 12, 2011 bphillip Initial creation
* Feb 13, 2015 #4103 dgilling Use site id.
*
* </pre>
*
@ -43,21 +45,21 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler;
* @version 1.0
*/
public class AbortOperationRequestHandler implements
public final class AbortOperationRequestHandler implements
IRequestHandler<AbortOperationRequest> {
@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>();
File lockFile = new File(SvcBackupUtil.getLockDir() + "/"
+ request.getOperation());
if (lockFile.exists()) {
if (!lockFile.delete()) {
sr.addMessage("Unable to delete lock file: "
+ request.getOperation());
}
if (!Files.deleteIfExists(lockFilePath)) {
sr.addMessage("Unable to delete lock file: "
+ request.getOperation());
}
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.server.database.GridDatabase;
import com.raytheon.edex.plugin.gfe.svcbackup.ServiceBackupNotificationManager;
import com.raytheon.edex.plugin.gfe.svcbackup.SvcBackupUtil;
import com.raytheon.uf.common.dataplugin.PluginException;
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.IDataStore;
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;
/**
* TODO Add Description
* Request handler for {@code CleanupSvcBuRequest}. This handler will delete all
* data for the failed site from the local server.
*
* <pre>
*
@ -43,6 +45,7 @@ import com.raytheon.uf.edex.database.DataAccessLayerException;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 10, 2011 bphillip Initial creation
* Feb 12, 2015 #4103 dgilling Move lock deletion to cleanup script.
*
* </pre>
*
@ -50,42 +53,50 @@ import com.raytheon.uf.edex.database.DataAccessLayerException;
* @version 1.0
*/
public class CleanupSvcBuRequestHandler implements
public final class CleanupSvcBuRequestHandler implements
IRequestHandler<CleanupSvcBuRequest> {
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(CleanupSvcBuRequestHandler.class);
@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 {
dao = new GFEDao();
ServiceBackupNotificationManager
.sendMessageNotification("Purging database for "
+ request.getFailedSite());
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());
statusHandler.info("Running cleanup script for for "
+ request.getFailedSite());
SvcBackupUtil.execute("cleanup_svcbk", request.getFailedSite()
.toLowerCase());
} catch (Exception e) {
sr.addMessage("Error executing cleanup script! "
+ e.getLocalizedMessage());
statusHandler.error("Error executing cleanup script!", e);
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 {

View file

@ -19,17 +19,20 @@
**/
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.uf.common.auth.exception.AuthorizationException;
import com.raytheon.uf.common.auth.user.IUser;
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.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>
*
@ -37,7 +40,9 @@ import com.raytheon.uf.edex.auth.resp.AuthorizationResponse;
*
* 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>
*
@ -45,26 +50,35 @@ import com.raytheon.uf.edex.auth.resp.AuthorizationResponse;
* @version 1.0
*/
public class ExportConfRequestHandler extends
public final class ExportConfRequestHandler extends
AbstractPrivilegedRequestHandler<ExportConfRequest> {
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(ExportConfRequestHandler.class);
@Override
public Object handleRequest(ExportConfRequest request) throws Exception {
public JobProgress handleRequest(final ExportConfRequest request)
throws Exception {
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()
.toLowerCase());
ServiceBackupNotificationManager
.sendMessageNotification("Configuration successfully sent to central server");
ServiceBackupNotificationManager.sendProgressNotification(100);
} else {
ServiceBackupNotificationManager.sendMessageNotification("User "
+ request.getUser()
+ " is not authorized to perform this operation");
sr.addMessage(response.getResponseMessage());
statusHandler
.info("Configuration successfully sent to central server");
} catch (Exception e) {
statusHandler.error("Error exporting configuration for site "
+ request.getSite(), e);
return JobProgress.FAILED;
}
return sr;
return JobProgress.SUCCESS;
}
@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.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.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>
*
@ -33,7 +37,8 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler;
*
* 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>
*
@ -41,16 +46,24 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler;
* @version 1.0
*/
public class ExportDataToFailedSiteRequestHandler implements
public final class ExportDataToFailedSiteRequestHandler implements
IRequestHandler<ExportDataToFailedSiteRequest> {
@Override
public Object handleRequest(ExportDataToFailedSiteRequest request)
throws Exception {
ServerResponse<String> sr = new ServerResponse<String>();
SvcBackupUtil.execute("export_grids_to_failed_site", request.getFailedSite()
.toLowerCase(), request.getPrimarySite().toLowerCase());
return sr;
}
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(ExportDataToFailedSiteRequestHandler.class);
@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.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.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>
*
@ -33,7 +37,8 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler;
*
* 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>
*
@ -41,15 +46,24 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler;
* @version 1.0
*/
public class ExportFailedSiteDataToCCRequestHandler implements
public final class ExportFailedSiteDataToCCRequestHandler implements
IRequestHandler<ExportFailedSiteDataToCCRequest> {
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(ExportFailedSiteDataToCCRequestHandler.class);
@Override
public Object handleRequest(ExportFailedSiteDataToCCRequest request)
throws Exception {
ServerResponse<String> sr = new ServerResponse<String>();
SvcBackupUtil.execute("export_bksite_grids", request.getPrimarySite()
.toLowerCase(), request.getFailedSite().toLowerCase());
return sr;
public JobProgress handleRequest(
final ExportFailedSiteDataToCCRequest request) throws Exception {
try {
SvcBackupUtil.execute("export_bksite_grids", request
.getFailedSite().toLowerCase());
} 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 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.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.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>
*
@ -42,6 +45,8 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler;
* Aug 04, 2011 bphillip Initial creation
* Apr 30, 2013 #1761 dgilling Support changes made to
* ExportGridsRequest.
* Mar 17, 2015 #4103 dgilling Stop using ServiceBackupNotificationManager,
* supoprt new Service Backup GUI.
*
* </pre>
*
@ -49,23 +54,29 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler;
* @version 1.0
*/
public class ExportGridsRequestHandler implements
public final class ExportGridsRequestHandler implements
IRequestHandler<ExportGridsRequest> {
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(ExportGridsRequestHandler.class);
private static Timer exportGridsTimer = new Timer(true);
@Override
public Object handleRequest(ExportGridsRequest request) throws Exception {
ServerResponse<String> sr = new ServerResponse<String>();
public JobProgress handleRequest(final ExportGridsRequest request)
throws Exception {
JobProgress progress = JobProgress.SUCCESS;
SvcBackupUtil.execute("export_grids",
request.getMode().getCmdLineArg(), request.getSite()
.toLowerCase());
try {
SvcBackupUtil.execute("export_grids", request.getMode()
.getCmdLineArg(), request.getSite().toLowerCase());
statusHandler.info("Digital data successfully exported.");
} catch (Exception e) {
statusHandler.error(
"Error digital data for site " + request.getSite(), e);
}
ServiceBackupNotificationManager
.sendMessageNotification("Digital data successfully exported.");
ServiceBackupNotificationManager.sendProgressNotification(100);
return sr;
return progress;
}
public void exportGridsCron() throws Exception {

View file

@ -19,17 +19,18 @@
**/
package com.raytheon.edex.plugin.gfe.server.handler.svcbu;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.Properties;
import com.raytheon.edex.plugin.gfe.svcbackup.SvcBackupUtil;
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.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>
*
@ -37,7 +38,8 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler;
*
* 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>
*
@ -45,35 +47,36 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler;
* @version 1.0
*/
public class GetGfeStartCmdRequestHandler implements
public final class GetGfeStartCmdRequestHandler implements
IRequestHandler<GetGfeStartCmdRequest> {
@Override
public Object handleRequest(GetGfeStartCmdRequest request) throws Exception {
ServerResponse<String> sr = new ServerResponse<String>();
BufferedReader in = null;
try {
SvcBackupUtil.execute("createGFEStartScript", request.getSite());
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(CleanupSvcBuRequestHandler.class);
String scriptFile = "/awips2/GFESuite/ServiceBackup/.launch_cave.sh";
in = new BufferedReader(new FileReader(scriptFile));
String str = null;
while ((str = in.readLine()) != null) {
sr.setPayload(str);
}
in.close();
} catch (Exception e) {
sr.addMessage("Error generating GFE launch script! "
+ e.getLocalizedMessage());
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
sr.addMessage("Error closing input stream!");
}
}
@Override
public String handleRequest(final GetGfeStartCmdRequest request)
throws Exception {
Properties svcbuProps = SvcBackupUtil.getSvcBackupProperties();
String svcbuUser = (svcbuProps.getProperty("SVCBU_USER") != null) ? svcbuProps
.getProperty("SVCBU_USER").trim() : "0";
String svcbuUserName = (svcbuProps.getProperty("SVCBU_USER_ID") != null) ? svcbuProps
.getProperty("SVCBU_USER_ID").trim() : "";
if (svcbuUser.equals("1") && svcbuUserName.isEmpty()) {
statusHandler
.info("You do not have a user id configured for ServiceBackup");
statusHandler.info("GFE will start with your regular user id");
}
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.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.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>
*
@ -38,6 +42,7 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler;
* Aug 04, 2011 bphillip Initial creation
* Mar 20, 2013 1447 dgilling Support troubleshooting mode
* added to match A1 DR 21404.
* Mar 17, 2015 4103 dgilling Support new Service Backup GUI.
*
* </pre>
*
@ -45,16 +50,28 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler;
* @version 1.0
*/
public class ImportConfRequestHandler implements
public final class ImportConfRequestHandler implements
IRequestHandler<ImportConfRequest> {
@Override
public Object handleRequest(ImportConfRequest request) throws Exception {
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(ImportConfRequestHandler.class);
ServerResponse<String> sr = new ServerResponse<String>();
SvcBackupUtil.execute("request_configuration", request.getPrimarySite()
.toLowerCase(), request.getFailedSite().toLowerCase(), Integer
.toString(BooleanUtils.toInteger(request.isTrMode())));
return sr;
@Override
public JobProgress handleRequest(final ImportConfRequest request)
throws Exception {
try {
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.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.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>
*
@ -33,7 +37,8 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler;
*
* 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>
*
@ -41,15 +46,26 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler;
* @version 1.0
*/
public class ImportDigitalDataRequestHandler implements
public final class ImportDigitalDataRequestHandler implements
IRequestHandler<ImportDigitalDataRequest> {
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(ImportDigitalDataRequestHandler.class);
@Override
public Object handleRequest(ImportDigitalDataRequest request)
public JobProgress handleRequest(final ImportDigitalDataRequest request)
throws Exception {
ServerResponse<String> sr = new ServerResponse<String>();
SvcBackupUtil.execute("request_grids", request.getPrimarySite()
.toLowerCase(), request.getFailedSite().toLowerCase());
return sr;
try {
statusHandler.info("Requesting GFE grids for site "
+ request.getFailedSite());
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;
import com.raytheon.edex.plugin.gfe.svcbackup.ServiceBackupNotificationManager;
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.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.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>
*
@ -35,7 +40,8 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler;
*
* 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>
*
@ -43,27 +49,34 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler;
* @version 1.0
*/
public class ProcessReceivedConfRequestHandler implements
public final class ProcessReceivedConfRequestHandler implements
IRequestHandler<ProcessReceivedConfRequest> {
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(ProcessReceivedConfRequestHandler.class);
@Override
public Object handleRequest(ProcessReceivedConfRequest request)
public JobProgress handleRequest(final ProcessReceivedConfRequest request)
throws Exception {
ServerResponse<String> sr = new ServerResponse<String>();
try {
SvcBackupUtil.execute("createGFEStartScript", SiteUtil.getSite().toLowerCase());
SvcBackupUtil.execute("process_configuration",
request.getReceivedConfFile());
ServiceBackupNotificationManager
.sendMessageNotification("Import Configuration Complete!");
request.getReceivedConfFile(), request.getSiteID());
statusHandler.info("Import Configuration Complete for site "
+ request.getSiteID());
} catch (Exception e) {
sr.addMessage("Error processing received grids. "
+ e.getLocalizedMessage());
ServiceBackupNotificationManager.sendErrorMessageNotification(
"Error Processing Configuration Data!", e);
statusHandler.error("Error Processing Configuration Data for site "
+ request.getSiteID(), e);
SendNotifications.send(new ServiceBackupJobStatusNotification(
"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;
import com.raytheon.edex.plugin.gfe.svcbackup.ServiceBackupNotificationManager;
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.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.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>
*
@ -34,7 +40,8 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler;
*
* 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>
*
@ -42,26 +49,31 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler;
* @version 1.0
*/
public class ProcessReceivedDigitalDataRequestHandler implements
public final class ProcessReceivedDigitalDataRequestHandler implements
IRequestHandler<ProcessReceivedDigitalDataRequest> {
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(ProcessReceivedDigitalDataRequestHandler.class);
@Override
public Object handleRequest(ProcessReceivedDigitalDataRequest request)
throws Exception {
ServerResponse<String> sr = new ServerResponse<String>();
public JobProgress handleRequest(
final ProcessReceivedDigitalDataRequest request) throws Exception {
try {
SvcBackupUtil.execute("process_grids",
request.getReceivedDataFile());
ServiceBackupNotificationManager
.sendMessageNotification("Import Data Complete!");
request.getReceivedDataFile(), request.getSiteID());
statusHandler.info("Import Data Complete for site "
+ request.getSiteID());
} catch (Exception e) {
sr.addMessage("Error processing received grids. "
+ e.getLocalizedMessage());
ServiceBackupNotificationManager
.sendErrorMessageNotification("Error Processing Digital Data!",e);
statusHandler.error("Error Processing Digital Data for site "
+ request.getSiteID(), e);
SendNotifications.send(new ServiceBackupJobStatusNotification(
"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.uf.common.dataplugin.gfe.request.ExportGridsRequest;
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
@ -42,6 +44,7 @@ import com.raytheon.uf.common.dataplugin.gfe.request.ExportGridsRequest.ExportGr
* for from svcbu.properties.
* May 02, 2013 #1762 dgilling Move code to read PRIMARY_SITES setting
* to SvcBackupUtil.
* Mar 17, 2015 #4103 dgilling Stop using ServiceBackupNotificationManager.
*
* </pre>
*
@ -51,10 +54,12 @@ import com.raytheon.uf.common.dataplugin.gfe.request.ExportGridsRequest.ExportGr
public class ExportGridsTask extends TimerTask {
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(ExportGridsTask.class);
public ExportGridsTask(Date executionTime) {
ServiceBackupNotificationManager
.sendMessageNotification("Export grids cron scheduled for execution at: "
+ executionTime);
statusHandler.info("Export grids cron scheduled for execution at: "
+ executionTime);
}
/*
@ -67,14 +72,14 @@ public class ExportGridsTask extends TimerTask {
final ExportGridsRequestHandler reqHandler = new ExportGridsRequestHandler();
for (String site : SvcBackupUtil.getPrimarySites()) {
ServiceBackupNotificationManager
.sendMessageNotification("Export Grids to central server cron started for site "
statusHandler
.info("Export Grids to central server cron started for site "
+ site + ".");
try {
reqHandler.handleRequest(new ExportGridsRequest(site,
ExportGridsMode.CRON));
} catch (Exception e) {
ServiceBackupNotificationManager.sendErrorMessageNotification(
statusHandler.error(
"Export Grids to central server cron failed to execute for site "
+ 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;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.HashSet;
import java.util.Properties;
import java.util.Set;
@ -65,6 +66,8 @@ import com.raytheon.uf.edex.site.SiteAwareRegistry;
* sites.
* May 28, 2014 3211 njensen Use IAuthorizer instead of IRoleStorage
* Jul 10, 2014 2914 garmendariz Remove EnvProperties
* Feb 17, 2015 4103 dgilling Add getLockDir for specific site, code
* cleanup.
*
* </pre>
*
@ -223,40 +226,29 @@ public class SvcBackupUtil {
return svcbuProperties;
}
public static boolean errorDetected() {
File[] fileList = new File(getLockDir()).listFiles();
for (File file : fileList) {
if (file.getName().equals("svcbuerr")) {
return true;
}
}
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() {
/**
* Returns the base lock directory for service backup. All site specific
* lock directories will be children to this directory.
*
* @return The {@code Path} that represents the base directory for service
* backup locks.
*/
public static Path getLockDir() {
String lockDir = SvcBackupUtil.getSvcBackupProperties().getProperty(
"LOCK_DIR")
+ File.separator;
return lockDir;
"LOCK_DIR");
return Paths.get(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,

View file

@ -19,14 +19,16 @@
**/
package com.raytheon.edex.plugin.gfe.svcbackup;
import java.util.Date;
import java.util.TimerTask;
import com.raytheon.edex.plugin.gfe.server.handler.svcbu.CleanupSvcBuLogRequestHandler;
import com.raytheon.uf.common.dataplugin.gfe.request.CleanupSvcBuLogRequest;
import com.raytheon.uf.common.dataplugin.gfe.util.FilePurger;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.time.util.TimeUtil;
/**
* 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>
*
@ -34,38 +36,38 @@ import com.raytheon.uf.common.dataplugin.gfe.request.CleanupSvcBuLogRequest;
*
* 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>
*
* @author jdynina
* @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) {
ServiceBackupNotificationManager
.sendMessageNotification("Service backup log cleanup cron scheduled for execution at: "
+ executionTime);
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(SvcbuCleanupLogsTask.class);
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() {
ServiceBackupNotificationManager
.sendMessageNotification("Cleanup service configuration logs cron started.");
statusHandler.info("Cleanup service backup logs cron started.");
try {
new CleanupSvcBuLogRequestHandler()
.handleRequest(new CleanupSvcBuLogRequest());
logPurger.purge();
} catch (Exception e) {
ServiceBackupNotificationManager
.sendErrorMessageNotification(
"Cleanup service backup logs cron failed to execute.",
statusHandler
.error("Cleanup service backup logs cron threw an unhandled exception.",
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.request,
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.time,
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
* ------------ ---------- ----------- --------------------------
* Aug 12, 2011 bphillip Initial creation
* Feb 13, 2015 #4103 dgilling Force use of site id.
*
* </pre>
*
@ -48,8 +49,9 @@ public class AbortOperationRequest extends AbstractGfeRequest {
public AbortOperationRequest() {
}
public AbortOperationRequest(String operation) {
public AbortOperationRequest(String operation, String siteID) {
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;
/**
* 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>
*
@ -32,6 +34,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 10, 2011 bphillip Initial creation
* Mar 18, 2015 #4103 dgilling Remove unnecessary primary site field.
*
* </pre>
*
@ -40,36 +43,18 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*/
@DynamicSerialize
public class CleanupSvcBuRequest extends AbstractGfeRequest {
public final class CleanupSvcBuRequest extends AbstractGfeRequest {
@DynamicSerializeElement
private String primarySite;
@DynamicSerializeElement
private String failedSite;
public CleanupSvcBuRequest() {
}
public CleanupSvcBuRequest(String primarySite, String failedSite) {
this.primarySite = primarySite;
public CleanupSvcBuRequest(String 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
*/
@ -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) {
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;
/**
* TODO Add Description
* Request to export the specified site's configuration data and immediately
* send it to the central server.
*
* <pre>
*

View file

@ -23,7 +23,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
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>
*
@ -31,7 +32,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
* 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>
*
@ -40,10 +42,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*/
@DynamicSerialize
public class ExportDataToFailedSiteRequest extends AbstractGfeRequest {
@DynamicSerializeElement
private String primarySite;
public final class ExportDataToFailedSiteRequest extends AbstractGfeRequest {
@DynamicSerializeElement
private String failedSite;
@ -51,26 +50,10 @@ public class ExportDataToFailedSiteRequest extends AbstractGfeRequest {
public ExportDataToFailedSiteRequest() {
}
public ExportDataToFailedSiteRequest(String primarySite, String failedSite) {
this.primarySite = primarySite;
public ExportDataToFailedSiteRequest(String 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
*/
@ -85,5 +68,4 @@ public class ExportDataToFailedSiteRequest extends AbstractGfeRequest {
public void setFailedSite(String 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;
/**
* TODO Add Description
* Request to export the specified failed site's GFE grids and immediately send
* them to the central server.
*
* <pre>
*
@ -31,7 +32,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
* 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>
*
@ -39,10 +41,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* @version 1.0
*/
@DynamicSerialize
public class ExportFailedSiteDataToCCRequest extends AbstractGfeRequest {
@DynamicSerializeElement
private String primarySite;
public final class ExportFailedSiteDataToCCRequest extends AbstractGfeRequest {
@DynamicSerializeElement
private String failedSite;
@ -50,26 +49,10 @@ public class ExportFailedSiteDataToCCRequest extends AbstractGfeRequest {
public ExportFailedSiteDataToCCRequest() {
}
public ExportFailedSiteDataToCCRequest(String primarySite, String failedSite) {
this.primarySite = primarySite;
public ExportFailedSiteDataToCCRequest(String 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
*/

View file

@ -23,7 +23,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
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>
*

View file

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

View file

@ -19,11 +19,19 @@
**/
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.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>
*
@ -31,32 +39,36 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
* 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>
*
* @author dgilling
* @author bphillip
* @version 1.0
*/
@DynamicSerialize
public class ServiceBackupStatusUpdateRequest extends AbstractGfeRequest {
public class GetServiceBackupJobStatusRequest implements IServerRequest {
@DynamicSerializeElement
private String statusMessage;
private Collection<String> requestedSiteIds;
/**
* @param statusMessage
* the statusMessage to set
*/
public void setStatusMessage(String statusMessage) {
this.statusMessage = statusMessage;
public GetServiceBackupJobStatusRequest() {
this.requestedSiteIds = Collections.emptyList();
}
/**
* @return the statusMessage
*/
public String getStatusMessage() {
return statusMessage;
public GetServiceBackupJobStatusRequest(String siteId,
String... moreSiteIds) {
this.requestedSiteIds = new HashSet<>(Arrays.asList(moreSiteIds));
this.requestedSiteIds.add(siteId);
}
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;
/**
* TODO Add Description
* Request to request a failed site's configuration data via the MHS.
*
* <pre>
*
@ -34,6 +34,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* Aug 04, 2011 bphillip Initial creation
* Mar 20, 2013 1447 dgilling Add support for service backup
* troubleshooting mode from A1.
* Mar 18, 2015 #4103 dgilling Remove unnecessary primary site field.
*
* </pre>
*
@ -42,10 +43,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*/
@DynamicSerialize
public class ImportConfRequest extends AbstractGfeRequest {
@DynamicSerializeElement
private String primarySite;
public final class ImportConfRequest extends AbstractGfeRequest {
@DynamicSerializeElement
private String failedSite;
@ -57,28 +55,11 @@ public class ImportConfRequest extends AbstractGfeRequest {
}
public ImportConfRequest(String primarySite, String failedSite,
boolean trMode) {
this.primarySite = primarySite;
public ImportConfRequest(String failedSite, boolean trMode) {
this.failedSite = failedSite;
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
*/
@ -101,5 +82,4 @@ public class ImportConfRequest extends AbstractGfeRequest {
public boolean isTrMode() {
return trMode;
}
}

View file

@ -23,7 +23,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
* TODO Add Description
* Request to request a failed site's GFE grids via the MHS.
*
* <pre>
*
@ -31,7 +31,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
* 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>
*
@ -40,9 +41,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*/
@DynamicSerialize
public class ImportDigitalDataRequest extends AbstractGfeRequest {
@DynamicSerializeElement
private String primarySite;
public final class ImportDigitalDataRequest extends AbstractGfeRequest {
@DynamicSerializeElement
private String failedSite;
@ -51,26 +50,10 @@ public class ImportDigitalDataRequest extends AbstractGfeRequest {
}
public ImportDigitalDataRequest(String primarySite, String failedSite) {
this.primarySite = primarySite;
public ImportDigitalDataRequest(String 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
*/

View file

@ -23,7 +23,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
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>
*

View file

@ -23,7 +23,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
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>
*

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
* further licensing information.
**/
package com.raytheon.uf.common.dataplugin.gfe.request;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
package com.raytheon.uf.common.dataplugin.gfe.svcbu;
/**
* TODO Add Description
* Enum that represents the different states of a service backup operation.
*
* <pre>
*
@ -30,18 +28,15 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 10, 2011 bphillip Initial creation
* Feb 24, 2015 #4103 dgilling Initial creation
*
* </pre>
*
* @author bphillip
* @author dgilling
* @version 1.0
*/
@DynamicSerialize
public class GetSbLockFilesRequest extends AbstractGfeRequest {
public GetSbLockFilesRequest() {
}
public enum JobProgress {
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
##
# 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 ]
then
path_to_script=`readlink -f $0`
export AWIPS_HOME=$(dirname $(dirname $(dirname $(dirname $path_to_script))))
fi
# $1 = Primary site
# $2 = Failed site
CAPS_FAILED_SITE=`echo ${2} | tr [a-z] [A-Z]`
. ${AWIPS_HOME}/GFESuite/ServiceBackup/configuration/svcbu.env
if [ $# -ne 2 ]
if [ $# -ne 1 ]
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
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
echo "Removing the contents of $SVCBU_HOME"
echo ${SVCBU_HOME}/* | xargs rm -rf
LOCK_DIR=$(getLockFile "" ${CAPS_FAILED_SITE})
if [ -d ${LOCK_DIR} ];then
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
# DR 16362
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
fi
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
fi
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
fi
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
fi
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
fi
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
fi
if [ -d ${LOCALIZATION_PATH}/cave_static/site/${CAPS_FAILED_SITE}/colormaps ]; then
log_msg "Removing cave site colormaps configuration for site ${CAPS_FAILED_SITE}"
rm -fr ${LOCALIZATION_PATH}/cave_static/site/${CAPS_FAILED_SITE}/colormaps
echo "Removing cave site colormaps configuration for site ${CAPS_FAILED_SITE}"
rm -fr ${LOCALIZATION_PATH}/common_static/site/${CAPS_FAILED_SITE}/colormaps
fi
# end DR 16362
# DR 16464
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}
fi
# end DR 16464
#-- Remove the rsync grids
if [ "$CAPS_FAILED_SITE" = "aer" ]
then
NETCDF_PATH=${GFESUITE_HOME}/exportgrids2
else
NETCDF_PATH=${GFESUITE_HOME}/exportgrids
fi
if [ -e ${NETCDF_PATH}/${2}Grd.netcdf ]
NETCDF_PATH=${GFESUITE_HOME}/exportgrids/backup
if [ -f ${NETCDF_PATH}/${2}Grd.netcdf ]
then
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

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
##
# 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 ]
then
path_to_script=`readlink -f $0`
export AWIPS_HOME=$(dirname $(dirname $(dirname $(dirname $path_to_script))))
fi
# $1 = Primary Site name
# $2 = Failed Site Name
if [ $# -ne 2 ]
# $1 = Failed Site Name
if [ $# -ne 1 ]
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
fi
. ${AWIPS_HOME}/GFESuite/ServiceBackup/configuration/svcbu.env
source ${AWIPS_HOME}/GFESuite/ServiceBackup/scripts/serviceBackupUtil.sh
PRIMARY_SITE=`echo ${1} | tr '[A-Z]' '[a-z]'`
PRIMARY_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]`
FAILED_SITE=`echo ${1} | tr '[A-Z]' '[a-z]'`
FAILED_CAPS_SITE=`echo ${1} | tr [a-z] [A-Z]`
# Create the log file
logdir=${IFPS_LOG}/`date +%Y%m%d`
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
configureLogging "svcbu_export_bksite_grids_central_server" ${FAILED_SITE}
# Check the status of the lock file to see if we are OK to proceed
if [ -f ${LOCK_DIR}/${FAILED_SITE}exportBksiteGridsCS ];
# Check the status of the lock file to see if we are OK to proceed.
lock_file=$(getLockFile "exportBksiteGridsCS" ${FAILED_SITE})
lock_status=$(isOperationInProgress "exportBksiteGridsCS" ${FAILED_SITE})
if [[ "${lock_status}" = "true" ]]
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
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
@ -47,72 +76,70 @@ else
SVCBU_MASK="-m $SVCBU_GRIDAREA"
fi
log_msg "Exporting $FAILED_CAPS_SITE grids to central server"
log_msg 0
echo "Exporting $FAILED_CAPS_SITE grids to central server"
OUTPUT_DIR=$(getTempDirectory "export_bksite_grids" ${FAILED_SITE})
#Starting ifpnetCDF to pack the grids
log_msg "Running ifpnetCDF..."
log_msg 25
log_msg "Running ifpnetCDF...(May take awhile)"
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}
echo "Running ifpnetCDF...(May take awhile)"
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}"
${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}
if [ $? -ne 0 ]; then
log_msg "ifpnetCDF process failed to create grids to send to the central server. Exiting..."
log_msg "ERROR: ifpnetCDF failed..."
rm -f ${LOCK_DIR}/${FAILED_SITE}exportBksiteGridsCS ${logdir}/${FAILED_SITE}Grd.netcdf*
echo "ifpnetCDF process failed to create grids to send to the central server. Exiting..."
echo "ERROR: ifpnetCDF failed..."
echo "FAILED" > ${lock_file}
rm -f ${OUTPUT_DIR}/${FAILED_SITE}Grd.netcdf*
exit 1
fi
# 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.
cd $logdir
cd ${OUTPUT_DIR}
#tar the netcdf file again to preserve the file name so that when importing
#we can retrieve the site id from the file name
tar cvf ${FAILED_SITE}Grd.netcdf.tar ${FAILED_SITE}Grd.netcdf.gz siteID.txt
log_msg "Preparing package for msg_send..."
log_msg 60
echo "Preparing package for msg_send..."
#form the subject line for msg_send which uses it as the file name in the central server
#h_mach=`hostname|cut -d- -f2`
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
log_msg "Sending the gridded data to the central server..."
log_msg 90
log_msg "Sending the gridded data to the central server..."
echo "Sending the gridded data to the central server..."
# We need to add another -c command in message handling system.
# Send the grids to the central server
# If we find a valid WMO Header, then add -i argument to msg_send call.
# Otherwise, don't add it.
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=$?
if [ $exitValue -ne 0 ]
then
log_msg "msg_send has failed to send ${logdir}/${FAILED_SITE}Grd.netcdf.tar"
log_msg "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 "msg_send has failed to send ${OUTPUT_DIR}/${FAILED_SITE}Grd.netcdf.tar"
echo "msg_send FAILED with exit value $exitValue and the following error: $msgSendOutput"
echo "FAILED" > ${lock_file}
rm -f ${OUTPUT_DIR}/${FAILED_SITE}Grd.netcdf*
exit 1
fi
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=$?
if [ $exitValue -ne 0 ]
then
log_msg "msg_send has failed to send ${logdir}/${FAILED_SITE}Grd.netcdf.tar"
log_msg "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 "msg_send has failed to send ${OUTPUT_DIR}/${FAILED_SITE}Grd.netcdf.tar"
echo "msg_send FAILED with exit value $exitValue and the following error: $msgSendOutput"
echo "FAILED" > ${lock_file}
rm -f ${OUTPUT_DIR}/${FAILED_SITE}Grd.netcdf*
exit 1
fi
fi
log_msg Successfully sent message. MESSAGE ID: $msgSendOutput
log_msg 100
rm -f ${LOCK_DIR}/${FAILED_SITE}exportBksiteGridsCS
echo "Successfully sent message. MESSAGE ID: $msgSendOutput"
echo "SUCCESS" > ${lock_file}
#delete the temporary netCDF file as well.
rm -f ${logdir}/${FAILED_SITE}Grd.netcdf.*
log_msg "All done. Export Gridded data has completed"
rm -f ${OUTPUT_DIR}/${FAILED_SITE}Grd.netcdf.*
echo "All done. Export Gridded data has completed"
exit 0

View file

@ -1,4 +1,37 @@
#!/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 ]
then
path_to_script=`readlink -f $0`
@ -8,167 +41,144 @@ fi
# $1 = Site name
. ${AWIPS_HOME}/GFESuite/ServiceBackup/configuration/svcbu.env
source ${AWIPS_HOME}/GFESuite/ServiceBackup/scripts/serviceBackupUtil.sh
SITE=`echo ${1} | tr '[A-Z]' '[a-z]'`
CAPS_SITE=`echo ${1} | tr [a-z] [A-Z]`
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
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
fi
touch ${LOCK_DIR}/${SITE}exportConfig
echo "IN_PROGRESS" > ${lock_file}
# Create the log file
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
OUTPUT_DIR=$(getTempDirectory "export_configuration" ${CAPS_SITE})
# Update status percent to 0
log_msg 0
echo "Changing to output directory: ${OUTPUT_DIR}"
cd ${OUTPUT_DIR}
log_msg Changing to SVCBU_HOME directory: ${SVCBU_HOME}
cd ${SVCBU_HOME}
echo "Clearing contents of ${OUTPUT_DIR}"
rm -rf ${OUTPUT_DIR}/*
log_msg Clearing contents of ${SVCBU_HOME}
echo ${SVCBU_HOME}/* | xargs rm -rf
echo "Writing site ID to text file..."
echo $SITE > ${OUTPUT_DIR}/siteID.txt
log_msg Writing site ID to text file...
echo $SITE > ${SVCBU_HOME}/siteID.txt
log_msg 10
log_msg Preparing configuration files for export...
echo "Preparing configuration files for export..."
edexDest=GFEconfig/edex_static
commonDest=GFEconfig/common_static
caveDest=GFEconfig/cave_static
rsyncParms=GFEConfig # DR 16464
log_msg 15
log_msg Making temporary edex configuration directories...
echo "Making temporary edex configuration directories..."
mkdir -p $edexDest/site
log_msg 20
log_msg Making temporary common configuration directories...
echo "Making temporary common configuration directories..."
mkdir -p $commonDest/site
log_msg 25
log_msg Making temporary cave configuration directories
echo "Making temporary cave configuration directories"
mkdir -p $caveDest/site
log_msg 30
# DR 16464
log_msg Making temporary rsync_parms directory
echo "Making temporary rsync_parms directory"
mkdir -p $rsyncParms/site
log_msg 35
# 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}/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
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
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
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
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...
cp -r ${LOCALIZATION_PATH}/cave_static/site/${CAPS_SITE}/colormaps $caveDest/site
log_msg 80
echo "Copying cave site colormaps configuration for site ${CAPS_SITE} to temporary directory..."
cp -r ${LOCALIZATION_PATH}/common_static/site/${CAPS_SITE}/colormaps $commonDest/site
# DR 16464
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
log_msg 83
fi
# Tar up everything.
log_msg 85
log_msg Tarring and zipping configuration to file GFEconfig.${SITE}.tar.gz
echo "Tarring and zipping configuration to file GFEconfig.${SITE}.tar.gz"
tar cf - GFEconfig|gzip -9 - > GFEconfig.${SITE}.tar.gz
if [ $? -ne 0 ]
then
log_msg "Failed to make GFEConfig tar file.Program exits now."
rm -f ${LOCK_DIR}/${SITE}exportConfig
echo "Failed to make GFEConfig tar file.Program exits now."
echo "FAILED" > ${lock_file}
exit 1
fi
# Cleanup
log_msg Cleaning up temporary files
rm -fR GFEconfig
echo "Cleaning up temporary files"
rm -fr GFEconfig
log_msg 90
log_msg Preparing compressed file for exporting to central server...
log_msg Compressing to file svc_bkup_${SITE}.tar
echo "Preparing compressed file for exporting to central server..."
echo "Compressing to file svc_bkup_${SITE}.tar"
tar cf svc_bkup_${SITE}.tar *.gz siteID.txt
log_msg 93
#check for failure of the tar file
if [ $? -ne 0 ]
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
fi
# Cleanup zip files
#
log_msg Cleaning up zip files
rm -fr *.gz
echo "Cleaning up zip files"
rm -f *.gz
rm siteID.txt
log_msg Sending the tar file to the central server...
log_msg 95
echo "Sending the tar file to the central server..."
# 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
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
msgSendOutput=$($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 ${OUTPUT_DIR}/svc_bkup_${SITE}.tar -a ${SVCBU_ADDRESSEE} -i ${SVCBU_WMO_HEADER} -s ${SITE}2 -c 20)
exitValue=$?
if [ $exitValue -ne 0 ]
then
log_msg "msg_send FAILED with exit value $exitValue and the following error: $msgSendOutput"
rm -f ${LOCK_DIR}/${SITE}exportConfig
echo "msg_send FAILED with exit value $exitValue and the following error: $msgSendOutput"
echo "FAILED" > ${lock_file}
exit 1
fi
else
log_msg $MSG_SEND_COMMAND -e ${SVCBU_HOME}/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)
echo "$MSG_SEND_COMMAND -e ${OUTPUT_DIR}/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=$?
if [ $exitValue -ne 0 ]
then
log_msg "msg_send FAILED with exit value $exitValue and the following error: $msgSendOutput"
rm -f ${LOCK_DIR}/${SITE}exportConfig
echo "msg_send FAILED with exit value $exitValue and the following error: $msgSendOutput"
echo "FAILED" > ${lock_file}
exit 1
fi
fi
log_msg Successfully sent message. MESSAGE ID: $msgSendOutput
echo "Successfully sent message. MESSAGE ID: $msgSendOutput"
#echo ${SVCBU_HOME}/* | xargs rm -rf
rm -f ${LOCK_DIR}/${SITE}exportConfig
log_msg Configuration data has been exported!
log_msg 100
echo "SUCCESS" > ${lock_file}
echo "Configuration data has been exported!"
exit 0

View file

@ -13,6 +13,9 @@
# 05/16/13 #2009 dgilling New backup structure:
# PRIMARY_SITES go to exportgrids/primary/
# and all other go to exportgrids/backup/.
# 02/12/15 #4103 dgilling Refactored to support multiple service
# backup sites.
#
##############################################################################
if [ ${#AWIPS_HOME} = 0 ]
@ -29,34 +32,29 @@ fi
# $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
# 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
source ${AWIPS_HOME}/GFESuite/ServiceBackup/scripts/serviceBackupUtil.sh
SITE=`echo ${2} | tr '[A-Z]' '[a-z]'`
CAPS_SITE=`echo ${2} | tr [a-z] [A-Z]`
export SITE
manuallockFile=${LOCK_DIR}/${SITE}exportGrids
cronLockFile=${LOCK_DIR}/${SITE}exportGridscron
# Create the log file
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}
LOGGER=log_msg
if [ $1 = "-c" ]
then
LOGGER=echo_msg
lockFile=${cronLockFile}
fi
@ -64,31 +62,28 @@ fi
#
if [ $EXPORT_GRID -eq 0 ]
then
$LOGGER "You turned off the export grid option. Check EXPORT_GRID."
$LOGGER 100
echo "You turned off the export grid option. Check EXPORT_GRID."
exit 1
elif [ "$1" = "-c" ] && [ $EXPORT_GRID -ne 1 ]
then
$LOGGER "Cannot execute grid export since you have disabled the cron job. Check EXPORT_GRID."
$LOGGER 100
echo "Cannot execute grid export since you have disabled the cron job. Check EXPORT_GRID."
exit 1
elif [ -z "$EXPORT_GRID" ]
then
$LOGGER "EXPORT_GRID not defined. Export grids failed"
$LOGGER 100
echo "EXPORT_GRID not defined. Export grids failed"
exit 1
fi
if [ -f ${manuallockFile} ]
lock_status=$(isOperationInProgress "exportGrids" ${SITE})
if [[ "${lock_status}" = "true" ]]
then
$LOGGER Cannot export grids for ${CAPS_SITE}. Export grids process already in progress! Cron will not run this hour.
exit 1
echo "Cannot export grids for ${CAPS_SITE}. Export grids process already in progress! Cron will not run this hour."
exit 1
fi
touch ${lockFile}
echo "IN_PROGRESS" > ${lock_file}
$LOGGER "Starting exporting grids..."
$LOGGER 0
echo "Starting exporting grids..."
#
# 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`
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.
# NOTE: SVCBU_DB must be defined in ifps-ccc.env file. Defaults to Official.
@ -115,7 +110,7 @@ then
else
DB_NAME=${CAPS_SITE}_GRID__Official_00000000_0000
fi
$LOGGER ${DB_NAME}
echo ${DB_NAME}
# use PRIMARY_SITES setting to determine NETCDF_PATH
IFS=',' read -ra PRI_SITES <<< "${PRIMARY_SITES}"
@ -175,17 +170,16 @@ then
if [ "$netcdf_error" != "" ]; then
NETCDF_SUCCESS=1
else
$LOGGER "ifpnetCDF failed. Export exits."
rm -f ${lockFile}
$LOGGER 100
echo "ifpnetCDF failed. Export exits."
echo "FAILED" > ${lock_file}
exit 1
fi
fi
fi
else
$LOGGER "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."
$LOGGER "ifpnetCDF will run without doing any trimming."
echo "export_grids was not able to find ${IFPS_DATA}/svcbu_export_elements.${SITE} file."
echo "Without this file, ifpnetCDF will not know how to trim for needed weather elements."
echo "ifpnetCDF will run without doing any trimming."
#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}
#check if the netcdf file is there;if not,exit
@ -198,9 +192,8 @@ then
if [ "$netcdf_error" != "" ]; then
NETCDF_SUCCESS=1
else
$LOGGER "ifpnetCDF failed. Export exits."
rm -f ${lockFile}
$LOGGER 100
echo "ifpnetCDF failed. Export exits."
echo "FAILED" > ${lock_file}
exit 1
fi
fi
@ -220,9 +213,8 @@ else
if [ "$netcdf_error" != "" ]; then
NETCDF_SUCCESS=1
else
$LOGGER "ifpnetCDF failed."
rm -f ${lockFile}
$LOGGER 100
echo "ifpnetCDF failed."
echo "FAILED" > ${lock_file}
exit 1
fi
fi
@ -231,19 +223,18 @@ fi
if [ $NETCDF_SUCCESS = 1 ]
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
fi
if [ -f ${NETCDF_TMP_PATH}/${SITE}Grd.netcdf ]
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
fi
rm -f ${lockFile}
$LOGGER 100
echo "SUCCESS" > ${lock_file}
# Completed successfully
$LOGGER "All done. Export Gridded data has completed"
echo "All done. Export Gridded data has completed"
exit 0

View file

@ -1,45 +1,70 @@
#!/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 ]
then
path_to_script=`readlink -f $0`
export AWIPS_HOME=$(dirname $(dirname $(dirname $(dirname $path_to_script))))
fi
# $1 = Failed site
# $2 = Primary site
. ${AWIPS_HOME}/GFESuite/ServiceBackup/configuration/svcbu.env
source ${AWIPS_HOME}/GFESuite/ServiceBackup/scripts/serviceBackupUtil.sh
if [ $# -ne 2 ]
if [ $# -ne 1 ]
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
fi
. ${AWIPS_HOME}/GFESuite/ServiceBackup/configuration/svcbu.env
PRIMARY_SITE=`echo ${2} | tr '[A-Z]' '[a-z]'`
PRIMARY_CAPS_SITE=`echo ${2} | tr [a-z] [A-Z]`
export PRIMARY_SITE
# $1 = Failed site
FAILED_SITE=`echo ${1} | tr '[A-Z]' '[a-z]'`
FAILED_CAPS_SITE=`echo ${1} | tr [a-z] [A-Z]`
export FAILED_SITE
# Create the log file
logdir=${IFPS_LOG}/`date +%Y%m%d`
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
configureLogging "svcbu_export_bksite_grids" ${FAILED_SITE}
# 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
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
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
@ -50,34 +75,31 @@ else
SVCBU_MASK="-m $SVCBU_GRIDAREA"
fi
log_msg Starting exporting grids...
log_msg 0
echo "Starting exporting grids..."
OUTPUT_DIR=$(getTempDirectory "export_grids_to_failed_site" ${FAILED_SITE})
#Starting ifpnetCDF to pack the grids
log_msg Running ifpnetCDF...
log_msg 25
${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}
echo "Running ifpnetCDF..."
${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}
if [ $? -ne 0 ]; then
log_msg "ERROR: ifpnetCDF failed."
rm -f ${LOCK_DIR}/${PRIMARY_SITE}exportBkSiteGrids
echo "ERROR: ifpnetCDF failed."
echo "FAILED" > ${lock_file}
exit 1
fi
#
log_msg Preparing package for msg_send.
log_msg 60
echo "Preparing package for msg_send."
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
log_msg "Sending the gridded data to ${FAILED_CAPS_SITE}..."
log_msg 90
echo "Sending the gridded data to ${FAILED_CAPS_SITE}..."
# We need to add another -c command in message hanlding system.
# Send the grids to the failed site
cd ${SVCBU_HOME}
cd ${OUTPUT_DIR}
# these lines are commented out for DR14441
# A1 expects to receive a file in gz format
@ -86,7 +108,7 @@ cd ${SVCBU_HOME}
#
# echo ${FAILED_SITE} > 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
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=$?
if [ $exitValue -ne 0 ]
then
log_msg "msg_send has failed to send ${logdir}/Grd.tar"
log_msg "msg_send FAILED with exit value $exitValue and the following error: $msgSendOutput"
rm -f ${SVCBU_HOME}/${FAILED_SITE}Grd.netcdf*
rm -f ${LOCK_DIR}/${PRIMARY_SITE}exportBkSiteGrids
echo "msg_send has failed to send ${OUTPUT_DIR}/Grd.tar"
echo "msg_send FAILED with exit value $exitValue and the following error: $msgSendOutput"
echo "FAILED" > ${lock_file}
rm -f ${OUTPUT_DIR}/${FAILED_SITE}Grd.netcdf*
exit 1
fi
log_msg Successfully sent message. MESSAGE ID: $msgSendOutput
log_msg "Grids successfully exported"
log_msg 100
rm -f ${LOCK_DIR}/${PRIMARY_SITE}exportBkSiteGrids
echo "Successfully sent message. MESSAGE ID: $msgSendOutput"
echo "Grids successfully exported"
echo "SUCCESS" > ${lock_file}
#delete the temporary netCDF file as well.
rm -f ${SVCBU_HOME}/${FAILED_SITE}Grd.netcdf.*
rm -f ${SVCBU_HOME}/Grd.tar
log_msg "All done. Export Gridded data has completed"
rm -f ${OUTPUT_DIR}/${FAILED_SITE}Grd.netcdf.*
rm -f ${OUTPUT_DIR}/Grd.tar
echo "All done. Export Gridded data has completed"
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
# Create the log file
logdir=${IFPS_LOG}/`date +%Y%m%d`
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
configureLogging "ndfd_mhs" ${AW_SITE_IDENTIFIER}
# Retrieve the name of the site from the tar file.
ndfd_msg=${1}
if [ -a ${ndfd_msg} ]
then
log_msg "Received NDFD banner message"
echo "Received NDFD banner message"
mv ${ndfd_msg} ${GFESUITE_HOME}/ndfdMsg
msg=`cat ${GFESUITE_HOME}/ndfdMsg`
# Generate a GFE message saying an alert was received from NDFD.
${GFESUITE_BIN}/sendGfeMessage -h ${SVCBU_HOST} -p ${CDSPORT} -c NDFD -m "$msg" -s
else
log_msg "Unable to locate the NDFD banner message"
log_msg 100
echo "Unable to locate the NDFD banner message"
exit 1
fi
log_msg 50
#clean-up.
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
##############################################################################
# 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 ]
then
path_to_script=`readlink -f $0`
@ -6,51 +25,209 @@ then
fi
. ${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
logdir=${IFPS_LOG}/`date +%Y%m%d`
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
configureLogging "svcbu_receive_configuration" ${SITE_ID}
# 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
log_msg Lock file not present for importing configuration! Cannot continue!
touch ${LOCK_DIR}/svcbuerr
rm -f ${LOCK_DIR}/importConfiguration
rm -f ${LOCK_DIR}/trMode
log_msg 100
echo "Lock file not present for importing configuration! Cannot continue!"
echo "FAILED" > ${svcbu_lock_file}
echo "FAILED" > ${lock_file}
echo "FAILED" > ${trmode_lock_file}
exit 1
fi
USER=$(whoami)
if [ $USER = "root" ]
then
log_msg "Running script as root"
echo "Running script as root"
elif [ $USER = "awips" ]
then
log_msg "Running script as user awips"
echo "Running script as user awips"
else
log_msg "Script must be run as user root or awips"
touch ${LOCK_DIR}/svcbuerr
rm -f ${LOCK_DIR}/importConfiguration
rm -f ${LOCK_DIR}/trMode
log_msg 100
echo "Script must be run as user root or awips"
echo "FAILED" > ${svcbu_lock_file}
echo "FAILED" > ${lock_file}
echo "FAILED" > ${trmode_lock_file}
exit 1
fi
. $SCRIPTS_DIR/proc_receive_config ${1}
exitValue=($?)
if [ $exitValue -ne 0 ]; then
log_msg "Receive configuration returned with errors..."
touch ${LOCK_DIR}/svcbuerr
rm -f ${LOCK_DIR}/importConfiguration
rm -f ${LOCK_DIR}/trMode
log_msg 100
echo "The import_file is: $import_file"
FILESIZE=$(stat -c%s "$import_file")
echo "File Size is: $FILESIZE bytes."
#
# determine local site id(s) using PRIMARY_SITES
#
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
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
##
# 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 ]
then
path_to_script=`readlink -f $0`
@ -6,32 +42,74 @@ then
fi
. ${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
logdir=${IFPS_LOG}/`date +%Y%m%d`
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
configureLogging "svcbu_receive_grids" ${SITE_ID}
# 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
log_msg Lock file not present for importing grids! Cannot continue!
touch ${LOCK_DIR}/svcbuerr
rm -f ${LOCK_DIR}/importGrids
log_msg 100
echo "Lock file not present for importing grids! Cannot continue!"
echo "FAILED" > ${lock_file}
exit 1
fi
. $SCRIPTS_DIR/proc_receive_grids ${1}
exitValue=($?)
if [ $exitValue -ne 0 ]; then
log_msg "Receive grids returned with errors..."
touch ${LOCK_DIR}/svcbuerr
rm -f ${LOCK_DIR}/importGrids
log_msg 100
echo "Processing file: $import_file"
FILESIZE=$(stat -c%s "$import_file")
echo "File Size is: $FILESIZE bytes."
#
# Retrieve the file from the MHS x400 directory
#
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
fi
echo "Cleaning up netcdf file"
rm -f ${SITE_ID}Grd*
echo "SUCCESS" > ${lock_file}
echo "Digital Data Import Complete!"
exit 0

View file

@ -19,13 +19,16 @@
# 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
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 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
@ -36,6 +39,7 @@ BASE_AWIPS_DIR=`dirname $RUN_FROM_DIR`
# get the base environment
source /awips2/GFESuite/bin/setup.env
source /awips2/GFESuite/ServiceBackup/scripts/serviceBackupUtil.sh
# setup the environment needed to run the the Python
export LD_LIBRARY_PATH=${PYTHON_INSTALL}/lib
@ -45,6 +49,25 @@ export PYTHONPATH=${RUN_FROM_DIR}/src:$PYTHONPATH
_PYTHON="${PYTHON_INSTALL}/bin/python"
_MODULE="/awips2/GFESuite/ServiceBackup/scripts/receive_configuration.py"
# quoting of '$@' is used to prevent command line interpretation
$_PYTHON $_MODULE -h localhost -r 9581 "$@"
# Determine the 3 letter failed site id
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.message import WsId
from dynamicserialize import DynamicSerializationManager
from ufpy import ThriftClient, ConfigFileUtil
@ -37,6 +36,7 @@ from ufpy import ThriftClient, ConfigFileUtil
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 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")
obj.setWorkstationID(wsId)
obj.setSiteID("")
obj.setReceivedConfFile(sys.argv[5])
obj.setSiteID(str(sys.argv[6]).upper())
obj.setReceivedConfFile(str(sys.argv[5]))
return obj
if __name__ == '__main__':

View file

@ -19,13 +19,16 @@
# 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
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 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
@ -36,6 +39,7 @@ BASE_AWIPS_DIR=`dirname $RUN_FROM_DIR`
# get the base environment
source /awips2/GFESuite/bin/setup.env
source /awips2/GFESuite/ServiceBackup/scripts/serviceBackupUtil.sh
# setup the environment needed to run the the Python
export LD_LIBRARY_PATH=${PYTHON_INSTALL}/lib
@ -45,6 +49,27 @@ export PYTHONPATH=${RUN_FROM_DIR}/src:$PYTHONPATH
_PYTHON="${PYTHON_INSTALL}/bin/python"
_MODULE="/awips2/GFESuite/ServiceBackup/scripts/receive_grids.py"
# quoting of '$@' is used to prevent command line interpretation
$_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
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.message import WsId
from dynamicserialize import DynamicSerializationManager
from ufpy import ThriftClient, ConfigFileUtil
@ -37,6 +36,7 @@ from ufpy import ThriftClient, ConfigFileUtil
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 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")
obj.setWorkstationID(wsId)
obj.setSiteID("")
obj.setReceivedDataFile(sys.argv[5])
obj.setSiteID(str(sys.argv[6]).upper())
obj.setReceivedDataFile(str(sys.argv[5]))
return obj
if __name__ == '__main__':

View file

@ -27,7 +27,8 @@
#
# 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 ]
@ -37,121 +38,109 @@ then
fi
. ${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_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
configureLogging "svcbu_receive_grids_from_bksite" ${AW_SITE_IDENTIFIER}
# Retrieve the name of the site from the tar file.
import_grd_file=${1}
if [ -a ${import_grd_file} ]
if [ -f ${import_grd_file} ]
then
log_msg "Import Grids file is ${import_grd_file}"
mv ${import_grd_file} ${GFESUITE_HOME}/Grd
cd ${GFESUITE_HOME}
echo "Import Grids file is ${import_grd_file}"
tar xf Grd
if [ $? -eq 0 ]; then
SITE=`cat siteID.txt | tr '[a-z]' '[A-Z]'`
site=`echo $SITE | tr '[A-Z]' '[a-z]'`
gunzip -f ${site}Grd.netcdf.gz
else
# move the file to appropriate directory.
mv -f Grd Grd.netcdf.gz
TEMP_DIR=`mktemp -d`
mv ${import_grd_file} ${TEMP_DIR}/Grd
cd ${TEMP_DIR}
SITE_ID=$(getSiteIdFromTarFile "${TEMP_DIR}/Grd")
if [[ -n "${SITE_ID}" ]]
then
tar -xf Grd
gunzip -f ${SITE_ID}Grd.netcdf.gz
NETCDF_FILE="${TEMP_DIR}/${SITE_ID}Grd.netcdf"
else
mv -f Grd Grd.netcdf.gz
chmod 777 Grd.netcdf.gz
log_msg "Gunzipping ${GFESUITE_HOME}/Grd.netcdf.gz"
gunzip -f Grd.netcdf.gz
echo "Gunzipping ${TEMP_DIR}/Grd.netcdf.gz"
gunzip -f Grd.netcdf.gz
if [ $? -ne 0 ];
then
log_msg "ERROR: Could not gunzip ${GFESUITE_HOME}/Grd.netcdf.gz"
rm -f ${LOCK_DIR}/importBkSiteGrids
log_msg 100
exit 1
fi
log_msg "Done Gunzipping!"
log_msg "Finding site-id using ncdump method."
hdr=`mktemp`
ncdump -h ${GFESUITE_HOME}/Grd.netcdf > $hdr
SITE=`grep siteID $hdr | head -1 | cut -d'"' -f2`
site=`echo $SITE | tr '[A-Z]' '[a-z]'`
if [ -z $site ]
then
log_msg "ERROR: Could not find out the site from ncdump method..."
rm -f $hdr
rm -f ${LOCK_DIR}/importBkSiteGrids
log_msg 100
exit 1
echo "ERROR: Could not gunzip ${TEMP_DIR}/Grd.netcdf.gz"
exit 1
fi
echo "Done Gunzipping!"
mv -f ${GFESUITE_HOME}/Grd.netcdf ${GFESUITE_HOME}/${site}Grd.netcdf
rm -f $hdr
fi
log_msg "site is $site"
echo "Finding site-id using ncdump method."
site=`ncdump -h "${TEMP_DIR}/Grd.netcdf" | grep siteID | head -1 | cut -d'"' -f2`
if [[ -z "${site}" ]]
then
echo "ERROR: Could not find out the site from ncdump method..."
exit 1
fi
SITE_ID=`echo $site | tr '[A-Z]' '[a-z]'`
NETCDF_FILE="${TEMP_DIR}/${SITE_ID}Grd.netcdf"
mv -f "${TEMP_DIR}/Grd.netcdf" ${NETCDF_FILE}
fi
SITE_ID_CAPS=`echo ${SITE_ID} | tr [a-z] [A-Z]`
echo "site is ${SITE_ID_CAPS}"
else
log_msg "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."
log_msg 100
rm -f ${LOCK_DIR}/importBkSiteGrids
echo "Unable to locate the gridded data of the site, ${import_grd_file}"
echo "You will need to request your backup site to send grids again."
exit 1
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.
import_file=${GFESUITE_HOME}/${site}Grd.netcdf
log_msg "import_file=${import_file}"
SITE=`echo ${SITE} | tr '[a-z]' '[A-Z]'`
if [ -a ${import_file} ]
import_file=${OUTPUT_DIR}/${SITE_ID}Grd.netcdf
echo "import_file=${import_file}"
if [ -f ${import_file} ]
then
#use iscMosaic to load grids into databases
log_msg "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
echo "Running iscMosaic to unpack griddded data..."
${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 ];
then
log_msg "ERROR: iscMosaic failed to run correctly. Please re-run iscMosaic manually."
log_msg 100
rm -f ${LOCK_DIR}/importBkSiteGrids
echo "ERROR: iscMosaic failed to run correctly. Please re-run iscMosaic manually."
echo "FAILED" > ${LOCK_FILE}
exit 1
fi
log_msg "Finished running iscMosaic..."
echo "Finished running iscMosaic..."
# Generate a GFE message saying new Grids have arrived in Restore database.
cd ${GFESUITE_BIN}
./sendGfeMessage -h ${SVCBU_HOST} -p ${CDSPORT} -u -m "Restore database has been populated with new grids."
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."
log_msg 100
rm -f ${LOCK_DIR}/importBkSiteGrids
echo "Unable to locate the gridded data of the site,${import_file} You will need to request your backup site to send grids again."
echo "FAILED" > ${LOCK_FILE}
exit 1
fi
#clean-up.
rm -f ${GFESUITE_HOME}/Grd
rm -f ${GFESUITE_HOME}/${SITE}Grd* siteID.txt
log_msg 100
rm -f ${LOCK_DIR}/importBkSiteGrids
rm -f ${import_file}
rm -rf ${TEMP_DIR}
echo "SUCCESS" > ${LOCK_FILE}
#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."
log_msg "Grids received from backup site are stored in ${SITE}_GRID__Restore_00000000_0000 database."
echo "Importing Grids from backup site is completed. You may start your GFE now."
echo "Grids received from backup site are stored in ${SITE_ID_CAPS}_GRID__Restore_00000000_0000 database."
exit 0

View file

@ -1,69 +1,100 @@
#!/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 ]
then
path_to_script=`readlink -f $0`
export AWIPS_HOME=$(dirname $(dirname $(dirname $(dirname $path_to_script))))
fi
# $1 = Primary site
# $2 = Failed site
# $3 = enable/disable troubleshooting mode
# $1 = Failed site
# $2 = enable/disable troubleshooting mode
if [ $# -ne 3 ]
if [ $# -ne 2 ]
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
fi
. ${AWIPS_HOME}/GFESuite/ServiceBackup/configuration/svcbu.env
source ${AWIPS_HOME}/GFESuite/ServiceBackup/scripts/serviceBackupUtil.sh
FAILED_SITE="${1}"
# Create the log file
logdir=${IFPS_LOG}/`date +%Y%m%d`
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
configureLogging "svcbu_request_configuration" ${FAILED_SITE}
# 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
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
fi
touch ${LOCK_DIR}/importConfiguration
if [ $3 -eq 1 ]; then
touch ${LOCK_DIR}/trMode
log_msg "You are in troubleshooting mode - no ISC/VTEC will be available"
echo "IN_PROGRESS" > ${import_lock_file}
if [ $2 -eq 1 ]; then
echo "IN_PROGRESS" > ${trmode_lock_file}
echo "You are in troubleshooting mode - no ISC/VTEC will be available"
fi
log_msg Contacting central server to get configuration for ${2}
log_msg 0
echo "Contacting central server to get configuration for ${FAILED_SITE}"
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=$?
if [ $exitValue -ne 0 ]; then
log_msg "msg_send failed while requesting configuration for ${CAPS_SITE}`date`"
rm -f ${LOCK_DIR}/importConfiguration
rm -f ${LOCK_DIR}/trMode
log_msg "msg_send FAILED with exit value $exitValue and the following error: $msgSendOutput"
echo "msg_send failed while requesting configuration for ${FAILED_SITE}`date`"
echo "FAILED" > ${import_lock_file}
echo "FAILED" > ${trmode_lock_file}
echo "msg_send FAILED with exit value $exitValue and the following error: $msgSendOutput"
exit 1
fi
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=$?
if [ $exitValue -ne 0 ]; then
log_msg "msg_send failed while requesting configuration for ${2}`date`"
rm -f ${LOCK_DIR}/importConfiguration
rm -f ${LOCK_DIR}/trMode
log_msg "msg_send FAILED with exit value $exitValue and the following error: $msgSendOutput"
echo "msg_send failed while requesting configuration for ${FAILED_SITE}`date`"
echo "FAILED" > ${import_lock_file}
echo "FAILED" > ${trmode_lock_file}
echo "msg_send FAILED with exit value $exitValue and the following error: $msgSendOutput"
exit 1
fi
fi
log_msg Successfully sent message. MESSAGE ID: $msgSendOutput
log_msg 30
log_msg "Waiting to receive configuration..."
echo "Successfully sent message. MESSAGE ID: $msgSendOutput"
echo "Waiting to receive configuration..."
exit 0

View file

@ -1,42 +1,73 @@
#!/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 ]
then
path_to_script=`readlink -f $0`
export AWIPS_HOME=$(dirname $(dirname $(dirname $(dirname $path_to_script))))
fi
# $1 = Primary site
# $2 = Failed site
# $1 = Failed site
if [ $# -ne 2 ]
if [ $# -ne 1 ]
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
fi
. ${AWIPS_HOME}/GFESuite/ServiceBackup/configuration/svcbu.env
source ${AWIPS_HOME}/GFESuite/ServiceBackup/scripts/serviceBackupUtil.sh
FAILED_SITE="${1}"
# Create the log file
logdir=${IFPS_LOG}/`date +%Y%m%d`
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
configureLogging "svcbu_request_grids" ${FAILED_SITE}
# 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
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
fi
touch ${LOCK_DIR}/importGrids
echo "IN_PROGRESS" > ${lock_file}
log_msg Contacting central server to get grids for ${2}
log_msg 0
echo "Contacting central server to get grids for ${FAILED_SITE}"
sub=${2}Grd
sub=${FAILED_SITE}Grd
if [ ! -d ${SVCBU_HOME} ]
then
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)
exitValue=$?
if [ $exitValue -ne 0 ]; then
log_msg "msg_send FAILED with exit value $exitValue and the following error: $msgSendOutput"
rm -f ${LOCK_DIR}/importGrids
echo "msg_send FAILED with exit value $exitValue and the following error: $msgSendOutput"
echo "FAILED" > ${lock_file}
exit 1
fi
else
msgSendOutput=$($MSG_SEND_COMMAND -a "DEFAULTNCF" -s $sub -c 23)
exitValue=$?
if [ $exitValue -ne 0 ]; then
log_msg "msg_send FAILED with exit value $exitValue and the following error: $msgSendOutput"
rm -f ${LOCK_DIR}/importGrids
echo "msg_send FAILED with exit value $exitValue and the following error: $msgSendOutput"
echo "FAILED" > ${lock_file}
exit 1
fi
fi
log_msg Successfully sent message. MESSAGE ID: $msgSendOutput
echo "Successfully sent message. MESSAGE ID: $msgSendOutput"
log_msg 30
log_msg "Waiting to receive digital data..."
echo "Waiting to receive digital data..."
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',
'PurgeGfeGridsRequest',
'SaveASCIIGridsRequest',
'ServiceBackupStatusUpdateRequest',
'SmartInitRequest'
]
@ -73,6 +72,5 @@ from ProcessReceivedConfRequest import ProcessReceivedConfRequest
from ProcessReceivedDigitalDataRequest import ProcessReceivedDigitalDataRequest
from PurgeGfeGridsRequest import PurgeGfeGridsRequest
from SaveASCIIGridsRequest import SaveASCIIGridsRequest
from ServiceBackupStatusUpdateRequest import ServiceBackupStatusUpdateRequest
from SmartInitRequest import SmartInitRequest