Calling BASH script from JAVA

 
Thread Tools Search this Thread
Operating Systems Linux Red Hat Calling BASH script from JAVA
# 1  
Old 05-23-2011
Calling BASH script from JAVA

Hi,

I am trying to call a bash script from a java file.

Code to call bash script will look like:

Runtime runtime = Runtime.getRuntime();
Process process = runtime.exec("mybashfile.sh");

It is succesfully calling the bash file.

I am using simple rm commands in the script to remove files and directories and it is removing those correctly.

But, when i use sleep between the rm commands, files and directories are not getting removed.

I am new to Linux. Please tell me what should i do
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Calling bash script from CGI

Hi, I am having two individual scripts Script 1): CGI script - is a simple script which trigger bash script Script 2): Bash script - is a script which execute which collects file system utilization information from all the Unix servers If I am executing CGI script manually from command... (2 Replies)
Discussion started by: Naveen.6025
2 Replies

2. Shell Programming and Scripting

Calling msys shell from bash script

Hi all, I am struck at a very tricky problem. Writing a bash script that calls msys.bat which inherently launches sh.exe. Now from my bash script, I call msys.bat and it creates a shell within. The problem is: I cannot pass any commands to this new shell from my bash script. I need to be able to... (5 Replies)
Discussion started by: sweetu1995
5 Replies

3. Shell Programming and Scripting

Password check in bash script calling on expect

password check in bash script calling on expect Background: I have to copy a file from one server, to over 100 servers in a test environment. once the file is copied, it requires to have the permissions on the file changed/verified. These are all linux servers. most of them have the same... (1 Reply)
Discussion started by: 2legit2quit
1 Replies

4. Shell Programming and Scripting

Calling function from another bash script

I would like to call functions from another bash script. How can I do it? Some code More code (11 Replies)
Discussion started by: kristinu
11 Replies

5. Shell Programming and Scripting

How to pass the environment name while calling java program from unix script?

Hi, I'm trying to test one unix shell script in dev environment. But I'm not sure how to pass the environment in my java program calling code. I'm trying to use -DconsumerEnv="DEV" but unfortunately I get 'null' while trying to print the value from java class. System.out.println("Environment: "+... (4 Replies)
Discussion started by: Pramit
4 Replies

6. Shell Programming and Scripting

Calling a Perl script in a Bash script -Odd Situation

I am creating a startup script for an application. This application's startup script is in bash. It will also need to call a perl script (which I will not be able to modify) for the application environment prior to calling the application. The problem is that this perl script creates a new shell... (5 Replies)
Discussion started by: leepet01
5 Replies

7. Shell Programming and Scripting

Quick question: calling c-shell script from bash

Hello, I have a quick reference question: I have a very long, but fairly straigtforward script written in c-shell. I was wondering if it is possible to call this script from bash (for ex. having a function in bash script which calls the c-shell script when necessary), and if so, are there any... (1 Reply)
Discussion started by: lapiduslost
1 Replies

8. Shell Programming and Scripting

Calling bash command in perl script

Hi, I have tried several times but failed, I need to call this script from the perl script. This one line script will be sent to /var/tmp/error Bash command: /usr/openv/netbackup/bin/admincmd/bperror -backstat -l -hoursago 12 |awk '{ print $19, $12, $14, $16}'|grep -vi default|sort >... (12 Replies)
Discussion started by: sQew
12 Replies

9. Shell Programming and Scripting

Calling Java Method from UNIX using shell script

Hi All, I need to call a java method from a shell script. I know we can use the command java ClassName to call the main method in it. But I need to call another method that is there in the class and pass an email to it. Can I use java ClassName.MethodName(email) Any help will be... (4 Replies)
Discussion started by: RahulK
4 Replies

10. UNIX for Dummies Questions & Answers

calling a script from java

HI I need to build a GUI where a button could execute a script in Solaris 8. I am working with Sun ONE Studio 7 Enterprice Edition. Thanks (1 Reply)
Discussion started by: javierelizabeth
1 Replies
Login or Register to Ask a Question
Alzabo::Runtime::JoinCursor(3pm)			User Contributed Perl Documentation			  Alzabo::Runtime::JoinCursor(3pm)

NAME
Alzabo::Runtime::JoinCursor - Cursor that returns arrays of "Alzabo::Runtime::Row" objects SYNOPSIS
use Alzabo::Runtime::JoinCursor; my $cursor = $schema->join( tables => [ $foo, $bar ], where => [ $foo->column('foo_id'), '=', 1 ] ); while ( my @rows = $cursor->next ) { print $rows[0]->select('foo'), " "; print $rows[1]->select('bar'), " "; } DESCRIPTION
Objects in this class are used to return arrays of Alzabo::Runtime::Row objects when requested. The cursor does not preload objects but rather creates them on demand, which is much more efficient. For more details on the rational please see the RATIONALE FOR CURSORS section in Alzabo::Design. INHERITS FROM
"Alzabo::Runtime::Cursor" METHODS
next Returns the next array of "Alzabo::Runtime::Row" objects or an empty list if no more are available. If an individual row could not be fetched, then the array may contain some "undef" values. For outer joins, this is normal behavior, but for regular joins, this probably indicates a data error. all_rows This method fetches all the rows available from the current point onwards. This means that if there are five set of rows that will be returned when the object is created and you call "next()" twice, calling "all_rows()" after it will only return three sets. The return value is an array of array references. Each of these references represents a single set of rows as they would be returned from the "next" method. reset Resets the cursor so that the next "next()" call will return the first row of the set. count Returns the number of rowsets returned by the cursor so far. next_as_hash Returns the next rows in a hash, where the hash keys are the table names and the hash values are the row object. If a table has been included in the join via an outer join, then it is only included in the hash if there is a row for that table. AUTHOR
Dave Rolsky, <autarch@urth.org> perl v5.8.8 2007-12-23 Alzabo::Runtime::JoinCursor(3pm)