I'm trying to set up a shell script so that it runs background processes, and when I Ctrlc the shell script, it kills the children, then exits.
The best that I've managed to come up with is this.
I have the following ksh script:
sqlplus usr1/pw1@DB1 @$DIR/a.sql $1 &
sqlplus usr2/pw2@DB2 @$DIR/b.sql $1 &
wait
echo "Done!"
Where $DIR is a variable with the absolute path where a.sql and b.sql are.
For some time, I've been running this script daily and it works fine.
Hello I have around 20 commands and I have to send all of this to Unix shell, and copy the result, but I don't know how to do it.
Command 1 - Connect with a server.
Wait until command 1 finish
Command 2- Update all the information from server 1 finish
Wait.
Command 3. Get some parameter.
...
hello folks, i have this shell script, just messing around with shell scripts for fun. how would i edit this file so that if the username is wrong it will display the proper message "sorry wrong username exiting in 5 seconds" and then wait 5 seconds and apply the exit command? Im just not sure how to add it properly into the else field.
Hi
I have written a bash script to capture the output of jmap.
The command i execute is jmap -heap <pid>
This gives details of memory usage of the process with <pid>.
Now jmap not only gives this info but also prints couple more lines, which i am not interested in.
----------- Summary -----------
I need a command/set of commands that can help me simulate a shell terminal via a PHP web page using commandline functions. How can I combine the power of nohup and a while loop to:
start the shell,
execute commands and print output (and errors i.e.
I have searched but cannot find a working method. What I need to do is first, download a file using AsyncTask. Then I will execute a script. The thing is, the script depends on the file I'm downloading, so I need to wait for the AsyncTask to finish the download before I execute my script. I cannot find a working method for this. Sorry if I didn't search good enough.
#!/bin/bash
function abc() # wait for some event to happen, can be terminated by other process
{
sleep 3333
}
echo "PID: $$"
abc &
echo "PID: $$"
I need to retrieve the pid of this function, but the echo prints the same string.
If I'm not going to put abc() out of this script, is it possible to get it's pid and terminate that function?
I was discussing with my friend on how the commands are parsed in the shell, and he told me that bash searches the command in following order 1.List of aliases 2. List of shell keywords 3. List of user defined functions 4. List of shell built in functions 5. List of directories specified in the PATH variable , from left to right.
I know aliases can be found by issuing the "alias" command.