Java program runs but not in bash script

stackoverflow.com - 2012-03-08 12:55:42 - Similar - Report/Block

I built a java program that runs the command "jps" and sees all JVMs and kills a particular JVM by extracting its id from the output of JPS command. It is working fine when I run it on the ubuntu terminal. But then I wrote a script in bash to ssh that machine from other machine and run this program there. ssh $host "java -cp daemon.jar JV...

How to execute and encrypted and password-protected bash script?

commandlinefu.com - 2013-03-10 10:34:12 - Similar - Report/Block

$ echo "ls" > script.bash; gpg -c script.bash; cat script.bash.gpg | gpg -d -no-mdc-warning | bash echo "ls" > script.bash; This is my script, a simple 'ls'. gpg -c script.bash; Here I encrypt and passord-protect my script. This creates file script.bash.gpg. cat script.bash.gpg | gpg -d -no-mdc-warning | bash Here I open file script.bash...

Run Bash from Java Program to Capture Webcam Image on Raspberry Pi

stackoverflow.com - 2013-04-20 00:23:09 - Similar - Report/Block

On my Raspberry Pi, I can successfully capture and save images from my Logitech Pro 9000 USB webcam from LXTerminal with the following bash line: fswebcam -d /dev/video0 /home/pi/image.jpg I want to write a java program that runs the bash line above because it is the simplest way to capture and save an image. So far, I have: import java.i...

Encrypt and password-protect execution of any bash script

commandlinefu.com - 2013-03-09 12:16:48 - Similar - Report/Block

$ echo "eval \"\$(dd if=\$0 bs=1 skip=XX 2>/dev/null|gpg -d 2>/dev/null)\"; exit" > script.secure; sed -i s:XX:$(stat -c%s script.secure): script.secure; gpg -c < script.bash >> script.secure; chmod +x script.secure (Please see sample output for usage) script.bash is your script, which will be crypted to script.secure script.bash -> scri...

Can a Bash script tell what directory it's stored in?

stackoverflow.com - 2008-09-12 20:39:56 - Similar - Report/Block

How do I get the path of the directory in which a bash script is located FROM that bash script? For instance, lets say I want to use a bash script as a launcher for another application. I want to change working directory to the one where the bash script is located so I can operate on the files in that directory like so: $ ./application...

Matlab passing in single quotations

stackoverflow.com - 2012-04-03 00:39:23 - Similar - Report/Block

I would like to know how to pass single quotations as an argument in matlab. I am running a bash script that takes in a string of integers and creates an array from it. The bash program is like this: read -a array <<< "$1" for i in ${array[@]} echo $i In the matlab GUI I want to test this function by doing this: >> stri...

Bash: How to compare arguments with if statement?

stackoverflow.com - 2012-04-12 16:26:00 - Similar - Report/Block

I'm trying to compare an argument in bash under OSX using the following code... #!/bin/bash if ["$1" == "1"] echo $1 echo "no" But I keep getting the following error $bash script.sh 1 script.sh: line 3: [1: command not found How do I stop it from trying to evaluate "1"?...

Launching CYGWIN-built executable from Java on Windows 7 fails with "error while loading shared libraries: ?: No such file or directory"

stackoverflow.com - 2012-04-10 18:32:00 - Similar - Report/Block

The code in question has worked in more or less the exact same configuration on earlier releases of Windows, however, it is not known to have run on Windows 7 YET! That's what I need to solve now. Briefly, some C code performs some configuration and security checks before launching a java program, passing some data that would be neigh-int...

how to parse a filename using regex?

stackoverflow.com - 2013-03-21 13:51:47 - Similar - Report/Block

I am building a bash script for backing up databases. I've already set up a cron job to running this script daily and I already can dump the .sql files according to the following format: YYYYMMDD_HHMMSS-databasename.sql Considering the timestamp formatted name, I want to build another bash script that will parse the YYMMDD filename part a...

How to wrap piped input to stdout in a bash script?

stackoverflow.com - 2013-02-27 13:06:47 - Similar - Report/Block

I want to write a bash script that will wrap piped input with some text. Based on Googling and trying to pick from examples. Here is what I have so far, that does not work: #!/bin/sh if readlink /proc/$$/fd/0 | grep -q "^pipe:"; then echo "{ "template":{"name":"contact sheet template","root":"root","parameters": ["pages"]},"pages":" c...

How to cd on remote server via SSH bash script?

stackoverflow.com - 2013-02-05 08:43:19 - Similar - Report/Block

