How to call a python script from a TestStand sequence?
Please tell me how is it possible to call a python script from a TestStand sequence.
Thank for your help in advance.
Imre
Here you can find some information about Python and LabVIEW:
http://forums.ni.com/ni/board/message?board.id=170&message.id=124424&query.id=149647#M124424
If you have LabVIEW, you could use LabVIEW steps to call your Phyton Scipts.
Another solution would be, to do, what is decriibed in the thread directly in TestStand:
You can call a dll or .NET assemblies directly from teststand, or use the "Call Executable" TestStep.
Similar Messages
-
Thank you for your help.
Message Edité par Ralphi le 09-26-2005 03:26 AMYou will need to use the GetResourceString method. A good place to start is here: http://zone.ni.com/devzone%5Cconceptd.nsf/webmain/E835479AA4E7CB2486256BEB006B4925
Hope this helps
kph -
Call a python script from perl file
This is my first post and am not sure if this is the right forum to post this query. If this is not the right forum, pls redirect me to the appropriate forum.
Query :
I have a python script which was created through WLS console's recording feature. I have to call this python script from a perl script (dte topo block).
Any pointers towards how this can be achieved ?
Thanks,
MadhusudanI am using inline python to execute python statements directly from the perl script. However, i get below error :
[maddeshp@slc01auw forDTE]$ perl -c intro.pl
Can't find string terminator "END_OF_PYTHON_CODE" anywhere before EOF at intro.pl line 2.
Has anyone run into this problem ? Any suggestions on fixing this ?
Thanks,
Madhusudan -
How to call a Shell Script from Report 6i
Hi All,
Can anybody tell, how to call a Shell Script from Report 6i.
Thanks in Advance,
Balatry the SRW.USER_EXIT (user_exit_string CHAR);
-
How to call a perl script from an apple script
Hi All,
How to Call a perl Script from an apple script.
Pls Give Your comments.
Thanx & Regards,
EstherApplescript to call a perl script named "/tmp/x.pl" passing an argument "world"
do shell script "/usr/bin/perl /tmp/x.pl world"
or if the script is given the executable atttribute (chmod +x /tmp/x.pl),
do shell script "/tmp/x.pl world"
Perl script "/tmp/x.pl" that prints a string using a passed argument
#!/usr/bin/perl
print "Hello $ARGV[$1]\n"; -
How to call a shell script from a java code
Hello can any one suggest me how to call a shell script from a java program that takes three parameters.
i have a shell script (msp_restore_gui) when i run this script in the command line in a RHEL5 ,SUSE10 and Debian machine it works fine .I even tested to call it from a java program and it also worked fine but when i used the same in a J2ee application where the user when clicks the restore button in a webserver this inturn sends the request to a java file named BackupManager.java where i call the shell script.But here it fails.Waiting for your suggestions.If you want i can put the code also hereyes the script is in /usr/local/mss/tools/backup and the script (msp_restore_gui) is as follows
#!/bin/sh
TIMESTAMP=`date +%d_%b_%y-%H-%M`
touch /var/backups/mss/mss_restore_"$TIMESTAMP".log
LOGFILE="/var/backups/mss/mss_restore_"$TIMESTAMP".log"
### Explode tgz file
cd /
# Checks to be done:
# root login
# assume he passes the parameter as msp_backup_<timestamp>
# check for the existence of the .tz and fileList.txt
# Checking for the root login and if not logged on as root
# permission will be denied to execute this script
logmsg(){
echo "`date`: $*" >> $LOGFILE 2>&1
echo "$*"
#usage of this script
while [ $# -ne 0 ]
do
case $1 in
-n)
shift
ARCHIVE_NAME=`find / \( -name "$1.tz" -o -name "$1.tgz" \) 2>/dev/null`
FILE_NAME=`find / -name $1_filesList.txt 2>/dev/null`
if [ x$ARCHIVE_NAME = x -a y$FILE_NAME = y ]
then
logmsg "ERROR: Files not found, Restore cannot proceed"
usage
else
tar tvzf $ARCHIVE_NAME > /dev/null 2>&1
if [ $? -ne 0 ]
then
echo "ERROR: The tar file $ARCHIVE_NAME is not proper. Restore cannot proceed"
exit 1
else
echo "Backedup files are present, proceeding with restore......" >> $LOGFILE 2>&1
fi
fi
usage
SKIP_CLEANUP=1
STATUS=1
exit
esac
shift
done
rm -rf ./newfile
curr_ver_file="/usr/local/mss/etc/version"
/usr/local/mss/tools/backup/check_version $curr_ver_file $FILE_NAME
ret_code=$?
echo "Exit value of check_version is $ret_code"
if [ "$ret_code" != 0 ]
then
logmsg "MSP Version not matching. Exiting from restore now...."
errormsg=`cat /usr/local/mss/temp/ver_err_mesg`
logmsg $errormsg
rm -f /usr/local/mss/temp/ver_err_mesg
exit 1
else
echo "Version check is successful"
fi
#### ShutDown MSS########
/etc/init.d/mss stop
sleep 2
### Shutdown semm
/etc/init.d/semm stop
sleep 2
rm -rf `grep -v "MSP Version:" $FILE_NAME`
logmsg "MSP restore in progress......"
tar mxvfz $ARCHIVE_NAME >> $LOGFILE
sleep 5
### Call mysql restore script
/usr/local/mss/bin/mysql_alldb_restore.sh >> $LOGFILE 2>&1
if [ $? -ne 0 ]; then
logmsg "Database restore Failed. Cannot proceed further"
exit 1 ;
else
logmsg "Database restore Succeeded."
fi
### Remove DB Dump Files
rm -f /var/lib/mysql-dumps/*
### Trigger cleanup of airprism database tables
#touch /usr/local/mss/airprism/server/config/reinitdb
### Trigger re-import of software packages
touch /usr/local/mss/swdepot/reimport
### Remove log files under the "apps" directory
find /usr/local/mss/apps -name '*.log*' | xargs rm -f
find /usr/local/mss/logs -follow -name '*[._]log*' | xargs rm -f
if [ $? -ne 0 ]; then
logmsg "MSP restore Failed. Cannot proceed further"
exit 1 ;
else
logmsg "MSP restore Succeeded."
fi
# reinstall_patch is touched so that patches are re-installed after restoring of MSP.
touch /usr/local/mss/patch/bin/reinstall_patch
##### Start MSS
logmsg "restarting MSP server "
/etc/init.d/mss start
sleep 5
### Start semm
/etc/init.d/semm start
sleep 5
logmsg "MSP server is now restarted"
my jsp page backup.jsp is as follows
<%@taglib uri="portlet.tld" prefix="uif" %>
<%@taglib uri="msp-console.tld" prefix="msp" %>
<uif:defineObjects/>
<%@page import="javax.portlet.*" %>
<%@ page import="java.util.Date" %>
<%@ page import="java.util.Vector" %>
<%@ page import="java.text.DateFormat" %>
<%@ page import="com.symbol.mss.console.admin.backup.BackupManager" %>
<%@ page import="com.symbol.mss.console.admin.system.SystemInfoPortlet" %>
<%
String STYLE_NAME = request.getParameter("style");
if (STYLE_NAME == null) STYLE_NAME = STYLE_DEFAULT;
final String ua = request.getHeader("User-Agent");
BackupManager helper = null;
PortletSession portletSession = renderRequest.getPortletSession();
helper = (BackupManager)portletSession.getAttribute("helper");
if (helper == null) {
//System.err.println("Created new BackupManager");
helper = new BackupManager();
portletSession.setAttribute("helper", helper);
final BackupManager backupManager = helper;
String action = "";
final String backupName = renderRequest.getParameter("backupName");
String completePath = backupManager.getBackupDir() + backupName + backupManager.getBackupFileExt();
if (backupName != null) {
action = "backup";
if(backupManager.backup(backupName)) {
SystemInfoPortlet.beginRestartMSP();
} else {
action = "backuperror";
final String cmd = renderRequest.getParameter("submitButton");
final String selectedBackup = renderRequest.getParameter("selectedBackup");
int tarFileStatus =0;
String backupTarFile ="";
String backupFileList ="";
if ("Restore".equals(cmd)) {
if (selectedBackup != null) {
tarFileStatus = backupManager.verifyTarFile(selectedBackup);
//backupTarFile = backupManager.getRestoreFile(Integer.parseInt(selectedBackup));
//backupFileList = backupTarFile.substring(0, backupTarFile.lastIndexOf(backupManager.getBackupFileExt()))+"_filesList.txt";
if (tarFileStatus == 0){
action = "restore";
backupManager.restore(selectedBackup);
SystemInfoPortlet.beginRestartMSP();
} else {
action = "error";
} else if ("Remove".equals(cmd)) {
backupManager.remove(Integer.parseInt(selectedBackup));
DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.SHORT);
PortletURL restoreURL = renderResponse.createActionURL();
%>
<%@ include file="/jsp/core/constants.jspf" %>
<% if (action.length() > 0) {
if ("backup".equals(action))
%>
<p>The MSP Appliance has been shut down in order to create the <%=backupName %> backup file,
and will automatically restart as soon as the file has been created.
To continue your work, please log out of the MSP Console, wait for the appliance
to restart, and then log back in. The amount of time you'll have to wait for the
MSP Appliance to come back online depends on the amount of information you have
stored in the MSP Database.</p>
<p>The full pathname for the backup file is: <%=completePath %></p>
<% }
else if ("restore".equals(action))
%>
<p>The MSP Appliance has been shut down in order to restore from the <%=backupTarFile%> backup file,
and will automatically restart as soon as the restore is complete.
To continue your work, please log out of the MSP Console, wait for the appliance
to restart, and then log back in. The amount of time you'll have to wait for the
MSP Appliance to come back online depends on the amount of information you have
stored in the MSP Database.</p>
<% } else if ("backuperror".equals(action)) { %>
<p><img src="images/dialogue/error_16.gif" class="icon" alt="Notify" /> Errors occurred while taking back up of MSP. Please see the backup service log file for more details.
</P>
<% } else if ("error".equals(action)) {
if (tarFileStatus == 4) { %>
<p><img src="images/dialogue/error_16.gif" class="icon" alt="Notify" /> The backup file <%=backupTarFile%> contains errors. This backup can't be restored. Please restore a valid back up.
</P>
<%} else if (tarFileStatus == 3) { %>
<p><img src="images/dialogue/error_16.gif" class="icon" alt="Notify" /> The backup file list <%=backupFileList %> is missing. This file is required to restoring backup. Please get the backup file list and proceed with restoring backup.</p>
<%} else if (tarFileStatus == 2) { %>
<p> <img src="images/dialogue/error_16.gif" class="icon" alt="Notify" /> The backup file <%=backupTarFile%> contains errors and the backup file list <%=backupFileList%> is missing. This backup can't be restored. </p>
<%} %>
<% }
} else { %>
<p><strong>Note</strong>: Both backup and restore will shut down MSP temporarily. MSP will be unable to collect data from devices, send notifications, or provide MSP Console access during this time. When the backup or restore operation is complete, MSP will come back online automatically.</p>
<h3>Backup</h3>
<form action="<%= restoreURL.toString() %>" method="post">
<p>Please provide a name for your backup. MSP will provide the date automatically in the list of backups.</p>
<p><label for="<uif:namespace />backupName">Name</label> <input type="text" name="<uif:namespace />backupName" id="<uif:namespace />backupName" size="20" maxlength="256" /> <input type="submit" name="<uif:namespace />submitButton" value="Back up now" onclick="return <uif:namespace/>validateName()"/></p>
</form>
<h3>Restore</h3>
<p>This will restore all databases (device assets, collected device data, software packages, policies, etc.) to their state as of the time the backup was made. Changes since then <em>except for backups</em> will be destroyed.</p>
<%
Vector restoreList = helper.getRestoreEntries();
Vector restoreDates = helper.getRestoreDates();
Vector restoreVersions = helper.getRestoreVersions();
Vector filesStatus = helper.getBackupFilesStatus();
%>
<% if (restoreList.size() == 0) { %>
<p>There are no backups currently available.</p>
<% } else { %>
<form action="<%= restoreURL.toString() %>" method="post">
<table class="input-radios" id="<uif:namespace />existingBackups">
<thead>
<tr>
<th></th>
<th>Name</th>
<th>Date</th>
<th>MSP Version</th>
<th>Remarks </th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="4" class="actionsOnSelected">
<input type="submit" name="<uif:namespace />submitButton" value="Restore" onclick="return confirm('This action requires MSP and all related services to be shut down. Console will be unavailable if the request is submitted. The server will restart automatically once restore has been completed.');" />
<input type="submit" name="<uif:namespace />submitButton" value="Remove" onclick="return confirm('This action will remove the backup archive. You will no longer be able to restore this backup. Continue?');" />
</td>
</tr>
</tfoot>
<tbody><%-- First one (most recent) is checked by default. Every other row has class="portlet-section-alternate". Note that each ID must be unique and must match the value of the "for" attribute on the corresponding "label" element. --%>
<%
for (int i = 0; i < restoreList.size(); i++) {
%>
<tr <%= (i % 2 == 1) ? " class=\"portlet-section-alternate\"" : "" %>>
<td><input type="radio" name="<uif:namespace />selectedBackup" value="<%= i %>" id="<uif:namespace />selectedBackup-<%= i %>" <%= (i == 0) ? "checked=\"checked\"" : "" %> /></td>
<td><label for="<uif:namespace />selectedBackup-<%= i %>"><%= restoreList.elementAt(i) %></label></td>
<td><%= dateFormat.format((Date)restoreDates.elementAt(i)) %></td>
<td><%= restoreVersions.elementAt(i) %></td>
<td><%= filesStatus.elementAt(i) %></td>
</tr>
<%
%>
</tbody>
</table>
</form>
<% } %>
<% } %>
<script type="text/javascript">
<!--//--><![CDATA[//><!--
function <uif:namespace/>validateName() {
var name =document.getElementById("<uif:namespace />backupName");
var msg= "<msp:i18n key="BackupMsg"/>";
var str=name.value;
var re = /^[A-Za-z0-9_]+$/;
if (!str.match(re)) {
alert(msg);
name.focus();
return false;
} else {
return confirm('This action requires MSP and all related services to be shutdown. Console will be unavailable if the request is submitted. The server will restart automatically once backup has been completed.');
//--><!]]>
</script>
and my BackupManager.java is as follows where the code in bold and italic is called the restore()
//============================================================================
// Symbol Technologies P R O P R I E T A R Y S O U R C E C O D E
// C O N F I D E N T I A L
// Copyright (c) 2003 Symbol Technologies. All Rights Reserved.
// All information contained herein is the property of Symbol Technologies,
// or its Licensors, and are protected copyrights and trade secrets, and may
// be covered by U.S. patents. Any reproduction or dissemination of any
// portion of this document, of the software, or other works derived from it
// is strictly forbidden unless prior written permission is obtained from
// Symbol Technologies.
//============================================================================
package com.symbol.mss.sdf.services.backup;
import java.io.*;
import java.sql.Time;
import java.text.DateFormat;
import java.util.logging.FileHandler;
import java.util.logging.Formatter;
import java.util.logging.LogRecord;
import java.lang.Process;
import java.util.*;
import org.apache.avalon.framework.configuration.Configurable;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.logger.LogEnabled;
import org.apache.avalon.framework.logger.Logger;
import com.symbol.mss.sdf.admin.AdministratorService;
import com.symbol.mss.sdf.backup.*;
import com.symbol.mss.sdf.data.*;
* @author nramaiah
* Service to perform scheduled backups of the system state.
public class BackupManager implements BackupService, DataHandler,
LogEnabled, Configurable {
// MSS Home Path
private static String mssHome = System.getProperty("phoenix.home", File.separator + "usr" +
File.separator + "local" +
File.separator + "mss" +
File.separator);
// Backup related definitions
private static final String BACKUP_LIST_FILE_NAME = "conf" + File.separator + "files_to_backup.txt";
private static final String BACKED_UP_LIST_FILE_NAME_SUFFIX = "_filesList.txt";
private static final String BACKUP_LOCATION = File.separator + "var" + File.separator + "lib" +
File.separator + "mss-backups" + File.separator;
private static final String BACKUP_PARTITION = File.separator + "var" + File.separator + "lib";
private static final String VERIFY_BACKUP = File.separator + "usr" + File.separator + "local" +
File.separator + "mss" + File.separator+"tools"+
File.separator+"backup"+File.separator+"verifyBackup.sh";
// DB backup/restore related definitions
private static final String DB_DUMP_LOCATION = File.separator + "var" + File.separator +
"lib" + File.separator +
"mysql-dumps" + File.separator;
private static final String DB_BACKUP_SCRIPT = "bin" + File.separator + "mysql_alldb_backup.sh";
private static final String DB_RESTORE_SCRIPT = "bin" + File.separator + "mysql_alldb_restore.sh";
// Private variables
private AdministratorService m_admin = null;
private Logger m_logger = null;
private String backupLocation = null;
private String backupListFileName = null;
private String backupPartition = null;
private int backupPartitionLimit = 90;
private String dbDumpLocation = null;
private String dbBackupScript = null;
private String dbRestoreScript = null;
private List servicesBackupList = null;
private String tarFileExtension =".tgz";
private String errFileExtension =".err";
private int exitValue=0;
* Default Constructor
public BackupManager() {
servicesBackupList = new ArrayList();
* Set the administrator service implementation. Link established by Broker service.
* @param admin reference to an implementation of AdministratorService
public void setAdministrator(AdministratorService admin) {
m_admin = admin;
* Set the job publisher service implementation. Link established by Broker service.
* @param jobPublisher reference to an implementation of JobPublisherService
public void setJobPublisher(DataChannel jobPublisher) {
jobPublisher.subscribe(this);
* Gets the backup manager object.
* @return backup manager object
public BackupService getBackupService() {
return this;
* Service lifecycle method.
* @param logger logger object to be used by the service
public void enableLogging(Logger logger) {
m_logger = logger;
* Service lifecycle method.
* @param configuration service configuration object
public void configure(Configuration configuration) throws ConfigurationException {
// Verify MSS Home path
if (!mssHome.endsWith(File.separator))
mssHome += File.separator;
// Get the location where the backup file needs to be placed
backupLocation = configuration.getChild("BackupLocation").getValue(BACKUP_LOCATION);
// Verify backup directory path
if (!backupLocation.startsWith(File.separator))
backupLocation = mssHome + backupLocation;
if (!backupLocation.endsWith(File.separator))
backupLocation += File.separator;
// Get the file listing the files/directories to be backed up
backupListFileName = configuration.getChild("FilesList").getValue(BACKUP_LIST_FILE_NAME);
// Verify backup list file name path
if (!backupListFileName.startsWith(File.separator))
backupListFileName = mssHome + backupListFileName;
// Get the partition where the backups are kept
backupPartition = configuration.getChild("BackupPartition").getValue(BACKUP_PARTITION);
// Verify backup partition path
if (!backupPartition.startsWith(File.separator))
backupPartition = File.separator + backupPartition;
if (backupPartition.endsWith(File.separator))
backupPartition = backupPartition.substring(0, (backupPartition.length()-1));
// Get the limit on the amount of free space on the backup partition
backupPartitionLimit = configuration.getChild("BackupPartitionLimit").getValueAsInteger(backupPartitionLimit);
// Get the location where the DB dump files will be placed
dbDumpLocation = configuration.getChild("DBDumpLocation").getValue(DB_DUMP_LOCATION);
// Verify DB dump directory path
if (!dbDumpLocation.startsWith(File.separator))
dbDumpLocation = mssHome + dbDumpLocation;
if (!dbDumpLocation.endsWith(File.separator))
dbDumpLocation += File.separator;
// Get the name of DB dump backup script
dbBackupScript = configuration.getChild("DBBackupScript").getValue(DB_BACKUP_SCRIPT);
// Verify backup script path
if (!dbBackupScript.startsWith(File.separator))
dbBackupScript = mssHome + dbBackupScript;
// Get the name of DB dump restore script
dbRestoreScript = configuration.getChild("DBRestoreScript").getValue(DB_RESTORE_SCRIPT);
// Verify restore script path
if (!dbRestoreScript.startsWith(File.separator))
dbRestoreScript = mssHome + dbRestoreScript;
* Individual services can supply a list of files/directories to be backed up.
* These are files apart from the files specified in conf/files_to_backup.txt and
* will be backed up as well.
* @param files list of files/directories
public void filesToBackup(List files) {
synchronized(this) {
if (files != null) {
if (files.size() > 0) {
// Add the list contents to the current backup list
for (int i=0; i<files.size(); i++) {
String tStr = (String)files.get(i);
// Check for absolute or relative path
if (tStr.startsWith(File.separator))
servicesBackupList.add(tStr);
else
servicesBackupList.add(mssHome + tStr);
else
m_logger.info("Empty list of filenames. Nothing added.");
else
m_logger.info("Null list of filenames. Nothing added.");
* Individual services can supply a list of files/directories to be backed up.
* Specified files will be added to the file defining the list of files to be backed up.
* @param files list of files/directories
private void persistFilesToBackup(List files) {
synchronized(this) {
if (files != null) {
if (files.size() > 0) {
// Add the list of files provided to the end of file
try {
File file = new File(backupListFileName);
if ((file == null) || (!file.exists()))
file.createNewFile();
// Seek to the end of the file
RandomAccessFile rFile = new RandomAccessFile(file, "rw");
if (rFile != null) {
rFile.seek(rFile.length());
// Write the list contents to the file
for (int i=0; i<files.size(); i++) {
String tStr = (String)files.get(i);
// Check for absolute or relative path
if (tStr.startsWith(File.separator))
rFile.writeBytes(tStr + "\n");
else
rFile.writeBytes(mssHome + tStr + "\n");
else
m_logger.error("Error opening file " + backupListFileName);
rFile.close();
catch (Exception ex) {
ex.printStackTrace();
m_logger.error("Error adding entries to file " + backupListFileName, ex);
else
m_logger.info("Empty list of filenames. Nothing added.");
else
m_logger.info("Null list of filenames. Nothing added.");
* Command to be run during the backup process. Individual services can
* provide shell commands that will be executed before backing up the files.
* @param command shell command to be executed
private void runCommand(String command) {
* Creates a shell script at the specified location that will backup the
* files listed in the List passed in.
* @param scriptFileName location where the script needs to be created
* @param backupFileName name for the tar file being created
* @param backupList list of files to be backed up
private void createBackupScript(String scriptFileName, String backupFileName, ArrayList backupList) throws Exception {
// Create a new StringBuffer to build the contents to be written to the script file
StringBuffer buffer = new StringBuffer();
// Add the initial comment in the start script
buffer.append("#!/bin/sh\n" + "set -x\n\n");
// Check if the partition has enough space
buffer.append("### Check if the partition has enough space\n" +
// "diskUsed=`df -k | grep \"" + backupPartition + "\" | awk '{print $5}' | cut -d\"%\" -f1`\n" +
" diskUsed=`df -k \"" + backupPartition + "\" | awk '{print $5}' | cut -d\"%\" -f1 | grep -v Use`\n" +
"echo \"Partition " + backupPartition + " is $diskUsed% used.\"\n" +
"if [ \"$diskUsed\" -lt \"" + backupPartitionLimit + "\" ]\nthen\n" +
" echo \"Starting backup...\"\n\n");
// Shutdown semmd
buffer.append(" ### Shutdown semm\n" + " /etc/init.d/semm stop\n" +
" sleep 2\n\n");
// MSP Limited release and earlier builds stop mysql DB and backup the
// /var/lib/mysql directory as it is. Starting MSP 1.0 GA release, mysql
// dump script will be integrated which will create sql scripts to
// restore the database.
// Check if mysql dump creation script exists
File mysqlDumpScript = new File(dbBackupScript);
if (mysqlDumpScript.exists()) {
// MSP 1.0 GA and later releases
// Run the script that will generate sql scripts that would re-create the DB as it is
buffer.append(" ### Call mysql dump script\n" +
" " + dbBackupScript + "\n\n");
else {
// MSP Limited release
// Add command to shutdown mysql
buffer.append(" ### Shutdown mysql\n" + " /etc/init.d/mysql stop\n\n");
// Change to root directory and create the tgz file
buffer.append(" ### Create tgz file\n" + " cd /\n");
// Build up the tar file name from the current date and time
String fileName = null;
if ((backupFileName != null) && (backupFileName.length() > 0))
fileName = backupFileName;
else {
// File name not provided by user, build one using the timestamp
Calendar cal = Calendar.getInstance();
Date date = cal.getTime();
fileName = "MSS-"
+ DateFormat.getDateInstance().format(date).replaceAll(" ", "").replaceAll(",", "")+ "-"
+ (new Time(cal.getTimeInMillis())).toString().replaceAll(":", "").substring(0,4);
String tarFileName = fileName + ".tgz";
// Get the current MSP Version
String mspVersion = getMSPVersion();
// Gather all the files to be backed up. Add them to the tar command and
// also dump them into the file maintaining the list of files being backed up
String listStr = "";
for (int i=0; i<backupList.size(); i++)
listStr += (String)backupList.get(i) + "\n";
// Dump the current MSP version and the list of files being backed up into a manifest file
String listFileName = fileName + BACKED_UP_LIST_FILE_NAME_SUFFIX;
RandomAccessFile file = new RandomAccessFile(backupLocation + listFileName, "rw");
m_logger.info("List of files/directories being backed up:\n" + listStr);
file.writeBytes("### MSP Version: " + mspVersion + " ###\n");
file.writeBytes(listStr);
file.close();
// Add the tar command to the script
buffer.append(" echo \"Creating " + backupLocation + tarFileName + "...\"\n" +
" tar cvhfz " + backupLocation + tarFileName + " `grep -v \"MSP Version:\" " +
backupLocation + listFileName + "`\n\n");
// Check if free space on the backup partition has reduced below the limit
// If enough space left, backup is retained, "mss" is made the owner of the files,
// "backup" is made the group the files belong to,
// permissions changed to be "0660" and
// backup action declared a success
// Else, backup files are deleted and declared a failure
buffer.append(" ### Check if the partition has enough space left\n" +
//" diskLeft=`df -k | grep \"" + backupPartition + "\" | awk '{print $5}' | cut -d\"%\" -f1`\n" +
" diskLeft=`df -k \"" + backupPartition + "\" | awk '{print $5}' | cut -d\"%\" -f1 | grep -v Use`\n" +
" echo \"Partition " + backupPartition + " is $diskLeft% used.\"\n" +
" if [ \"$diskLeft\" -gt \"" + backupPartitionLimit + "\" ]\n" +
" then\n" +
" ### Failure\n" +
" echo \"Partition " + backupPartition + " does not have enough space.\"\n" +
" echo \"Backup " + backupLocation + tarFileName + " will be removed.\"\n" +
" rm -f " + backupLocation + fileName + "*\n" +
" echo \"Backup Failed.\"\n" +
" else\n" +
" tar tvzf " + backupLocation + tarFileName + " > /dev/null 2>&1\n" +
" if [ ! -s " + backupLocation + tarFileName + " -o $? -ne 0 ] \n" +
" then\n" +
" echo \"MSP Backup operation is not successful. The tar file " + backupLocation + tarFileName + " contains errors.\"\n" +
" echo \"Please take the backup again\"\n" +
" touch "+backupLocation+fileName+".err\n" +
" else \n" +
" ### Success\n" +
" ### Change the owner, group and permissions for the backup files\n" +
" chown mss " + backupLocation + fileName + "*\n" +
" chgrp backup " + backupLocation + fileName + "*\n" +
" chmod 0660 " + backupLocation + fileName + "*\n" +
" echo \"Backup Completed.\"\n" +
" fi\n" +
" fi\n\n");
// MSP Limited release and earlier builds re-start mysql. Starting
// MSP 1.0 GA release, mysql is not stopped and so re-start is not
// needed. sql scripts created by the dump script get packed into
// the tar file and so are deleted.
// Check if mysql dump creation script exists
if (mysqlDumpScript.exists()) {
// MSP 1.0 GA and later releases
// Remove DB dump files
buffer.append(" ### Remove DB Dump Files\n" + " rm -f " + dbDumpLocation + "*\n\n");
else {
// MSP Limited release
// Start mysql
buffer.append(" ### Start mysql\n" + " /etc/init -
Calling a python Script from an AE Script
I'm trying to create a little automation script to inegrate my studios's pipline with our Shotgun page.
I have the python cript working as "myScripy.py <arguments>" Where arguments are comp names to be updated.
i was hoping i could create an array of selected comps and run the script once for each using:
myPythonScript = "c:\\PythonScripts\\myScript.py " + selectedCompNameVariable
system.callSystem(myPythonScript)
It appears to attempt to call the pythong script via command line, but i get the following error:
"After Effects warning: ERROR: %1 is not a valid Win32 application"
Why is this? Can I not call a python script on my computer via this command? -
Is there a way I can call a python script from within a Robohelp script?
Hi,
I want to integrate an external python script into the current extendscript I use in RoboHelp 10. Is there a way to do that?
Thanks,
LaurenYou can use the command line to call any kind of external application.
Personally, I use the following function to create bat files to do such
work.
I've taken these functions from my free RH Extendscript library -
http://www.wvanweelden.eu/product/robohelp-extendscript-library
function ExecuteBatchFile(command, waitforbatch) {
if(string_isEmpty(command))
return false;
if(!waitforbatch) {
if(waitforbatch != false) {
waitforbatch = true;
var path = Folder.appData.fsName + '/';
var batFileName = 'ExtendScriptBatchFile';
var batFileExtension = '.bat';
var batFile = new File(pathbatFileNamebatFileExtension);
if(batFile.exists) {
var i = 0;
while(batFile.exists) {
i++;
batFile = new File(pathbatFileNamei+batFileExtension);
command+= "\ndel /F /Q \"" + batFile.fsName + "\"";
writeFile(batFile, command, false);
if(!isFile(batFile, true))
return false;
batFile.execute();
/* Wait on batch file execution if needed */
if(waitforbatch) {
while(batFile.exists) {
msg(".");
$.sleep(100);
return true;
function writeFile(file, szOutput, encoding) {
var szFilePath = file.fsName;
if(!encoding || encoding == true) {
encoding = "UTF-8";
var fileObj = new File(szFilePath);
fileObj.encoding = encoding;
fileObj.open("w");
fileObj.write(szOutput);
fileObj.close();
Kind regards,
Willam -
How to call a batch script from DI?
Hi All,
I'm new to DI/DS and would like to know is there a way to call a batch sciprt (.bat file) in DI?
What I try to do is,
1.call a batch script to move source files from a file server to the source folder before kicking off the data flow
2. once the data flow is completed, call a batch script to move the processed source files to the achive folder.
In other ETL tool like informatica it can be done via the command task, is there something similar in DI?
Any help would be appreciated.
Regards
BLThanks Suneer.
Just want to clarify, when I create the script task in the work flow, should I put the path of my batch file or the batch script itself in?
e.g., my batch script is movefile.bat under folder C:\Script,
and the command is: move /Y "C:\Input\*.*". "C:\Archive\".
in the script task, should I put
exec('cmd', 'C:\Script\movefile.bat')
or
exec('cmd', 'move /Y "C:\Input\*.*". "C:\Archive\".')
Thanks again for your help
Regards,
BL -
How to call CVP VXML Script from ICM
Hi,
Please help me in the below scenario-
ICM-7.5
CVP-7.0
I am trying to invoke a CVP VXML Script from ICM.
Scenario is, I have made a small VXML script in CVP & I want to invoke this script from ICM.
Needs specific parameter to achieve the same.
Please help me to achieve the above.
Thanks,
ManishThe VXML server comes with the 2 port evaluation licence and a working application called "HelloWorld". The first test you should make is to have ICM invoke "HelloWorld" - the spelling must be correct, case sensitive.
You can tell if the VXML Server can run the application by using your browser.
http:// ADDRESS>:7000/CVP/Server?application=HelloWorld
should return a page of VXML. Check VXMLServer\admin\status.bat and it should show that one person is in the application HelloWorld.
Then call http:// ADDRESS>:7000/CVP/Server?audium_action=hangup
will return the disconnect page of VXML data and drop the call, and now status should show no callers in the application.
REgards,
Geoff -
How to call BS Browser Script from Server Script
I have a req. where a confirmation message need to be displayed to the user from Server Script.
I have followed the steps described in bookshelf http://download.oracle.com/docs/cd/E05553_01/books/CommSrvAdm/CommSrvAdm_AdvConfig40.html
and the same is not working. I am invoking the BS from Applet Server script.
Please let me know if the above steps can be used in our context as it is not at all related to CTI.
For the above config I have selected one of the existing Profiles in our system and am not sure about the role played by the same.
Thanks in advance.You create a Business Service, then deploy the BS as described in the bookshelf and finally call it through Browser Scripts.
You can't interact with the browser session from the server the way you describe your requirement. -
How to call RMAN stored script from within DBMS_SCHEDULER
Hi
I have a RMAN script to backup my RAC database. The backup script is stored in recovery catalog.
How can I schedule it using DBMS_SCHEDULER not unix cron to run this stored script?
Any input is appreciated.
Kevinbegin
dbms_scheduler.create_schedule(
schedule_name => 'daily_at_4am',
repeat_interval => 'FREQ=DAILY; INTERVAL=1;
BYDAY=MON,TUE,WED,THU,FRI,SAT,SUN; BYHOUR=4',
comments => 'schedule to run daily at 4am');
dbms_scheduler.create_program
( program_name => 'backup_database',
program_type => 'EXECUTABLE',
program_action => '/opt/oracle/product/admin/bin/rman_fullback.sh',
enabled => TRUE,
comments => 'Backup database using rman'
dbms_scheduler.create_job (
job_name=>'daily_backup',
program_name =>'backup_database',
schedule_name=> 'daily_at_4am',
enabled => true,
comments => 'backs up databases daily at 4am'
end;
/ -
How to call photoshop new script from bridge tools menu
i just create a 'Image Processor Outter Mode.jsx' script for photoshop and copy to ../photoshop cs3/presets/scripts/ folder. i can see the menu item list in photoshop file->script->.
but can't find it in the bridge cs3 menu. in bridge cs3 tools->photoshop. it only list the default script, image processor for example.
i'm plan to search files in bridge and run all the result files with the new jsx. anybody can help me ?
thanks.You would need to amend Photoshop-10.jsx on a pc this would be found in the following folder:-
C:\Program Files\Common Files\Adobe\Startup Scripts CS3\Adobe Photoshop -
Calling Python Script from LabVIEW
Hello Everyone,
I want to call the Python script from LabVIEW.
I tried with using at the command line but i am unable to run that script file..
i have gone through LabPython but i am unable to call the scripts from there also..
If someone has an example of a VI which invokes a python script, it will be very helpful...
Thanks a lot in advance
Regards
Avniavni wrote:
I have to invoke the Script file at command prompt.
Can you descriobe your restriction(s) concerning "invoke the script at the command prompt"? There may be ways around that. -
How to call a java script in while eventprocessing?
hi friends,
How to call a java script from an event.
when i click a button, i want to display a message in IE.
For ex: BTN_CAN,
When i click on this in IE i want show a message like "clicked on cancelled".
how can i do this.....
in javascript WINDOW.ALERT i am trying....
Regards,
Shankar.you can do some thing like this...
< % @ pa g e la ng uag e="a b ap" %>
< % @ e xte n sion name="htmlb" prefix="h tm l b" % >
< h t m l b:co nt e nt d es ign="design2 00 3" >
< ht m lb:page title=" " >
< h tm lb :for m >
< h t mlb:textVi ew text = "Hello World!"
des ign = "EMPHASIZED" />
< ht m lb :bu tton text = "Press Me"
on Clie ntC lick = "al ert(' H ell w or l d')" / >
< / h t mlb :for m >
< / ht mlb :pa g e >
< / htm lb:co nt e nt >
Edited by: Vijay Babu Dudla on Oct 6, 2008 7:20 AM
Maybe you are looking for
-
DIFFERNCE BETWEEN ACCOUNT KEY & ACCURALS IN MM PRICING
Hello, Please explain the difference between Account key & accruals in MM pricing procedure. In which situation account key will be used & accruals will be used & what is the impact. Thanks & regards Varun Bisaria Edited by: Csaba Szommer on Jun 22,
-
JAX-RPC and non-primitive data types
Hello all! I am using JWSDP v1.3 and i have a problem using non-primitive data types as return types for my operations. Consider the helloservice example of the JWSDP1.3 tutorial. Now suppose that instead of having the simple operation sayHello() tha
-
When trying to install Create Cloud get A12E5 - meaning?
I am using the 30 day trial and downloaded it to a desktop only to discover I really need it on my laptop. So I'm attempting to download on my laptop but now I get error A12E5. Does this have something to do with only allowing one download? The er
-
Two basic questions as I think of getting an iPod nano (since my kids make scratches on all their CDs, I guess it's safer on the computer) 1. Can I recharge the batterie without the computer (I'll be on vacation...) 2. There a video podcast on the ge
-
Problems installing iTunes -- Windows XP
A few days ago I went to open my iTunes, however it got stuck/froze while trying to access the itunes store. Had numerous problems with this each time I opened iTunes--even after shutting off and/or restarting my computer. I ended up uninstalling all