JSP Shell Script Output (All At Once Vs Line By Line)
I have no problem calling a shell script and then displaying that output on a web page.
However, I would like to display the output as the script executes (I want to print the output line by line as it happens), rather than waiting for the script to completely finish and then display the whole output all at once. The script checks a large database and takes about 10 minutes to run. I don't want to stare at a blank screen during that time, but of course want to watch it's progress on the display (when I run the script directly I print out status to the screen).
Can someone point me in the right direction on how to do this?
-jsaspo
Bump...
Anyone?
Similar Messages
-
In Automator, how can I pass a shell script output to Display Notification?
In Automator, how can I pass a Run shell script output to Display Notification?
Soemthing like this will work
-
Shell Scripts: "Open [ALL] With" Emacs
Hi All,
I'm trying to figure out a way to open ALL shell scripts (for which I use the extension ".sh") with emacs (launched in the terminal) by default.
I've made some progress towards this goal, but am stuck on the last step. Here's what I've done:
[1] I copied an Apple Script (from here: http://hints.macworld.com/article.php?story=20031027142625782) to create an Application (which I've called "Emacs_open_with.app"), that when launched with a file, will open it in emacs in the terminal.
[2] I can make Emacs_open_with.app the default launch app for a individual shell script by right-clicking -> Open With -> Other... -> Emacs_open_with.app (+ check the box "Always Open With). However, doing this will only make it the default app for that single shell script, not for all of them, as I desire.
[3] Normally, one can associate an application with a file extension, such that any file with that extension will be launched by default by this associated application, by: Right-clicking a file -> Get Info -> Open With -> Other... -> [DESIRED APP] (+ check the box "Always Open With) -> Change All... -> Click Continue when the pop-up appears which asks "Are you sure you want to change all similar documents to open with the application...". However, this does NOT work for Emacs_open_with.app; as soon as I click continue, the drop-down menu which I had used to select "Emacs_open_with.app" changes back to another, different Application.
Any idea about how best to tackle this problem? Thanks for your help!Ilmari Aalto wrote:
Hi Darth,
Thanks for your hint! Nevertheless I think it's something more profound, since there's no error etc. For example, should I have the path wrong I assume that OWB would return me some kind of an error when it doesn't find the .sh-file? Isn't there any log-file to see whether the command was executed? It seems like the execution of the User Defined element would be skipped altogether.
Cheers,
IlmariNo, if you don't give an absolute path OWB will not return any error, it just wont do anything at all... -
Color shell/script output in bash/zsh
So, I wanted to have an easy way to color my script output. In zsh there is a color module, but as far as I know it does only bold for special effects. Also there are some scripts around that let you call a predefined array, but there aren't any where you can combine options easily, like both bold and italic. ansi-color comes close, but it has almost 250 lines of code and I thought it could be done more efficiently. So here's color, both in a zsh and a bash variant (the shebang and the way of defining an array being the only difference).
Save as "color" in your path, or wrap it in a function to store in either .bashrc or .zshrc. color --help for instructions. Let me know what you think, if it has bugs or if the coding can be more efficient or better (I did this mostly as a programming exercise, it's not *that* useful.
ZSH color
#!/bin/zsh
color-usage() {
cat <<"USAGE"
Usage: color [OPTIONS] <color>
-b|--bold for bold text
-i|--italic for italic text
-u|--underline for underlined text
-f|--flash for blinking text, not possible together with --bg
-r|--reverse to switch fg and bg colors
-/--bg <color> for background color
-d|--dark for fainted / less intense colors (your terminal may not support this)
-x|--invisible for invisible text (your terminal may not support this)
-ff|--fastflash for fast blinking text (your terminal may not support this), not possible together with --bg
Color can be: black, red, green, yellow, blue, magenta, cyan, white and lightblack, lightred etc.
Use "color" without specifying the color to reset to default.
Notes:
1. You can not use blink in combination with --bg, but you can do -r instead and define <color> as desired bg-color. Example: color -f -r blue lets black text blink on blue background. This means you have the bg color as text color, which can't be changed."
2. Append $(color) behind the string you have formatted, or the color sequence may stay in effect, especially in bash.
3. You can combine options like -b -i -f, but be sensible; -x -f is not sensible; neither is -d lightred.
Examples:
echo "This is $(color -f -i lightred)blinking italic lightred text$(color)"
echo "This is $(color -bg blue white)white text on blue bg$(color)"
echo "This shows words in $(color green)green $(color magenta)magenta $(color)and the rest normal"
echo "This shows $(color -f -r cyan)bold blinking text on cyan background$(color)"
USAGE
# Define and create array "colors"
typeset -Ag colors
colors=( black "0" red "1" green "2" yellow "3" blue "4" magenta "5" cyan "6" white "7" )
# Loop to read options and arguments
while [ $1 ]; do
case "$1" in
'-h'|'--help') color-usage;;
'-b'|'--bold') mode="${mode}1;";;
'-d'|'--dark') mode="${mode}2;";;
'-i'|'--italic') mode="${mode}3;";;
'-u'|'--underline') mode="${mode}4;";;
'-f'|'--flash') mode="${mode}5;";;
'-ff'|'--fastflash') mode="${mode}6;";;
'-r'|'--reverse') mode="${mode}7;";;
'-x'|'--invisible') mode="8;";;
'-bg'|'--bg') case "$2" in
light*) bgc=";10${colors[${2#light}]}"; shift;;
black|red|green|yellow|blue|magenta|cyan|white) bgc=";4${colors[$2]}"; shift;;
esac;;
'reset') reset=true;;
*) case "$1" in
light*) fgc=";9${colors[${1#light}]}";;
black|red|green|yellow|blue|magenta|cyan|white) fgc=";3${colors[$1]}";;
*) echo The color loop is buggy or you used it wrong;;
esac;;
esac
shift
done
# Set color sequence
mode="${mode%;}" # strip ";" from mode string if it ends with that
echo -e "\e[${mode:-0}${fgc}${bgc}m" # (default value for mode = 0, so if nothing was set, go default; -e to please bash)
unset mode intensity bgc fgc # clean up
BASH color
#!/bin/bash
color-usage() {
cat <<"USAGE"
Usage: color [OPTIONS] <color>
-b|--bold for bold text
-i|--italic for italic text
-u|--underline for underlined text
-f|--flash for blinking text, not possible together with --bg
-r|--reverse to switch fg and bg colors
-/--bg <color> for background color
-d|--dark for fainted / less intense colors (your terminal may not support this)
-x|--invisible for invisible text (your terminal may not support this)
-ff|--fastflash for fast blinking text (your terminal may not support this), not possible together with --bg
Color can be: black, red, green, yellow, blue, magenta, cyan, white and lightblack, lightred etc.
Use "color" without specifying the color to reset to default.
Notes:
1. You can not use blink in combination with --bg, but you can do -r instead and define <color> as desired bg-color. Example: color -f -r blue lets black text blink on blue background. This means you have the bg color as text color, which can't be changed."
2. Append $(color) behind the string you have formatted, or the color sequence may stay in effect, especially in bash.
3. You can combine options like -b -i -f, but be sensible; -x -f is not sensible; neither is -d lightred.
Examples:
echo "This is $(color -f -i lightred)blinking italic lightred text$(color)"
echo "This is $(color -bg blue white)white text on blue bg$(color)"
echo "This shows words in $(color green)green $(color magenta)magenta $(color)and the rest normal"
echo "This shows $(color -f -r cyan)bold blinking text on cyan background$(color)"
USAGE
# Define and create array "colors"
declare -A colors
colors=( [black]="0" [red]="1" [green]="2" [yellow]="3" [blue]="4" [magenta]="5" [cyan]="6" [white]="7" )
# Loop to read options and arguments
while [ $1 ]; do
case "$1" in
'-h'|'--help') color-usage;;
'-b'|'--bold') mode="${mode}1;";;
'-d'|'--dark') mode="${mode}2;";;
'-i'|'--italic') mode="${mode}3;";;
'-u'|'--underline') mode="${mode}4;";;
'-f'|'--flash') mode="${mode}5;";;
'-ff'|'--fastflash') mode="${mode}6;";;
'-r'|'--reverse') mode="${mode}7;";;
'-x'|'--invisible') mode="8;";;
'-bg'|'--bg') case "$2" in
light*) bgc=";10${colors[${2#light}]}"; shift;;
black|red|green|yellow|blue|magenta|cyan|white) bgc=";4${colors[$2]}"; shift;;
esac;;
'reset') reset=true;;
*) case "$1" in
light*) fgc=";9${colors[${1#light}]}";;
black|red|green|yellow|blue|magenta|cyan|white) fgc=";3${colors[$1]}";;
*) echo The color loop is buggy or you used it wrong;;
esac;;
esac
shift
done
# Set color sequence
mode="${mode%;}" # strip ";" from mode string if it ends with that
echo -e "\e[${mode:-0}${fgc}${bgc}m" # (default value for mode = 0, so if nothing was set, go default; -e to please bash)
unset mode intensity bgc fgc # clean upSoemthing like this will work
-
Need a sample file for IDQ parameter file and a Shell script to execute it from command line
Hello,The parameter file itself is generated from cmd line using infacmd command and it automatically creates the parameters inside it based on the parameters created inside the mapping and the workflow. So, even if one provides you a paramtere file for IDQ, it might fail as your workflow definition and its paramters would be different. Thanks,K
Hi all My project migrated from Power Center to IDQ developer and I had to move all my mappings to IDQ developer. I was able to migrate everything except for the parameter files. It seems that the layout and syntax for parameter file is different from Power Center. Is there anyone who can help me out or send me a sample of a parameter file for IDQ? As well as a sample shell script to run the mapping or application from the Command line.This is an urgent need and It will be greatly appreciated. ThanksNaveen Medisetti
-
XML output - all tags in Single line?
Hi,
Scenario: HTTP----> XI --- > File(XML)/Proxy(abap).
Output XML file has the data in single line(all XML tags).
Now, issue with abap proxy which reads this XML file for sending attachment in email has length constraint(can not read if line length exceeds 255 chars).
Is there any option in XI, to print each pair of tags in each line(using carriage return or line feed?)
Please help.Mallik,
I do not think that this can be achieved in XML to XML (unless you can create a specific module and add to the module tab)
But if you create say a CSV or TXT file and use the <b>Content Conversion Parameters</b> option
Here you can specify the fieldSeparator to be 'nl'
<b>Input</b>
<?xml version="1.0" encoding="UTF-8"?>
<record>
<field1>f1</field1>
<field2>f2</field2>
<field3>f3</field3>
</record>
<b>Output</b>
f1
f2
f3
Here you have retained your data and each field is separated by a new line. Unfortunatley with this method you lose your XML tags
Regards,
Mike -
Rwcgi60 on UNIX needs shell script ?
I am trying out Reports 6i on a Linux box.
Using Apache Webserver, I have mapped all the virtual directories with execute permission.
When I call rwcgi60 through the browser, I get the following output
<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<BODY>
<CENTER><H1>
</CENTER></H1>
<BR></BODY>
</HTML>
But when i call a shell script (which in turn calls rwcgi60) through the browser, i get some output.
The shell script exports all the environment specific to Oracle Reports and calls rwcgi60.
Is the CGI intended to be called from a script file ? If no, what other configuration is necessary ?
Thanks.I am having exactly the same problem on Solaris. The information I have shoehorned out of support so far is that you do need a shell script to make this work. I have followed these instructions but am still having problems. The document which details this bug is unpublished by Oracle so I only got extracts. Detailed below.....if you do have success with this please let me know as I am tearing my hair out.
REPORTS60_SERVER
1. The REPORTS60_SERVER file is located in your Oracle_Home and is used to
start the Report Server.
2. You may need to modify this file for variables such as DISPLAY, TNS_ADMIN
and the REPORTS60_PATH to fit your environment. @Also, please refer to
@Note: 111548.1 for setting up the TNSNAMES.ORA file.
3. If you are not using a WebDB Listener, you can delete the section which
stops and starts it. However, make sure you have started up your Webserver
Listener.
4. Once this file has been modified, the command to execute it is:
reports60_server start
Shell Script (RUNREP.SH)
1. You will need to create a shell script to run RWCGI60. This shell will then
be called from RUNREP.HTM file. You can name it anything (the example is
called runrep.sh) and needs to include the following:
#!/bin/sh (or which ever shell you want to use)
- ORACLE_HOME="/u03/app/oracle/product/dev6i"; export ORACLE_HOME
- TNS_ADMIN="/u03/app/oracle/product/dev6i/network/admin"; export
TNS_ADMIN
- exec /u03/app/oracle/product/dev6i/tools/web60/cgi/rwcgi60
2. You will need to redefine the ORACLE_HOME and TNS_ADMIN due to BUG:1201156.
3. This script can be located anywhere as far as the Webserver
Listener is
concerned. However, the best place would be in the ORACLE_HOME/tools/web60/
cgi directory for which we already have a virtual name defined in the
listener configuration file.
RUNREP.HTM
1. The RUNREP.HTM file is located in the ORACLE_HOME/tools/web60/html
directory.
2. You will need to modify this file due to the above mentioned Bug.
Go to the function called runReport( ) and for the var cgiexe = "rwcgi60",
replace it with the above shell script.
Example: var cgiexe = "runrep.sh"
3. Next, modify the port number for the Webserver. This file assumes that you
will be using the WebDB listener and is installed on port 8080 (by default).
You will need to find the following and change it to the correct port
number:
<td><input TYPE="TEXT" NAME="WEBPORT" SIZE="4" VALUE="8080"></td>
Change the Port Number to the one your WebServer Listener is on, such as:
7777.
After doing all of the above, you are ready to run a report on the web using
CGI implementation. From the browser run the following URL:
http://your_machine_name:listener_port#/virtual_dir_for_cgi/runrep.htm
This brings up a Template for you to provide the report name. Also change the
parameter values here for the userid/password, port#, and reports_server. -
I have a file with passwd format.I made a script for this file that is working as I wanted it to work.I have a list of options and each time I give an option,the script is doing something(for example,if I press "b" it makes something and if I press "a" it makes something else).All the results are an output from the file.
My question is how can I create a GUI in java for this script.For example if I want the script to do what it would do if I pressed the "a" button on my keyboard,but not by pressing "a",but by choosing from a drop down list or some other graphical feature(by ticking a check box,clicking a button etc).Can I do this with java?
LazarosHi,
I understand you can create a Java Swing gui for a bash shell script which takes both complex input and writes output to the stdout & files, to be specific. Is that correct?
If yes, could you give a simple example. Say for the following shell script.
#!/bin/sh
printf "Enter input\n"
i=0
while [ $i -ne 1 ]; do
read $inputVar
if [ "$inputVar" == "y" ]; then
printf "You typed yes\n"
i=1
elif [ "$inputVar" == "y" ]; then
printf "you typed no\n"
i=1
else
printf "Enter a valid character\n"
i=0
fi
done
Could you also point to some URL's which might help? Googling for "Java Gui for shell script" returns this as the first page, others dont really help. Googling "GUI for shell script" returns all other gui toolkits for xes but thats not what I want. I want a cross platform (nixes, Win*, MacOS* ) gui for a shell script ( which I plan to run using cygwin etc).
TIA
Vinod -
How to write dbms_out traces into a file (in a shell script)?
I'm afraid this is a shell scripting question:
I have the following lines in a script:
ls $salida/EXAR* | while read FILE
do
sqlplus -s user@isntance/password << EOF
set serveroutput on size 1000000
set feedback off
--set trimspool on
var p_out_result_nv number
var p_out_DescError_SV varchar2(4000)
var p_out_Traza_SV varchar2(4000)
var p_Fich_Entrada varchar2(4000)
--spool $mi_fich_log
begin
:p_Fich_Entrada := replace(('$FILE'),('$salida/'),'');
dbms_output.put_line('Tratando archivo: '||:p_Fich_Entrada);
:p_out_result_nv := 0;
SJPAMIOB.SJPRPRIN('01',:p_Fich_Entrada,:p_Fich_Entrada,'EXSJ_ENTRADA','EXSJ_SALIDA',
:p_out_result_nv,:p_out_DescError_SV,:p_out_Traza_SV);
end;
--spool off
exit :p_out_result_nv
EOF
How can I write all dbms_output.put_line in a file?
Thanks in advance.you can use the package utl_file.
for this you either
- need a directory object in the database which points to the folder where your file is located you want to write to:
CREATE DIRECTORY lutz_dir AS ´/home/oracle/UTL_FILE_DIR´;
You will need create any directory privilege for this.
or
- you must have the init.ora parameter UTL_FILE_DIR set to the location.
Regards,
Lutz -
Can anyone here help me (getting my feet wet) with an addition to a profile (applmgr) that I am trying to make - in the form of a shell script.
I have the following lines in the profile file - but each time I log into the server as applmgr, I get the error following
if $HOSTNAME=hostname1
tnen
. /u01/xxees/EBST/apps/apps_st/appl/APPSEBST_$HOST.env
fi
if $HOSTNAME=hostname2
./u01/xxees/EBST2/apps/apps_st/appl/APPSEBST_$HOST.env
fi
The error message I am getting us
-bash: /local/ebsuser/applmgr/.profile: line 39: syntax error near unexpected token `fi'
-bash: /local/ebsuser/applmgr/.profile: line 39: `fi'
Thank you all.
Edited by: 864641 on Jun 13, 2012 1:49 PMFrom the Error Message at line Number 38, I feel that, the file /u01/xxees/EBSTEST/apps/apps_st/appl/APPSEBST_$HOST.env (where $HOST can be "hostname01" or "hostname02") has been modified and has unmatched if.
Also, If you are using the variable HOSTNAME, I feel that the env file should be like /u01/xxees/EBSTEST/apps/apps_st/appl/APPSEBST_$HOSTNAME.env in which case your script will be like:
if [$HOSTNAME == "hostname01"]; then
. /u01/xxees/EBSTEST/apps/apps_st/appl/APPSEBST_$HOSTNAME.env
fi
if [$HOSTNAME == "hostname02"]; then
. /u01/xxees/EBSTEST2/apps/apps_st/appl/APPSEBST_$HOSTNAME.env
fi
Hope that this two things will help in resolving the issue. -
Power Shell Script to Initiate Billing Determinants Calculations
Hi All,
I'm New to CC&B, i have a problem when i try to initiate the BD Calc thru Power shell script for "ALL" Accounts, at the same time i'm able to succeed for single account. Did any one faced this problem ?
Any advise?
btw, i use Win2008R2 server (x64) | MDM 1.6.1.2 | PShell v1.0
- Nandawbadmin start systemstatebackup -backupTarget:$backdir -[quiet]"[quiet]"? I guess you should remove the bracketswbadmin start systemstatebackup -backupTarget:$backdir -quiet
-
Hello All,
I have been using some well known Java Class and Procedures to execute shell scripts from PL-SQL.
The different environments I was using before were
1)
Operating System (Server) AIX version 5
Oerating System(Client) Microsoft Windows XP Service Pack 2
Oracle Database Version Oracle Database 10g Enterprise Edition Release
10.2.0.1.0
2)
Operating System (Server) Red Hat Linux 3.4.5-2
Oerating System(Client) Microsoft Windows XP Service Pack 2
Oracle Database Version Oracle Database 10g Enterprise Edition Release
10.2.0.1.0
But suddenly I had to drop and recreate the Databases on 1st (AIX) environment
and
reinstall the Operating System (Server) Red Hat 3.4.5-2 on IInd environment stated above (which obviously means the reinstallation of Oracle Database there!)
Now the shell script(through PL-SQL)is executing smoothly for the IInd (Linux) environment[b] but not executing for the Ist (AIX) environment
and I am not getting how to solve the problem.
I have given all the permissions to users, shell scripts and all as they were before.
Can you please help?
Regards,
Abhijit.Hello All,
I have been using some well known Java Class and Procedures to execute shell scripts from PL-SQL.
The different environments I was using before were
1)
Operating System (Server) AIX version 5
Oerating System(Client) Microsoft Windows XP Service Pack 2
Oracle Database Version Oracle Database 10g Enterprise Edition Release
10.2.0.1.0
2)
Operating System (Server) Red Hat Linux 3.4.5-2
Oerating System(Client) Microsoft Windows XP Service Pack 2
Oracle Database Version Oracle Database 10g Enterprise Edition Release
10.2.0.1.0
But suddenly I had to drop and recreate the Databases on 1st (AIX) environment
and
reinstall the Operating System (Server) Red Hat 3.4.5-2 on IInd environment stated above (which obviously means the reinstallation of Oracle Database there!)
Now the shell script(through PL-SQL)is executing smoothly for the IInd (Linux) environment[b] but not executing for the Ist (AIX) environment
and I am not getting how to solve the problem.
I have given all the permissions to users, shell scripts and all as they were before.
Can you please help?
Regards,
Abhijit. -
Trouble running automator shell script
This is probably going to be an really simple fix, but I'm have trouble building an automator service that runs a bash shell script. All of the elements of the script work fine when plugged into shell, but for some reason the automator service is failing to run. The script calls ffmpeg to convert an audio file:
for f in "$@"
do
fn="${f%%.*}"
/Users/aa/Applications/ffmpeg/ffmpeg -i "$f" -acodec libmp3lame -q:a 7 -ar 8000 -ac 1 "$fn.mp3"
done
The script runs fine without the ffmpeg command, and the ffmpeg command runs fine in the terminal on its own. Where's the error coming from?
Thanks!The first is what I'm getting from the bash terminal execution, the second from automator. I'm accenting the differences I see. Thanks for the help!
----bash----------------------------------------
drwxr-xr-x@ 67 aa staff - 2278 Apr 6 07:42 .
com.apple.progress.fractionCompleted 14
0: group:everyone deny delete
uid=501(aa) gid=20(staff) groups=20(staff),12(everyone),61(localaccounts),79(_appserverusr),80(admin),81( _appserveradm),98(_lpadmin),33(_appstore),100(_lpoperator),204(_developer),398(c om.apple.access_screensharing),399(com.apple.access_ssh)
0
-bash
TERM_PROGRAM=Apple_Terminal
SHELL=/bin/bash
TERM=xterm-256color
TMPDIR=/var/folders/x9/y4r_w7gj4_j_3wkfxn6s6fqm0000gn/T/
Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.oSzc5cau0v/Render
TERM_PROGRAM_VERSION=343.6
TERM_SESSION_ID=AF09D92C-2CB4-4069-A172-0DE12EB226BD
USER=aa
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.RFhFIs94Ad/Listeners
__CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0
PATH=/Applications/anaconda/bin:/Applications/anaconda/bin:/Applications/anacond a/bin:/Users/aa/anaconda/bin:/Applications/anaconda/bin:/Applications/anaconda/b in:/Applications/anaconda/bin:/Applications/anaconda/bin:/Library/Frameworks/Pyt hon.framework/Versions/3.4/bin:/Applications/anaconda/bin:/Users/aa/anaconda/bin :/Applications/Anaconda/anaconda/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbi n:/opt/X11/bin:/usr/local/git/bin:/usr/local/MacGPG2/bin:/usr/texbin
PWD=/Users/aa
LANG=en_US.UTF-8
XPC_FLAGS=0x0
XPC_SERVICE_NAME=0
SHLVL=1
HOME=/Users/aa
LOGNAME=aa
DISPLAY=/private/tmp/com.apple.launchd.YewceoE69R/org.macosforge.xquartz:0
_=/usr/bin/printenv
----automator----------------------------------------
/Users/aa
drwxr-xr-x@ 66 aa staff - 2244 Apr 6 07:42 .
com.apple.progress.fractionCompleted 14
0: group:everyone deny delete
uid=501(aa) gid=20(staff) groups=20(staff),12(everyone),61(localaccounts),79(_appserverusr),80(admin),81( _appserveradm),98(_lpadmin),33(_appstore),100(_lpoperator),204(_developer),398(c om.apple.access_screensharing),399(com.apple.access_ssh)
0
SHELL=/bin/bash
TMPDIR=/var/folders/x9/y4r_w7gj4_j_3wkfxn6s6fqm0000gn/T/
Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.oSzc5cau0v/Render
USER=aa
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.RFhFIs94Ad/Listeners
__CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0
PATH=/usr/bin:/bin:/usr/sbin:/sbin
PWD=/Users/aa
XPC_FLAGS=0x0
XPC_SERVICE_NAME=0
SHLVL=1
HOME=/Users/aa
LOGNAME=aa
DISPLAY=/private/tmp/com.apple.launchd.YewceoE69R/org.macosforge.xquartz:0
_=/usr/bin/printenv -
Can't run shell script to save my life
Hello,
I have a shell script which I need Java to start. When I pass the parameters in Java I get an exit value of 2. I never set an exit/error value of 2 in my code. What is even more strange, is that when I run the exact same strings I use in the processCommands array, the shell script starts and complete just fine. I have even tried commenting out getting the exitValue just in case my little script wasn't completely done.
Here is the code.
ArrayList<String> processCommands = new ArrayList<String>();
processCommands.add(processorString);
processCommands.add(dropboxString);
processCommands.add(name);
for (String string : processCommands)
System.out.print(string + " ");
System.out.println("");
ProcessBuilder processor = new ProcessBuilder();
processor.command(processCommands);
Process ProcessPdf = null;
ProcessPdf = processor.start();
ProcessPdf.waitFor();
int exitValue = ProcessPdf.exitValue();
System.out.println("Exit Value: " + String.valueOf(exitValue));The input I am working with is:
//home//adynammic//userfiles//demo//dropbox//process.sh
//home//adynammic//userfiles//demo//dropbox
s5.pdf
The shell script even runs from the command line with all the extra slashes. I am running an Ubuntu system if that helps.
Your help is greatly appreciated,
Chem EThere are a number of things that can be going wrong.
First, get rid of the extra slashes. They're probably not causing a problem, but there's no need for them, and we might as well eliminate that variable.
Is that shell script executable by the user that's running your Java code?
Does the shell script start with a line like
#!/bin/shwhere /bin/sh is the full path to a valid shell such as bash, zsh, tcsh, etc.?
Is that shell listed in /etc/shells?
(Yes, I know, since it works from the command line, this stuff shouldn't be an issue, but, again, let's eliminate variables, just to be sure.)
Does that script assume some environment variables or pwd that might not be present when running from your Java code?
Which of those 3 commands gives the exit status of 2? Start with just one of them, and don't add the others until you get that one working. -
Admin privileges without 'do shell script'
I'm trying to copy a file (actually an application bundle) to a non-administrator user's Applications folder. The message is "The operation could not be completed because you do not have enough access privileges". This has worked in the past, however.
If I do the copy manually I get the standard "The Finder requires that you type your password" message.
I prefer not to use a shell script because I then have other problems, also concerning privileges or ownership, as I recall. Is there a way to do the equivalent of "with administrator privileges" in the copy below?
-- mypath has been set to the folder containing both the script and file/folder to be copied.
try
tell application "Finder"
activate
if exists folder "Images" of folder "Applications" of folder ¬
"Operator" of folder "Users" of startup disk then
select file "Bundle" of folder "R" of folder myPath
copy selection to folder "Images" of folder "Applications" of folder ¬
"Operator" of folder "Users" of startup disk
else
display dialog "(Couldn't find folder Images)"
end if
end tell
G4 Mac OS X (10.4.2)As for privileges, try running a blank do shell
script "" with administrator privileges on the
line just before your copy/duplicate.
Thanks, but the only change is that now the message now says, "Finder got an error: a privilege violation occurred."
I had actually done a shell script with admin privileges in the same Applescript, so I'm surprised this change had any effect.
I'm working on software that used to run on OS 9, and it is a gross understatement to say that working with OS X's implementation of ownership and permissions has been a nightmare for me.
Maybe you are looking for
-
Any idea on how to fix my itunes? It just doesn't load the store page and that really *****...
-
ITunes 8.2.1 won't synchronize with iTouch
Since downloading the new version of iTunes, I can't synchronize my library with my iPod. There's no error or something of the kind; I just can't give the command to synchronize. Is there anyway to solve this problem or go back to a previous version
-
BI Publisher Desktop Word Plugin 5.7.146
Does anyone know where this can be downloaded? I've searched the Oracle site and can find the complete BI Publisher program but we only need the MS Word plugin piece. Thank you. Found it, thank you. Please disregard. Edited by: user10597210 on Feb 23
-
Can't Use An OS9 App. Please help!
i can't open an os 9 application file (a protools free project ) in the classic mode, and my powerbook g4 apparently doesn't support starting up in the native os 9 regime. what can i do? i need to urgently use the protools material i had once recorde
-
Hello everyone. I know this is a little bit irrelivant but I have an idea for Apple iPad (it includes bluetooth tech. so that's why I write this here) and I don't know what to do, where to contact.. etc. Can you help me about my problem? Thank you.