Programming :: Running A Program With Arguments Using A Shell Script
Jul 14, 2011Running a program with arguments using a shell script
View 1 RepliesRunning a program with arguments using a shell script
View 1 Replies1. What file do i have to edit in order to include /usr/local/bin in the class path (ie. I put an executable in /usr/local/bin and when I try to execute it, it says the command cannot be found, etc.) EDIT: Solved, just didn't set PATH correctly. EDIT: New problem. When I try to execute a program in /usr/local/bin, it says "fopen: john.ini: File not found" Yet when i cd to /usr/local/bin, it doesn't say that. What would cause this?
2. Once I get my system setup the way i like it, how would i go about making it into a bootable CD/DVD?
3. How would I pass arguments from a shell script to a program?
how to run a shell script taking command line arguments in a jsp page.
View 1 Replies View RelatedMy hosting server does not allow exec() or system() calls, for security reasons. I can call a cgi process in two ways. From a .shtml page, i can issue a directive like code...
View 11 Replies View Related(For function arguments): Scalar arguments are passed by value, which means that a copy of the argument is made for processing in the function, and changes to the argument in the function won't be reflected back to the calling program. Objects though, are passed by reference: any changes to them in the function are reflected in the calling program. What sense does this make? Why have they done this?
View 3 Replies View RelatedI have a script gdrGltoDataRefresh.sh .while try to run the script it's giving:
And in log file it's giving:
I am running Linux Mint 9..I play xbox live and run it through my laptops wireless network connection so i dont have to pay 100 dollars for the usb wireless adapter for the xbox. In windows 7 this is easy to configure so that when i turn my laptop on and then xbox it automatically connects.
View 10 Replies View RelatedI have a script that executed 100000 C Programs, reads the commands from a file and executes them. There is a requirement to measuer the time that each of this 100K C programs running.If it exceeds 120 sec I want to Kill that Process.Any Idea to embed this in my shell script?
View 4 Replies View RelatedPossible Duplicate: Leave bash script running on remote terminal while not logged in? I run a program, say ./a.out 10 from the shell prompt. Assume that there's a while(1) inside the program being run. Now if I try to close the shell, it warns me that it'll kill my running program too! So, how to kill the shell and still let my program continue running in the background?
I tried exec ./a.out 10 but the shell is still there. Another alternative is to simply double click my executable but then how will I pass command line parameters?
In below program I want to add (as part of the valid_cmds string) the pwd (print working directory), lo (logout), and cd (change directory) commands. However when I add those into original program ;
char *valid_cmds = " ls ps df pwd lo cd";
they are not working I have the cout message huh?
Original source code is below code...
I am using Shell Script to run my Java program. I have written a Cron job to invoke Shell Script every day at 7pm. Cron job is running every day at 7pm ,but it is not invoking my shellscript and also I am not getting any error message. I am able to run same shell script from cmd propmt using bash, and also I am able to invoke the same script from mainframes Universal command job. Same ShellScript and Same cronjob is working fine in my Dev server. But in my QA server it is not working.
View 7 Replies View RelatedI could run this code in PHP.
PHP Code:
[Code]....
But there is problem here. I have to close and open Internet Explorer to see my changes effect on iptables! Is there a way that I don't have to restart the IE?
I am facing problem of trying to access parameters to be given to shell script within a java prg.
I have following code to run the process within java but the parameter is not recognized within $ or without it also.
Code:
The script receives multiple files as parameters and it is supposed to count the number of lines in each of them and write that number in another file.
This is my script:
Code:
while [ -n "$1" ]
do
lines=`cat $1 | wc -l`
echo "The number of lines in file $1 is $lines." >> lines.txt
shift
done
Is there any other way to do the same thing, without using shift?
I want to start servers which are running on my pc with one shell script.
what I wrote is.
#!bin/sh
cd /home/HUNT/server1
gnome-terminal
sh script/server start_with_output
[Code].....
Result I got is:
A new terminal opened with current directory as /home/HUNT/server1 and server started running.
What I didn't get: second terminal and second server were not running.
1. i need to check whether the oracle database is running or not if it is running it will run auto mount script.nohup /u01/app/oracle/product/11.2.0/dbhome_1/bin/dbfs_client dbfs@xxxxx -o allow_other,direct_io /u01/app/oracle/DBFS/XXXXX < /home/oracle/passwd_dbfs.txt&nohup /u01/app/oracle/product/11.2.0/dbhome_1/bin/dbfs_client dbfs@xxxxxx -o allow_other,direct_io /u01/app/oracle/DBFS/XXXXX < /home/oracle/passwd_dbfs.txt &2. For every 1 hour i need to check above mount points is mounted or not if it is not mounted it should be mounted.
View 3 Replies View RelatedI'm using gdb to debug my program. My program requires arguments (e.g., ./prog -dfile).But if I use gdb as in gdb ./prog -dfile, gdb wants to interpret the -d argument. How do I pass an argument to my program via gdb?
View 2 Replies View RelatedI am trying to use perl to run a program using the eval command but the program runs infinitely, i just need it to run basically for one second, stop then give me the output. I tried using fork but it does not really work. The child process is not being killed.
my $pid = fork;
if ($pid == 0) {
my $results = `ngrep etc...`;
[code]...
i want to run c graphics program on linux for that i want to install[URL]but i dont know how to install this graphic file on linux to make it un.
View 1 Replies View RelatedI want to run gallist pkge from iraf for several times.. The step for running that
is:>xgterm &
>ecl &
ecl>noao
noao>artdata
artdata>epar gallist (I set some parameter) then by writing gallist iraf terminal the pkge is run:
artdata>gallist
I want this pkge is run for 1000 time and all output result are collected in only one file.
I have a linux system connected to an external sensor device that spits out strings of serial data every few seconds. I need to send the data to a remote URL for logging and graphing purposes.
The data coming down the serial is essentially in the format:
And I need to call a URL from my linus box in the format
wget -s [url]
I can read the data to the shell using cat </dev/ttyS0 but I'm now stuck as to how I might then format that data and pass it to a shell script which would presumably run in an endless loop and contain the wget.
I have a script that calls another program/script, xxx, to run in the background. Supposedly this program at most should finish within five (5) minutes so after five (5) minutes, I run some other steps to run the script into completion. My problem is sometimes the program takes longer than five (5) minutes and this is causing problems when running the rest of the steps in the scripts. Can anyone suggest how to re-program my script. At the moment, the KSH script, i.e. test.ksh, is doing as below:
test.ksh:
.....
.....
xxx/xxx.ksh <--- program/script called by the script
sleep 300
..... run the rest of the script .....
..... problem is sometimes xxx/xxx.ksh takes longer than 300 seconds .....
..... any way that I can monitor that xxx/xxx.ksh finishes before I run .....
..... the rest of the scripts .....
I'm looking for a way to detect whether or not a program has been called from pipe, e.g.
Code:
whatever | my_program
versus simply just being exectuated directly:
Code:
my_program
Why? In the first case, I want to run the program non-interactively, and in the latter case I want to print out user-friendly messages. I've been thinking along the lines of some check I haven't yet found, like:
Code:
if( stream_buffer_is_not_empty() )
print_interactive_messages();
I would like to know if there is a linux command to verify the amount of memory used by a program. The programs I am using were compiled with gfortran.
View 2 Replies View RelatedThe situation is that I have an MPI-parallel fortran program. I run it and it's distributed on N processors, and each of these processes must call an external program.
This external program is also an MPI program, however I want to run it in serial, on the processor that is calling it, as if it were part of the fortran program. The fortran program waits until the external program has completed, and then continues.
The problem is that this external program seems to run on any processor, and not necessarily the (now idle) processor that called it.
how I can call the program and ensure it runs only on this processor?
Extra information that might be helpful:
If I simply run the external program from the command line (ie, type "/path/myprogram.ex <enter>"), it runs fine. If I run it within the fortran program by calling it via
CALL SYSTEM("/path/myprogram.ex")
it doesn't run at all (doesn't even start) and everything crashes. I don't know why this is.
If I call it using mpiexec:
CALL SYSTEM("mpiexec -n 1 /path/myprogram.ex")
then it does work, but I get the problem that it can go on any node.
I'm trying to test whether wget is working still or not. While [ wget is still running ] <----- but how should this look please?
do
codes
done
My requirement is to save files before shutting the Linux machine down, unattended ie: when the user is not near the machine. This is done whenever the UPS battery is about to die, so that the files get saved. open-Office/text-editor applications that can be saved using keystrokes will have to be found from the running processes and keystrokes should be sent to them from a C program that was started in non-graphics stage. ie: from a C program that forks into memory as a daemon before xwindows part starts. How to I send keystrokes to a running application? (like cotrol + F and then wait and then send next set of keystrokes till the file is saved as a new file or as the same file itself), either from C program or a script?
View 1 Replies View RelatedHow can i write a shell script that takes a file path as command-line arguments.and it should report whether the path denotes a file or a directory.
View 2 Replies View RelatedI have a java program that runs on Debian as a background processor. Yesterday the Java program stopped running. I looked at the memory usage, the system only had 5MB memory left, so my guess is that the java program ran out of memory to use.
However, after we restarted the java program, we could see that the free memory count started to go up. It kept going up from 5MB to over 400MB. The increase of memory happened slowly, when I measured it, I could see that with each minute passing by, there were a bit more memory added into the free memory pool, and meanwhile, the java background process was running.
I wonder why this would ever happen. It's as if our java program first brought the machine done because it consumed all the memories, then after restart, it starts to give back memories.
I am currently working to develop a perl script for irssi that will capture data from irc channel hold it in memory as variable and send it to a shell. Does anyone know a good irssi irc scripting guide? something that will include $botname, $msg, $nick, $channel etc scripting explanation. Is it possible to send a run program command to shell thats located in my /home/user/myapp using ./myapp from irssi? i am using bash. I've only just started, so i dont have any code written yet,
View 2 Replies View Related