Programming :: Java Coding To Use Call The Bash Script?
Oct 31, 2010
i am using front end as java and back end RHEL5.i am trying to calling a bash script with java. but i am facing problem.i am using following java coding to use call the bash script
import java.util.*;
import java.io.*;
public class b
In practice I have a script that call a java program that call a linux system command. The script if I run it, from a shell functions well,so it is not a java problem. The problem come out when i put this script in a crontab schedulation. The result in this case is that java do not execute the system command. I think it depends on crontab
I am trying to write a bash script to call from a terminal that will change the terminal title. I am using ubuntu 10.04. The script is meant to be used in the gnome-terminal.
Here is what I have:
Code: #! bin/bash echo "New title: c" read title echo "33]0;$titl07c" -e
[Code]....
it doesn't work
I think the problem has to do with modifying PS1 inside the bash so i tried this:
Code: echo `export PS1="[e]1;u@h:wa]${debian_chroot:+($debian_chroot)}u@h:w$ "` and it still didn't work.
I have a bash script that calls a java class method. The method returns a string to the linux console when run independently. how can I assign the value from the java method to a variable in a bash script?running the script: java -cp /opt/my_dir/class.method [parameter]
how i can use the cal command so it displays the current month and the next month, i know you can use cal -3 9 2007 to show the previous current and next but i just want to display the current and next.
I am running a Java application on the command line bash terminal under Mint Debian. I have JDK1.6.0_22 installed 64-bit, and the OS is 64-bit too. I have a few JAR files in the directory and a few native LWJGL libraries. When I run the application using the command line, all works fine. Lets assume my directory where the files are is called /home/riz/MyGame. I change to that directory and this is the command I use code...
I've just installed java (jre-6u21-linux-i586.bin) on Red Hat 4.4 AS and issued this command to check the java version: java -versionand got :bash :java: command not found
I would like to call my java program from php. How is it possible I know of zend bridge but when I read it say it will take our the existing php which I am not sure what other side effect I will have to face.
What sort of libraries can i use for coding of sniffer program for windows and linux? The sniffer that i want to code is for capturing the list of connected clients to AP wirelessly. I do know that the wireless NIC needs to be in 'monitor' mode in both windows and linux.
I've been a PHP developer for about 6 years now - the last two years I have been pretty inactive though. Just recently though, I have been reading resources on all the different programming patterns (Factory, Singleton, Registry, Observer, MVC, etc) to try and get my head around good programming techniques. For myself though I find that I can only truly understand how these methods work when I am forced to do them myself.I have a large project I am doing at my workplace (me only) that involves building a very complex PHP application.
I would like to know your professional opinion; should I spend the extra time to program this PHP application myself and really, properly learn all these different programming patterns? Or, should I just build on top of a PHP framework like the Zend Framework for speed's sake (and flexibility/features)?
I have found understanding exactly how the Zend Framework works hard, just because I haven't been exposed to using these programming patterns myself. I hate that - I want to fully understand exactly what is happening in my application and know exactly how each part relates to others.
From this thread I've decided to try add a feature of removing local port forwardings in ssh.Here are some very ugly and not-yet working hacks what I made so far:
* Patch for channels.c * Patch for channels.h * Patch for clientloop.c
I was clearly expecting this to work without any troubles-everything seem to be logically correct, but I made a programming mistake somewhere: don't know where, maybe you will point me to this?Many sites say there is a WAY AROUND with -D param(starting socks proxy as a tunnel-generator), added since 5.2, but I don't need that way around. I need a way through. I use exact ports for exact services and if I want to change it runtime I'd like to have ability to do so.If you have other ideas or points instead of coding this, please share them here & here(original question).
First, i have no experience with javascript. I came across an interesting site and I'm curious if I could make a private webpage to call some shell commands or just open a terminal.Yes, i know this could potentially be malicious and possibly illegal. Again it's for my own private usage.
I'm trying to remember how to use the output of a nested Bash builtin call. So `which prog` gives me the path to the program, i'm interested in. Then I would like to get the directory path leading to that program and plug it into 'cd', so i end up in the directory containing the program.
I'm working on Linux OS (Suse/redhat) and trying to format a linux partition from a c program. Is there a way to do this without using : 'system ("mkfs.ext4 /dev/sdxy")'
Me and my friends have a website about games and stuff. The web hotel we use clears the app-pool when it has been inactive for 15 minutes. We don't have that many users yet so this is a problem because it takes ages to load if it has been inactive. I came up with the brilliant idea of calling the website with a script from my private server at home every 5 minutes or so. That way it would never go down.
I used some lines from another of my scripts: wget -q -O - http://homepage.se/ > /path/to/a/file.txt cat /dev/null > /path/to/a/file.txt and put it in crontab.
The script runs and all and I think it's better now but we can't know for sure if it is the scripts doing. Sometimes it's just as slow as ever and I start to think the script doesn't do anything. I've tried adding more wget-lines to fetch some different pages from the site and now running it every 3rd minute. No difference. Does anyone know another way to call a website in a way that would solve my problems? Am I using the wrong options with wget maybe? I've tried lynx (and piping to file) but it didn't work.
I was wondering if there was a way to add a switch to a gcc/g++ call everytime. I have a few libraries that I need to compile for different processors. Each has a makefile which calls gcc to compile. Here is the best option I could come up with so far:Include a Makefile and define CC as gcc -mcpu=xxx.
i have only basic knowledge of C so guys plz help me...is C language support call the C executable inside the C ?example contect mainA.c have a many function define in the struct,when i compile mainA and make a executable the name is ( A ),can i use executable C inside the C <my C program call the executable ( A ) > .
I have created a executable file using c and I have also created a GUI using GTK+. Now how can I call the executable file from the GUI with arguments passing to the executable file.
There are examples everywhere about calling f77 subroutine from IDL, but I have not found any material about IDL calling fortran written in f90 way(free style). I tried the following example, but write the subroutines in free style. When I run the makefile, it gives an error 'undefined reference to main_'.
Code:
SUBROUTINE SUM_ARRAY(argc, argv) !Called by IDL INTEGER*4 argc, argv(*) !Argc and Argv are integers j = LOC(argc) !Obtains the number of arguments (argc)
I would like to know how do I print the line # in a script. My requirement is, I have a script which is about ~5000 lines long. If there are any errors happen I just exit. And I would like to add the line # of the script where the error happened.
Code: #!/bin/bash trap "echo 'you got me'" SIGINT SIGTERM # to trap ctrl+c echo "Press ctrl+c during 5 sec loop" for ((i=0;i<5;i++)); do
[Code]...
How come code behaves normally and stops when ctrl+c signal is caught and resumes, but after I use at least one timeout read in the code it looks like, if signal is caught again it doesn't pause the execution but skips the loop. If you remove -t (timeout) option from the read, both loops look the same!
I am facing issue in my OPENSSL code. I have written openssl client. It sends request to the host and receives response for that request.
My problem is, it connects, sends request successfully to host at first time only in sencond attempt it fails on SSL_write(). where SSL_get_error() returns SSL_ERROR_SYSCALL error.
In that ERR_get_error() returns 0. man page shows "If ret == 0, an EOF was observed that violates the protocol".
Code Snippet. w=SSL_write(SSLRequestData.ssl,c2s,c2sl); switch(SSL_get_error(SSLRequestData.ssl,w)) { case SSL_ERROR_NONE: if(c2sl!=w)
I have a process that forks, where the childs puts some data of random size and exits while the parent should get the data and does some manipulation.. here I have used a pipe for child to write the data and parent to read the data.. Child simply dumps the data, and the data is of any size even child and parent doesnt know. I have used select in the parent to see whether there is any data coming on the reading end of the pipe.. if there is a data.. I copy into a buffer.. Im reading the data continusly when the child exits after closing the writing end of pipe. Parent gets blocked on the read part But my question is how parent know the other of pipe is closed when using the select call. In otherwords.. while using select in readfds, how would i know the other end has closed the pipe..