I have a bash script I'm using to connect to a remote server via ssh. That works, however I want the script to immediately pass the command of cd /some/dir after connecting. That doesn't seem to be working. Here's my code: #!/bin/bash echo "SSHing.." ssh -i ~/.ssh/some-site.pem xxx@yyy.com cd /some/dir read How can I have the cd command...

Bash script error to run MATLAB

stackoverflow.com - 2012-08-04 01:30:51 - Similar - Report/Block

I'm trying to run a matlab script (ga_opt_main.m) in a cluster. I have to write a job submission file, which is essentially just a shell script. But I have never written a shell script and this is what I wrote #!/bin/bash #PBS -q *queuename* #PBS -l nodes=1:ppn=20 #PBS -l walltime=02:00:00 #PBS -N ga_opt_main module load matlab/R201...

evolveStar Join

Running a python script at various intervals during the day?

stackoverflow.com - 2013-03-21 16:06:36 - Similar - Report/Block

I need to run a python script at various times depending on the day. The requires are: On Weekdays: Start 7 am - End 12 pm => run script every 5 minutes Start 12:00 pm - End 4 pm => run script every 30 minutes Start 4 pm - End 9 pm => run script every 5 minutes Start 9 pm - End 7 am => run script every hour On Weekends: Run script eve...

Unable to run java program from CLI while Netbeans runs same program correclty

stackoverflow.com - 2012-05-01 12:32:04 - Similar - Report/Block

Following program runs fine with Netbeans IDE but when i try to run from command prompt i get Exception in thread "main" java.lang.NoClassDefFoundError: Gcd (wrong name: algo rithms/Gcd) at java.lang.ClassLoader.defineClass1(Nativ e Method) at java.lang.ClassLoader.defineClass(Unknow n Source) at java.security.SecureClassLoader.defineCl a...

Inline bash script variables

stackoverflow.com - 2012-04-01 02:56:43 - Similar - Report/Block

Admittedly, I'm a bash neophyte. I always want to reach for Python for my shell scripting purposes. However, I'm trying to push myself to learn some bash. I'm curious why the following code doesn't work. sh -c "F=\"123\"; echo $F"...

VS 2010: Need project to just act as trigger for MSBUILD script and to not compile to assembly

stackoverflow.com - 2011-12-08 14:42:03 - Similar - Report/Block

I have a solution with several web application projects in it. After all the projects have been built I need to run an MSBUILD script. What I used to do was call the script from one of the existing projects (through <Target Name="AfterBuild"> in the .csproj file). However, I had to make sure I used the project that built last, and...

executing a script in bash and korn

stackoverflow.com - 2012-04-16 12:36:24 - Similar - Report/Block

