How to start a shell script for a java app
Hi all,
I have a java application and have got a shell script to start it.
How can I start this app just from the finder?
Thanks
Confidemus
Fernardo,
the following links should help you:
- Technical Note TN2065
- Applescript and Unix commands
Mihalis.
Similar Messages
-
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 -
Shell script for executing java program
i want to write a shell script which will export the classpath and compile & run the java program.
any references from where i can get that?Try typing "man sh" at the command prompt.
Ultimately it'll end up looking a lot like this:
#!/bin/sh
CLASSPATH=/path/to/a.jar:/path/to/anther.jar
JAVA_HOME=/path/to/where/you/installed/java
$JAVA_HOME/bin/java your.classes.package.YourClass -
How do I set proxy settings for a Java app behind a corporate server?
I have the source code of a Download Manager program written in Java. It has to be run within my college network in which we use the "Corporate Client" server to access the internet. The HTTP proxy is 172.16.68.6 and Port number is 3128. How do I define these parameters in my java program so that it can download files from the internet?
The source code for the program is:
There are four classes:
1. DownloadManager.java
2. Download.java
3. DownloadTable.java
4. ProgressRenderer.java
/*__DownloadManager.java__*/
import java.awt.*;
import java.awt.event.*;
import java.net.*;
import java.util.*;
import javax.swing.*;
import javax.swing.event.*;
// The Download Manager.
public class DownloadManager extends JFrame
implements Observer {
// Add download text field.
private JTextField addTextField;
// Download table's data model.
private DownloadsTableModel tableModel;
// Table listing downloads.
private JTable table;
// These are the buttons for managing the selected download.
private JButton pauseButton, resumeButton;
private JButton cancelButton, clearButton;
// Currently selected download.
private Download selectedDownload;
// Flag for whether or not table selection is being cleared.
private boolean clearing;
// Constructor for Download Manager.
public DownloadManager() {
// Set application title.
setTitle("Download Manager");
// Set window size.
setSize(640, 480);
// Handle window closing events.
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
actionExit();
// Set up file menu.
JMenuBar menuBar = new JMenuBar();
JMenu fileMenu = new JMenu("File");
fileMenu.setMnemonic(KeyEvent.VK_F);
JMenuItem fileExitMenuItem = new JMenuItem("Exit",
KeyEvent.VK_X);
fileExitMenuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
actionExit();
fileMenu.add(fileExitMenuItem);
menuBar.add(fileMenu);
setJMenuBar(menuBar);
// Set up add panel.
JPanel addPanel = new JPanel();
addTextField = new JTextField(30);
addPanel.add(addTextField);
JButton addButton = new JButton("Add Download");
addButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
actionAdd();
addPanel.add(addButton);
// Set up Downloads table.
tableModel = new DownloadsTableModel();
table = new JTable(tableModel);
table.getSelectionModel().addListSelectionListener(new
ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
tableSelectionChanged();
// Allow only one row at a time to be selected.
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
// Set up ProgressBar as renderer for progress column.
ProgressRenderer renderer = new ProgressRenderer(0, 100);
renderer.setStringPainted(true); // show progress text
table.setDefaultRenderer(JProgressBar.class, renderer);
// Set table's row height large enough to fit JProgressBar.
table.setRowHeight(
(int) renderer.getPreferredSize().getHeight());
// Set up downloads panel.
JPanel downloadsPanel = new JPanel();
downloadsPanel.setBorder(
BorderFactory.createTitledBorder("Downloads"));
downloadsPanel.setLayout(new BorderLayout());
downloadsPanel.add(new JScrollPane(table),
BorderLayout.CENTER);
// Set up buttons panel.
JPanel buttonsPanel = new JPanel();
pauseButton = new JButton("Pause");
pauseButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
actionPause();
pauseButton.setEnabled(false);
buttonsPanel.add(pauseButton);
resumeButton = new JButton("Resume");
resumeButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
actionResume();
resumeButton.setEnabled(false);
buttonsPanel.add(resumeButton);
cancelButton = new JButton("Cancel");
cancelButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
actionCancel();
cancelButton.setEnabled(false);
buttonsPanel.add(cancelButton);
clearButton = new JButton("Clear");
clearButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
actionClear();
clearButton.setEnabled(false);
buttonsPanel.add(clearButton);
// Add panels to display.
getContentPane().setLayout(new BorderLayout());
getContentPane().add(addPanel, BorderLayout.NORTH);
getContentPane().add(downloadsPanel, BorderLayout.CENTER);
getContentPane().add(buttonsPanel, BorderLayout.SOUTH);
// Exit this program.
private void actionExit() {
System.exit(0);
// Add a new download.
private void actionAdd() {
URL verifiedUrl = verifyUrl(addTextField.getText());
if (verifiedUrl != null) {
tableModel.addDownload(new Download(verifiedUrl));
addTextField.setText(""); // reset add text field
} else {
JOptionPane.showMessageDialog(this,
"Invalid Download URL", "Error",
JOptionPane.ERROR_MESSAGE);
// Verify download URL.
private URL verifyUrl(String url) {
// Only allow HTTP URLs.
if (!url.toLowerCase().startsWith("http://"))
return null;
// Verify format of URL.
URL verifiedUrl = null;
try {
verifiedUrl = new URL(url);
} catch (Exception e) {
return null;
// Make sure URL specifies a file.
if (verifiedUrl.getFile().length() < 2)
return null;
return verifiedUrl;
// Called when table row selection changes.
private void tableSelectionChanged() {
/* Unregister from receiving notifications
from the last selected download. */
if (selectedDownload != null)
selectedDownload.deleteObserver(DownloadManager.this);
/* If not in the middle of clearing a download,
set the selected download and register to
receive notifications from it. */
if (!clearing) {
selectedDownload =
tableModel.getDownload(table.getSelectedRow());
selectedDownload.addObserver(DownloadManager.this);
updateButtons();
// Pause the selected download.
private void actionPause() {
selectedDownload.pause();
updateButtons();
// Resume the selected download.
private void actionResume() {
selectedDownload.resume();
updateButtons();
// Cancel the selected download.
private void actionCancel() {
selectedDownload.cancel();
updateButtons();
// Clear the selected download.
private void actionClear() {
clearing = true;
tableModel.clearDownload(table.getSelectedRow());
clearing = false;
selectedDownload = null;
updateButtons();
/* Update each button's state based off of the
currently selected download's status. */
private void updateButtons() {
if (selectedDownload != null) {
int status = selectedDownload.getStatus();
switch (status) {
case Download.DOWNLOADING:
pauseButton.setEnabled(true);
resumeButton.setEnabled(false);
cancelButton.setEnabled(true);
clearButton.setEnabled(false);
break;
case Download.PAUSED:
pauseButton.setEnabled(false);
resumeButton.setEnabled(true);
cancelButton.setEnabled(true);
clearButton.setEnabled(false);
break;
case Download.ERROR:
pauseButton.setEnabled(false);
resumeButton.setEnabled(true);
cancelButton.setEnabled(false);
clearButton.setEnabled(true);
break;
default: // COMPLETE or CANCELLED
pauseButton.setEnabled(false);
resumeButton.setEnabled(false);
cancelButton.setEnabled(false);
clearButton.setEnabled(true);
} else {
// No download is selected in table.
pauseButton.setEnabled(false);
resumeButton.setEnabled(false);
cancelButton.setEnabled(false);
clearButton.setEnabled(false);
/* Update is called when a Download notifies its
observers of any changes. */
public void update(Observable o, Object arg) {
// Update buttons if the selected download has changed.
if (selectedDownload != null && selectedDownload.equals(o))
updateButtons();
// Run the Download Manager.
public static void main(String[] args) {
DownloadManager manager = new DownloadManager();
manager.show();
This example shows how to create a simple download manager in Java. It contains four classes in foru Java source files:
Download.java: Contains Download class which downloads a file from a URL.
DownloadManager.java: Contains the main class for download manager application.
DownloadsTableModel.java: Contains the class which manages the download table's data.
ProgressRenderer.java: Contains the class which is responsible to render a JProgressBar in a table cell.
The contents of the listed files are written below.
/*__Download.java__*/
import java.io.*;
import java.net.*;
import java.util.*;
// This class downloads a file from a URL.
class Download extends Observable implements Runnable {
// Max size of download buffer.
private static final int MAX_BUFFER_SIZE = 1024;
// These are the status names.
public static final String STATUSES[] = {"Downloading",
"Paused", "Complete", "Cancelled", "Error"};
// These are the status codes.
public static final int DOWNLOADING = 0;
public static final int PAUSED = 1;
public static final int COMPLETE = 2;
public static final int CANCELLED = 3;
public static final int ERROR = 4;
private URL url; // download URL
private int size; // size of download in bytes
private int downloaded; // number of bytes downloaded
private int status; // current status of download
// Constructor for Download.
public Download(URL url) {
this.url = url;
size = -1;
downloaded = 0;
status = DOWNLOADING;
// Begin the download.
download();
// Get this download's URL.
public String getUrl() {
return url.toString();
// Get this download's size.
public int getSize() {
return size;
// Get this download's progress.
public float getProgress() {
return ((float) downloaded / size) * 100;
// Get this download's status.
public int getStatus() {
return status;
// Pause this download.
public void pause() {
status = PAUSED;
stateChanged();
// Resume this download.
public void resume() {
status = DOWNLOADING;
stateChanged();
download();
// Cancel this download.
public void cancel() {
status = CANCELLED;
stateChanged();
// Mark this download as having an error.
private void error() {
status = ERROR;
stateChanged();
// Start or resume downloading.
private void download() {
Thread thread = new Thread(this);
thread.start();
// Get file name portion of URL.
private String getFileName(URL url) {
String fileName = url.getFile();
return fileName.substring(fileName.lastIndexOf('/') + 1);
// Download file.
public void run() {
RandomAccessFile file = null;
InputStream stream = null;
try {
// Open connection to URL.
HttpURLConnection connection =
(HttpURLConnection) url.openConnection();
// Specify what portion of file to download.
connection.setRequestProperty("Range",
"bytes=" + downloaded + "-");
// Connect to server.
connection.connect();
// Make sure response code is in the 200 range.
if (connection.getResponseCode() / 100 != 2) {
error();
// Check for valid content length.
int contentLength = connection.getContentLength();
if (contentLength < 1) {
error();
/* Set the size for this download if it
hasn't been already set. */
if (size == -1) {
size = contentLength;
stateChanged();
// Open file and seek to the end of it.
file = new RandomAccessFile(getFileName(url), "rw");
file.seek(downloaded);
stream = connection.getInputStream();
while (status == DOWNLOADING) {
/* Size buffer according to how much of the
file is left to download. */
byte buffer[];
if (size - downloaded > MAX_BUFFER_SIZE) {
buffer = new byte[MAX_BUFFER_SIZE];
} else {
buffer = new byte[size - downloaded];
// Read from server into buffer.
int read = stream.read(buffer);
if (read == -1)
break;
// Write buffer to file.
file.write(buffer, 0, read);
downloaded += read;
stateChanged();
/* Change status to complete if this point was
reached because downloading has finished. */
if (status == DOWNLOADING) {
status = COMPLETE;
stateChanged();
} catch (Exception e) {
error();
} finally {
// Close file.
if (file != null) {
try {
file.close();
} catch (Exception e) {}
// Close connection to server.
if (stream != null) {
try {
stream.close();
} catch (Exception e) {}
// Notify observers that this download's status has changed.
private void stateChanged() {
setChanged();
notifyObservers();
/*__DownloadTableModel.java__*/
import java.util.*;
import javax.swing.*;
import javax.swing.table.*;
// This class manages the download table's data.
class DownloadsTableModel extends AbstractTableModel
implements Observer {
// These are the names for the table's columns.
private static final String[] columnNames = {"URL", "Size",
"Progress", "Status"};
// These are the classes for each column's values.
private static final Class[] columnClasses = {String.class,
String.class, JProgressBar.class, String.class};
// The table's list of downloads.
private ArrayList downloadList = new ArrayList();
// Add a new download to the table.
public void addDownload(Download download) {
// Register to be notified when the download changes.
download.addObserver(this);
downloadList.add(download);
// Fire table row insertion notification to table.
fireTableRowsInserted(getRowCount() - 1, getRowCount() - 1);
// Get a download for the specified row.
public Download getDownload(int row) {
return (Download) downloadList.get(row);
// Remove a download from the list.
public void clearDownload(int row) {
downloadList.remove(row);
// Fire table row deletion notification to table.
fireTableRowsDeleted(row, row);
// Get table's column count.
public int getColumnCount() {
return columnNames.length;
// Get a column's name.
public String getColumnName(int col) {
return columnNames[col];
// Get a column's class.
public Class getColumnClass(int col) {
return columnClasses[col];
// Get table's row count.
public int getRowCount() {
return downloadList.size();
// Get value for a specific row and column combination.
public Object getValueAt(int row, int col) {
Download download = (Download) downloadList.get(row);
switch (col) {
case 0: // URL
return download.getUrl();
case 1: // Size
int size = download.getSize();
return (size == -1) ? "" : Integer.toString(size);
case 2: // Progress
return new Float(download.getProgress());
case 3: // Status
return Download.STATUSES[download.getStatus()];
return "";
/* Update is called when a Download notifies its
observers of any changes */
public void update(Observable o, Object arg) {
int index = downloadList.indexOf(o);
// Fire table row update notification to table.
fireTableRowsUpdated(index, index);
/*__ProgressRenderer.java__*/
import java.awt.*;
import javax.swing.*;
import javax.swing.table.*;
// This class renders a JProgressBar in a table cell.
class ProgressRenderer extends JProgressBar
implements TableCellRenderer {
// Constructor for ProgressRenderer.
public ProgressRenderer(int min, int max) {
super(min, max);
/* Returns this JProgressBar as the renderer
for the given table cell. */
public Component getTableCellRendererComponent(
JTable table, Object value, boolean isSelected,
boolean hasFocus, int row, int column) {
// Set JProgressBar's percent complete value.
setValue((int) ((Float) value).floatValue());
return this;
}Thank you for the quick reply! But the solution provided by you, it seems, has still not been able to address my issue. I ran the program at command prompt with your said parameters, but the download still gave an error in the App window.
Also, is there some way of defining these parameters in the source code? I am keen in using NetBeans to run the program.
Cheers! -
Running UNIX shell scripts from a Java app
I want to build a GUI in Java as a front-end to a collection of UNIX shell scripts I have written. Is this possible?
It is possible, but it kinda defeats the purpose of shell scripts no?
-
Shell script for below pl/sql script dbms_file_transfer
Please let me know how tt write the shell script for below pl/sql script dbms_file_transfer it is
I have trasfer the files from asm into filesystem .
it is working . but i have to put in the loop
begin
dbms_file_transfer.copy_file(
source_directory_object => 'src',
source_file_name => 'ncsn',
destination_directory_object => 'dest',
destination_file_name => 'ncsn');
end;
Edited by: user8680248 on 27/10/2009 20:55user8680248 wrote:
Please let me know how tt write the shell script for below pl/sql script dbms_file_transfer it is
I have trasfer the files from asm into filesystem .
it is working . but i have to put in the loop
begin
dbms_file_transfer.copy_file(
source_directory_object => 'src',
source_file_name => 'ncsn',
destination_directory_object => 'dest',
destination_file_name => 'ncsn');
end;What database version?
What are you trying to do exactly?
It's working but you have to put it in a loop. Fine, what's the problem you are having?
begin
loop
exit when ... whatever the exit condition is ...
dbms_file_transfer.copy_file(
source_directory_object => 'src',
source_file_name => 'ncsn',
destination_directory_object => 'dest',
destination_file_name => 'ncsn');
end loop;
end; -
Windows Shell script for Javadoc
Hello
How to write the Shell script for javadoc...in this case we were
java 1.4
please Respond me with one example...Depends on the OS and what you want it to do.
Here are several Windows examples:
http://java.sun.com/j2se/1.4/docs/tooldocs/windows/javadoc.html#examples
-Doug Kramer
Javadoc team -
HI,
i have written some java code Database backup but there are some problems with that so now i need to write shell script for db backup.
what i was doing in java code i was running command like that
/usr/local/bin/tar cvzf /export/home/monitor/FILE_20091005.tar.gz FILES/*20091005.*which compress the all *20091005* files (myisam table files)
but after compression file doesn't extract
so i have to write shell script for that ..... can any body guide me how can i write that kind of script and put it in cron job.
thankssoundar wrote:
Hi all,
I have migrated database from 8i to 10gr2.For Backup in 8i, we used a RMAN shell script (scheduled uding cron tab) to backup the database to Tape.(VERITAS BACKUP).
I am new to 10G.I checked out the options to backup the database using Oracle Enterprise manager DB console.
http://www.oracle.com/technology/obe/10gr2_db_single/ha/rman/rman_otn.htm#t1d
I am planning to take a test backup using the steps mentioned inthe above url.Could any one suggest whcih is the best option for database backup,eiether to use Oracle Enterprise manager DB console or thru RMAN shell script for backup..?
Edited by: soundar on Mar 9, 2010 10:53 PMDear soudar
I woudn't suggest you to work with EM if you want to be a professional DBA. Start learning RMAN and use CLI instead of GUI
Those who live by the GUI, die by the GUI -
How to do multiple shell scripts in AppleScript
I got some solutions from previous posts on how to run sudo in Applescript, but there is still some minor syntax issues when I try to get to the destination directory. Usually in shell script I just type
cd directory-destination
in several lines to batch process those commands, but when I work with applescript, if I do do shell script for every "cd" command, instead of getting an overall result, I would get intermediate results individually.
I read doc and learned that there might be a way to put commands together by using the & sign?
Message was edited by: ttbackAn individual do shell script command runs in its own shell, so to perform multiple commands within that shell you need to combine them into a single statement. You can use the ampersand '&' operator to concatenate text strings, and the semicolon ';' to separate the commands, for example:set theFolder to "/Applications"
do shell script "cd " & theFolder & "; ls -l ."See the technical note do shell script in AppleScript. -
How to call a shell script via ODI
Hi,
I need suggestion on following issues:
1) How to call a shell script via ODI?.. I tried using OSCommand utility .inspite of the execution being successful the data is not written into the new file in the desired format. After processing new file is created in the mentioned location but its empty.
2) I'm calling a procedure in ODI to load data into my fact. But once the fact gets loaded i want to update the log details (num of rows processed,num of rows inserted,num of rows rejected etc) in my log table. I'm planning to use a proc for updating but need to know from where can i find these details. Is there a table in work rep which gives me these info like how we get if we execute an interface.?
Please help me out.. Its urgent
Regards
SurabhiHello,
Question 1 appears a little vague, please elaborate. If you're looking to capture a return value from the command execution, you will need to pipe the return value to a file, then read from there.
The execution information is stored in the SNP_STEP_LOG table in the Work Repository. You will need to do a series of joins to retrieve the exact table that was updated. Good luck with this... -
Shell script for export backup in oracle 11g
Hi,
Oracle version 11.2.0..
O/S-AIX
How to write shell script for export full backup in oracle 11g and also need to remove 2 days of old backup.
Regards,
RajuHow to write shell script for export full backup in oracle 11g
Do you mean that export is your backup strategy ? is your database running in noarchivelog mode ? if so, then why ? if not so, then why not RMAN ?
need to remove 2 days of old backup.
If that mean remove files older than 2 days, you can use something like this :
$ find <absolute directory path> -mtime +2 -exec rm {} \; -
Hi,
I have written shell script for below scenarios, can you please guide me to write this as correct way, requirment is,
1. i need to connect the database which is on unix server , but before connecting the DB some of the files needs to be removed from \tmp directory.
2. once removed the script need to connect the database and call the sql file which is in \tmp directory.
3. the output files will be stored in \tmp directory start with DB name.
4. finally csv files needs to be transferred to local windows with help of FTP. please find below the script
#!/bin/sh
rm -f /tmp/dbmon/DB1*
CONNSTRING=username/PASSWORD@service
sqlplus -s $CONNSTRING @/tmp/STATS.sql << EOF
EXIT;
EOF
HOST='xxxxx'
USER='xxxxx'
PASSWD='xxxxxx'
FILE='E:\STATS\DB1.*'
cd /tmp/dbmon
ftp -n -v $HOST << EOT
user $USER $PASSWD
prompt
mput $FILE
bye
EOT
EXIT;
EOF
Thanks
Edited by: ASP on Nov 18, 2011 4:45 PMHi ASP
It's always a good idea to write entries to timestamped log file without which you will never know where the script went wrong or failed.
This is not tested but just a small example
#!/bin/sh
export LOG_DIR=/tmp/log
export LOGFILE=$LOG_DIR/`basename $0`_${TIMESTAMP}.log
if [ ! -d $LOG_DIR ]
then
mkdir $LOG_DIR
fi
echo "Removing the temporary files from /tmp/dbmon at `date +%Y%m%d_%H:%M:%S`" | tee -a $LOG_FILE
rm -f /tmp/dbmon/DB1*
CONNSTRING=username/PASSWORD@service
echo "Run SQLPlus file" | tee -a $LOG_FILE
sqlplus -s $CONNSTRING @/tmp/STATS.sql << EOF
EXIT;
EOF
echo "Now FTP the files to windows box " | tee -a $LOG_FILE
HOST='xxxxx'
USER='xxxxx'
PASSWD='xxxxxx'
cd /tmp/dbmon
ftp -vn $HOST <<EOF
quote USER $USER
quote PASS $PASSWD
ascii
cd E:\STATS
mput DB1.*
bye
EOF -
Shell Script for Startup and Shutdown the database
Hi,
i want Shell Script for Startup and Shutdown the database in Solaries.
could any one can hep me where i can get this script. or send to me to [email protected]
Thanks & Regards,
Gangi reddySHUTDOWN
SHUTDOWN ABORT]
Shuts down a currently running Oracle instance, optionally closing and dismounting a database.
Terms
Refer to the following list for a description of each term or clause:
ABORT
Proceeds with the fastest possible shutdown of the database without waiting for calls to complete or users to disconnect.
Uncommitted transactions are not rolled back. Client SQL statements currently being processed are terminated. All users currently connected to the database are implicitly disconnected and the next database startup will require instance recovery.
You must use this option if a background process terminates abnormally.
IMMEDIATE
Does not wait for current calls to complete or users to disconnect from the database.
Further connects are prohibited. The database is closed and dismounted. The instance is shutdown and no instance recovery is required on the next database startup.
NORMAL
NORMAL is the default option which waits for users to disconnect from the database.
Further connects are prohibited. The database is closed and dismounted. The instance is shutdown and no instance recovery is required on the next database startup.
TRANSACTIONAL [LOCAL]
Performs a planned shutdown of an instance while allowing active transactions to complete first. It prevents clients from losing work without requiring all users to log off.
No client can start a new transaction on this instance. Attempting to start a new transaction results in disconnection. After completion of all transactions, any client still connected to the instance is disconnected. Now the instance shuts down just as it would if a SHUTDOWN IMMEDIATE statement was submitted. The next startup of the database will not require any instance recovery procedures.
The LOCAL mode specifies a transactional shutdown on the local instance only, so that it only waits on local transactions to complete, not all transactions. This is useful, for example, for scheduled outage maintenance.
Usage
SHUTDOWN with no arguments is equivalent to SHUTDOWN NORMAL.
You must be connected to a database as SYSOPER, or SYSDBA. You cannot connect via a multi-threaded server. For more information about connecting to a database, see the CONNECT command earlier in this chapter.
http://download-west.oracle.com/docs/cd/B10501_01/server.920/a90842/ch13.htm#1013607
Joel Pérez -
How to execute unix shell script from Java ...
Hi,
Anyone know how to execute unix shell script from Java?
Suppose I have several shell scripts written in perl or tcl or bash.
I just want to catch the output of that script.
Is there any ready to use module/object for this?
Please let me know, this is quite urgent for my study assigment.
Thanks in advance,
Regards,
meLook up Runtime.exec()
-
How to execute unix shell script in webdynpro?
hi all,
We have some iquirement of executing script in unix.If anyone know How to execute unix shell script in webdynpro?
best regard
reefishRee,
1. Find SSH client for windows, then execute SSH with Runtime.exec() on local host with arguments like remote host, auth, command to execute etc.
2. Get SSH client in Java and execute SSH commands on remote host using pure Java API.
Don't ask me for links, Google works today, I checked this
Valery Silaev
SaM Solutions
http://www.sam-solutions.net
Maybe you are looking for
-
How to get timestamp in OEG filter ?
Hi, may I have another question(sorry for pretty much of questions): In OEG, how could I get a timestamp(can OEG generate timestamp?) within OEG and assign its value into my SOAP message. Thank.... Cliff
-
Diff between BSP and WEBDYNPRO FOR ABAP?
Hi All, can anyone let me know the Difference between BSP's and WEBDYNPRO FOR ABAP. Regards, Ravi
-
Cannot recover ERASED ipod files
1) i accidently erased my entire harddrive (by going to itunes and clicking something, like sync/erase all) 2) i tried to recover my ipod through a program called "recover my ipod" and successfully got all the files i needed but once i recovered them
-
Dear All, I am installing Linux Rhel 64 bit and and stuck on 27th step " START INSTANCE " details mention below. O S = Linux Rhel 5.4 ( 64 BIT ) Database = 10 G Log Attach of JAVA INSTANCE WORK LOG ================ >>> main =
-
I am unable to install the newer version of itunes. I have no problem downloading but when it starts to install I get an error message that the installer has insufficient privileges to access this directory C:\ProgramData\Microsoft\Windows\StartMenu