0
votes
2answers
91 views

How to kill a process running in specific script

I have two script files running simultaneously. I just need to kill the java process running in one script without affecting the java process in the another one.
2
votes
1answer
39 views

Killing multiple instances of the script from the script itself

I've couple instances of script.sh running in parallel, doing the same thing, running in background. I'm trying to use a function to kill all the current running scripts when executed. So, for ...
2
votes
1answer
475 views

Why is 'kill -9' killing browser as well as server?

I sometimes have to use kill -9 as a last resort to kill my rails server. Unfortunately, I have to do that often enough that I wrote a helper function in my bash_profile to do it. If I do it manually ...
3
votes
1answer
41 views

Triggering Bash Before Killed [closed]

I just made some kind of service code. Check this out: do_start() { while true do if [[ $(pgrep -fl loopsvn.sh | wc -l) -gt 2 ]]; then echo "Already use by another ...
2
votes
1answer
68 views

How to terminate a shell script?

I'm working on a supercomputer and have a shell script that will automatically schedule a bunch of jobs for me. Once the script is run, I can terminate manually with Ctrl+C. I was running the script ...
2
votes
2answers
142 views

Killing background process in bash script when exiting the script

I have a script that tail a file while displaying a clock in the top right corner. I took the clock part from the internet, and it works ok. The entire script is something like (I simplified): while ...
0
votes
1answer
96 views

Job started by procmail does not appear in ps-output and cannot be stopped, even not after reboot

For testing purposes I called procmail by my .forward file |/usr/bin/procmail and by the rules in .procmailrc it started a job named "start", which was simply an infinite loop while true do ...
2
votes
2answers
134 views

Bash script to signal a concurrently running instance (same script) about a condition and increment counter

Background Here's what I want to achieve. I have a (potentially) long-running process. Now I have locking in place just fine and all is generally in order. However, since this is a scheduled job, ...
5
votes
3answers
440 views

Using `kill -s 0 $pid` vs `[[ -e /proc/$pid ]]` to detect if PID is running

One of the idioms often used to check if process is running is to use kill -s 0 $pid. My question is, does it have any upsides over using [[ -e /proc/$pid ]] construct? The script I'm writing is ...
4
votes
3answers
5k views

Terminating a bash shell script running in the background

I often use bash shell scripts to run simple commands for many different files. For example, suppose that I have the following bash shell script, called script.sh, that runs the program/command foo ...
0
votes
2answers
1k views

`ps | grep | kill` aborts my script prematurely [duplicate]

I have a Linux computer that I remotely SSH into using plink on a Windows XP machine. I have the Plink program set to execute commands in a script using automated login: plink -ssh [domain name] -l ...
3
votes
3answers
348 views

Print process ID (PID) of a Matlab instance

To run my Matlab scripts, I've created a shell script to which I give two parameters - the path to the matlab file ($1) and to the log file ($2): nohup time matlab -some_parameters -r "run $1;exit" ...
6
votes
2answers
215 views

Decode Flags for Kill Command

I am new to Shell Scripting. I saw this Command on a Book for Linux shell Scripting $ kill -HUP 1234 >killout.txt 2>killerr.txt I know what the command does, but i am not able to understand ...
2
votes
2answers
774 views

Why can't I kill a timeout called from a Bash script with a keystroke?

[Edit: This looks similar to some other questions asking how to kill all spawned processes – the answers all seem to be to use pkill. So the core of my question may be: Is there a way to propagate ...
3
votes
2answers
2k views

Exit Google Chrome from terminal

Is there a way to cause google-chrome to quit, from the terminal, besides using killall google-chrome? I would like to be able to close it from a script without killing it.
3
votes
3answers
917 views

Killing other user processes

There are certain user environments in which we have to login during certain performance testing and and kill all the process running in that environment. The environment names are like rswrk01, … up ...
4
votes
3answers
2k views

How to kill two or more processes with one kill command?

I am using the following command to kill one java process via shell script: pidof java|xargs kill -9 $1 What if the list of pidof output has more than one elements? How do I kill them both with ...