i have a script that reads a file line by line the code is FILE=commands.txt while read CMD; do echo "$CMD" done < "$FILE" This code is stored in a script file vxm_alarm.sh In Korn shell, this loop works perfectly, when i run the command vxm_alarm.sh . In bash however i get the following error vxm_alarm.sh: syntax error at line 4: `do...

Avoid quoting in CMake add_custom_command

stackoverflow.com - 2012-03-26 12:04:35 - Similar - Report/Block

I'm trying to create a simple batcher, which runs a script over a set of files. So, after globbed files, I've created the following custom command to execute the script: add_custom_command(OUTPUT ${RESOURCE_GFX} COMMAND ${EXE_GFX_EXPORT} ${GFX_EXPORT_PARAMETERS} ${RESOURCE_SWF}) where EXE_GFX_EXPORT is the script program, something like...

tee to a log within a bash script, while preserving stdout as a TTY

stackoverflow.com - 2013-02-27 05:01:21 - Similar - Report/Block

Similar to redirect COPY of stdout to log file from within bash script itself , but I'd also like to preserve stdout as a TTY device. For example, I have the following scripts: /tmp/teed-off$ cat some-script #!/usr/bin/env ruby if $stdout.tty? puts "stdout is a TTY" else puts "stdout is NOT a TTY" end /tmp/teed-off$ cat wrapper #!/usr/b...

Does "cp -r" behave oddly in bash?

stackoverflow.com - 2012-08-03 05:32:27 - Similar - Report/Block

I'm working on a bash script to bootstrap a cloud server with the puppet client so that I can create a boot image, but I'm getting weird behavior from a simple "cp -r" where the contents of my source directory are being copied, but the parent directory is not being copied. For example, if I had /root/puppet/file1, and I issued a cp -r /ro...

Executing specific CMD commands from Java Code

stackoverflow.com - 2012-05-08 22:29:55 - Similar - Report/Block

I have a .java classfile with a main method which produces a file "output.txt". I want to write a program in Java which compiles and runs it, so that the file "output.txt", produced by given Java class, is outputted to a specified folder. How can this be done? I can compile and run it, but I couldn't make something like a command in Java...

LOG4J conflicts JBOSS&Java program

stackoverflow.com - 2012-02-15 16:47:25 - Similar - Report/Block

I've got a java server launched from a jar that uses log4j (RollingFile and Console appender). Alone: no problem it works. I've got a JBoss server using log4j (default install). Everything is ok when it runs alone. When I start my Java server first and the JBoss, no problem either. However when launching JBoss first and THEN launch the ja...

Oem S14 sr20det camshaft part number?!!?

zilvia.net - 2012-09-16 11:32:21 - Similar - Report/Block

Anyone know what the stock S14 sr20det cam shaft code is? I'm trying to check if I'm rocking stock cams or not and I can't find a single thing online or ebay or nissan or nismoshop or my nismo. My first s14 sr20 :bash::bash::bash::bash::bash::bash::bas h::bash::l fault:...

Ruby RVM under unother user from Bash script

stackoverflow.com - 2012-06-14 10:13:05 - Similar - Report/Block

What is the best way to launch ruby script under another user via command and from another script? I have a bash script with the following command for launching unicorn: sudo -u unicornuser sh -l -c "bundle exec unicorn_rails -E production -D" This script is an init.d script and it being execute when system starts and manually also. The...

How do i call bash script function using exec function by passing parameter in php?

stackoverflow.com - 2012-03-21 08:14:18 - Similar - Report/Block

I have created a bash script that install magento in a cpanel. but i have a problem regarding the exec function. $function_path = Mage::getBaseDir()."/media/installer/fun ction.sh"; exec("$function_path $db_host $db_name $db_user $db_pass $url $ad_user $ad_pass $ad_email"); when i run this exec command,at that time it calls bash script fun...

How to set a BASH variable equal to the output from a command?

stackoverflow.com - 2011-01-10 21:58:02 - Similar - Report/Block

I am working on a simple scripting project for work that involves the use of BASH. I have a pretty simple script that is something like the following: #!/bin/bash VAR1="$1" VAR2="$2" MOREF='sudo run command against $VAR1 | grep name | cut -c7-' echo $MOREF When I run this script from the command line and pass it the arguments I am not abl...

PHP and Java encoding issues

stackoverflow.com - 2012-04-24 20:34:51 - Similar - Report/Block

I recently wrote a webservice that runs as a Java application (probably not the best idea, but I'm more fluent in Java than in other languages like PHP or English :p). The Java application simply outputs the JSON data to System.out. And then I wrote a tiny PHP script that uses the Java application. Here is my PHP script : ob_start('ob_gzh...

Git commit bash script

stackoverflow.com - 2011-12-13 01:23:43 - Similar - Report/Block

I'm writing a bash script to add, commit, push all files in a directory. #!/bin/bash git add . read -p "Commit description: " desc git commit -m $desc git push origin master I'm getting the following error: $ ./togithub Commit description: test commit script error: pathspec 'commit' did not match any file(s) known to git. error:...

Why does my .jar file raise exceptions even if my program runs without exceptions in Eclipse?

stackoverflow.com - 2012-05-14 19:35:25 - Similar - Report/Block

I am new to Java and learning how to export applications to .jar files. I made a simple Java application in Eclipse with a few classes based on the tutorial from this website. http://eclipsetutorial.sourceforge.net/t otalbeginner.html When I run my application via Run -> Run in Eclipse, my application runs without exceptions. However, whe...

How PHP script can be called using Java Applet

stackoverflow.com - 2012-03-27 08:44:30 - Similar - Report/Block

I want to access user's scanner using PHP script. I know this can be done by using PHP script on Linux based machine. I want to put this script on the server and wanted to run it via Java Applet I don't know Java much also I am not sure if this task can be done by this way. Please suggest if this is correct way and How to proceed on it. T...

can I change user password in linux from java program?

stackoverflow.com - 2012-06-01 09:34:40 - Similar - Report/Block

I am trying to change user password in linux from java program by sending password in outputstream but it is not done. My java program is like Process process = Runtime.getRuntime().exec("passwd sampleuser"); OutputStream outputStream = process.getOutputStream(); InputStream inputStream = process.getInputStream(); PrintWriter printWriter=...

Bash Script not running properly

stackoverflow.com - 2012-05-01 14:07:04 - Similar - Report/Block

This program is suppose to accept a number from the user and print that many prime numbers. For some reason the program doesn't work. I am new to bash scripting and this is my first program. To my eyes everything seems to be correct. Please tell me where I went wrong. echo Enter num read n for(( i=2; i <= n; i++ )) for(( j=2; j < i-...

Querying Active Directory via Java

stackoverflow.com - 2010-12-16 00:59:17 - Similar - Report/Block

What is the best way to query Active Directory from Java? Now I know that .NET has special methods built in for doing this sort of thing. But in Java, would calling a Powershell script by launching a process/command line be a good way of doing this? Furthermore, why is the decision taken to call C# from Java anytime Java needs to access W...

Run execute file in Runtime.exec() and get user input

stackoverflow.com - 2013-05-15 09:49:29 - Similar - Report/Block

How to run c execute file with user input in Java Runtime().exec() . Without user input in my c program execute file runs in Runtime().exec() For example: Below c program if n is predefined and it's execute file runs in java runtime()...If n is a user input how to run the execute file? #include #include #include int main() setbuf(stdo...

How to automatically get thread dumps from tomcat

stackoverflow.com - 2012-04-14 17:45:05 - Similar - Report/Block

We had some issues of thread pile ups with production tomcat server so I wanted to setup some cron to to periodically check thread dumps and send alert email if something is wrong. To do this we need to take thread dumps in file from shell script but I am unable to do that. From shell I can issue KILL -3 <PID> at periodic interval...

Assigning values to an array (Bash script error)

stackoverflow.com - 2012-02-29 21:15:44 - Similar - Report/Block

I have been told that you can assign values to an array and make it at the simultaneously in bash script using this code arrayName[0]=1 However this does not work for me and keeps throwing up this error: array[0]=1: not found Can someone please point out the error of my ways...

Git Plugin for Jenkins on MacOS Slave doesn't checkout as expected

stackoverflow.com - 2013-03-18 11:28:46 - Similar - Report/Block

I'm having a small but significant problem with Jenkins. I've setup the Jenkins CI on a Windows 7 machine, and also a slave through Java WebStart, on a Mac Mini. I've had some issue setting up ssh connection to the git repo, but I've figured it out. Now I'm having troubles running the build on my Mac Mini. Basically, the job seems to clon...

What is wrong with my ant configuration?

stackoverflow.com - 2010-02-25 17:50:17 - Similar - Report/Block

I installed Ant on a Fedora 5 machine using yum, but Ant does not launch. I get this error message: [bash]# ant Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/launch/Launcher Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.launch.Launcher at java.net.URLClassLoader$1.run(URLClassLo ader.j...

Formatting Java Script using Java API

stackoverflow.com - 2013-03-18 06:53:11 - Similar - Report/Block

I am generating java script code using velocity in java. For example: I generated java script and got below string: importClass(java.util.ArrayList); function fun(arg) { if (true){ return true;} else{ return true;}} Is there any java API that takes this String and formats this java script in below manner: importClass(java.util.ArrayList);...

Passing file into program with bash

stackoverflow.com - 2013-02-26 03:03:18 - Similar - Report/Block

I am trying to pass a file into a program for data processing with bash and I am wondering if I have the correct syntax /home/mumps/CS3150/Script/HW1/textfiles/ CardioAndPulmonary.txt | /home/mumps/Medline2012/getDocs.mps > /home/mumps/CS3150/Scripts/HW1/textfiles /Titles.txt The text files I am sending in are all valid and correctly format...


Fill out the form you see below. Registration is free, fast and simple.
If you are already registered, sign in page login.

Web Site :
Required Field
First Name :
Required Field
Last Name :
Required Field
Email :
Required Field
Sex :
Required Field

evolveStar.com is free for ever !

evolveStar.com provides a search engine that allows you to gather information to write their own blog.

evolveStar.com enhances the sources displaying the logo of the site.

If you want to remove your site or you believe a site listed infringes copyright, please report it to: info@evolvestar.com

Specifies the subject copyright violation and the url of the page

evolveStar.com respecting the law DMCA (Digital Millennium Copyright Act) will immediately remove whatever its merits.

Next will be effectual and relevant checks.

Who We Are Partner Advertising Contacts Privacy terms Help & FAQ

© Copyright 2010-2017 Fabrizio Fichera. All rights reserved.