How to run a process through shell script.?

 
Thread Tools Search this Thread
Operating Systems Linux Red Hat How to run a process through shell script.?
# 1  
Old 05-06-2013
How to run a process through shell script.?

hey , i have to write a script to run a process through shell script and if the process runs successfully then return success.

i used nohup to start the process but nothing occured .

#!/bin/sh
nohup ./cvt -f MediationSources.xml &

can anyone pls help me

Thanks
# 2  
Old 05-06-2013
You could try something like:
Code:
nohup ./cvt -f MediationSources.xml &
c_pid=$!
wait $c_pid
c_status=$?
echo "Exit status is: $c_status"

$! & $? are special shell variables:
Code:
$!            the process id of the last command run in the background.
$?            the exit status of the last command executed.

# 3  
Old 05-06-2013
hey , i used the code but it is not working . is there any way without using nohup. because using nohup

nohup: appending output to `nohup.out' is coming on command line for a long time then i have to stop it using control z.
# 4  
Old 05-06-2013
It may look like it's waiting when it actually isn't, because it's printed overtop your prompt... That can happen with nohup's warning message when you put it in the background, since nohup and shell don't wait for each other with &. Just hit enter and see if your prompt reappears. If it does, then it was in the background already and didn't need killing or stopping.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script run in a case statement call to run a php file, also Perl

Linux System having all Perl, Python, PHP (and Ruby) installed From a Shell script, can call a Perl, Python, PHP (or Ruby ?) file eg eg a Shell script run in a case statement call to run a php file, also Perl or/and Python file??? Like #!/usr/bin/bash .... .... case $INPUT_STRING... (1 Reply)
Discussion started by: hoyanet
1 Replies

2. Shell Programming and Scripting

run this script as a daemon process

Hi, HI , I have a simple script that moves files from one folder to another folder, I have already done the open-ssh server settings and the script is working fine and is able to transfer the files from one folder to another but right now I myself execute this script by using my creditianls to... (3 Replies)
Discussion started by: nks342
3 Replies

3. Shell Programming and Scripting

run script with booting process

hi all, I write a shell script which search file in particular folder and copy another folder.after that i compare two folder if file did not match then copy file from one to another folder.Both New and New1 folder contains file with different name. The code of my script is here #!/bin/bash ... (4 Replies)
Discussion started by: shubhig15
4 Replies

4. Shell Programming and Scripting

script to monitor the process system when a process from user takes longer than 15 min run.

get email notification from from system when a process from XXXX user takes longer than 15 min run.Let me know the time estimation for the same. hi ,any one please tell me , how to write a script to get email notification from system when a process from as mentioned above a xxxx user takes... (1 Reply)
Discussion started by: kirankrishna3
1 Replies

5. Shell Programming and Scripting

Help with shell script to run a converter process

Hi, I have about 500 binary files. I have a command to convert these files to text. The command usage is: converter bin-file txt-file I have to input the name of the binary file and the name of the text file. I'm thinking something like this will work, but not really sure: for file in... (1 Reply)
Discussion started by: bbbngowc
1 Replies

6. Shell Programming and Scripting

Shell Script to Kill Process(number of process) Unix/Solaris

Hi Experts, we do have a shell script for Unix Solaris, which will kill all the process manullay, it used to work in my previous env, but now it is throwing this error.. could some one please help me to resolve it This is how we execute the script (and this is the requirement) ... (2 Replies)
Discussion started by: jonnyvic
2 Replies

7. Shell Programming and Scripting

Help need to make a shell script run for ffmpeg vhook watermaking in shell

i have a small problem getting a batxh shell script to run in shell this is the code the problem seems to be centered around the ffmpeg command, something maybe to do with the ' ' wrapping around the vhook part command this is a strange problem , if i take the ffmpeg command and... (1 Reply)
Discussion started by: wingchun22
1 Replies

8. Shell Programming and Scripting

How to Run a shell script from Perl script in Parent shell?

Hi Perl/UNIX experts, I have a problem in running a shell script from my perl script (auto.pl). I run the perl script using perl auto.pl from the shell prompt The shell script picks the files in "input" folder and procesess it. The shell script blue.sh has this code. export... (16 Replies)
Discussion started by: hifake
16 Replies

9. Shell Programming and Scripting

Run a process through inetd using korn shell!!!

Hi, I am trying to run a process through inetd using ksh. The entry in /etc/inetd.conf is Process_Name tcp nowait root /home/user/script script The script is as follows /usr/bin/ksh -c /path/process Recycling inetd services is successfully completed. But when the process is accessed... (8 Replies)
Discussion started by: vishi_82
8 Replies
Login or Register to Ask a Question