General :: Shell Script - Killing Particular PID Process
Jun 28, 2011
I was looking into a shell script which had a line "kill -0 [pid]" , I would like to know what the -0 flag does as i found it is not killing the particular [pid] process.
View 2 Replies
ADVERTISEMENT
Mar 10, 2011
I want to kill parent process after "fork()" method. but if I kill parent process with "exit(0)" method, main() thread is terminated as well so child prosess doesn't work anymore. Is there any way to kill only parent process without affecting to child process?
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
[code]....
View 1 Replies
View Related
Oct 15, 2010
I have a zombie running on my computer(Ubuntu 10.10) and although I have tried killing it using the processes PID number it won't die.
Tasks: 137 total, 4 running, 132 sleeping, 0 stopped, 1 zombie
Cpu(s): 49.7%us, 50.3%sy, 0.0%ni, 0.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 1016076k total, 938688k used, 77388k free, 25896k buffers
Swap: 3069948k total, 23140k used, 3046808k free, 584956k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1733 stephani 20 0 0 0 0 Z 46.7 0.0 52:34.34 transmiss <defunct>
Transmission has being running for almost 60 minutes and is consuming a very large amount of the CPU.
View 8 Replies
View Related
Oct 9, 2010
I want to capture PID of a program and kill it using the PID if the program is been executing beyond 5 seconds.The problem I'm facing is I have another copy of the same program running under different shell script, and the above code is killing both the process. How do I specifically kill the program which has started under the current running shell script.
View 2 Replies
View Related
Dec 21, 2010
i have recently started a bit of sh coding. i was trying out sm commands from an sh file.
#!/bin/bash
txt1="top > temp.txt"
eval $txt1
[code]....
View 14 Replies
View Related
Aug 23, 2010
I tried to stop mysqld deamon. It failed
Code:
[zabbix@CDCTGIMCLSA ~]$ sudo /etc/init.d/mysqld stop
Stopping MySQL: [FAILED]
[code]....
View 14 Replies
View Related
May 31, 2011
Possible 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?
View 2 Replies
View Related
Sep 7, 2010
In the comments section of this blog, the commenter "Pratik" claims that you can edit a running bash script, without killing it, and have the changes picked up by the running script. He claims you can do this by editing files in /proc. Now, I know how to find the /proc folder that contains the data on the running process, Code: cd /proc/`pgrep process_name` But I can't figure out what I should do if I want to edit a running bash script.
View 6 Replies
View Related
Apr 9, 2011
I'm running a process on my university's supercomputer that takes several hours to run every time. Is there a command I can use to exit my ssh session without killing the process I'm running?
View 1 Replies
View Related
Jun 21, 2010
I am trying to kill child process without killing the parent and seem to be having issues doing so. I have tried quite a few different commands and the end result is either killing all of them including the parent or not killing them at all.
View 1 Replies
View Related
May 9, 2010
I haveing a big problem atm (just after to upgrade to 10.04). I have a simply and easy script that sent a halt command to every KVM virtual machine actually running into the server. this script is/and was) palced as a init-rc script in rc0/rc1 and rc6 lvls. Just after to upgrade, I have noticed that this script is executed but the system ignore the time that it require to finish (giving time to correctly stop a single virtual machine). Aftert 5 second it start sending SIG-TERM and SIGN-KILL to any currect process and then reboot/halt.
I have just done a new script using upstart and I got just the same result. What is happending? why is the waiting the init secuence for a valid/or_not termination of any init script. I am so sorry for this crap english I have never study this language so I try to do my best anytime I speak it (or try ti..).
View 9 Replies
View Related
Nov 9, 2010
I have a shell script to identify whether the process is running or not. If the process is not running, then I execute another script file to run my application. Below is my script and saved this script as monitorprocess.sh Code: #!/bin/bash
result=$(ps -ef | grep -v grep | grep "applicationname.sh" | awk '{print $2}')
echo $result
if [ "$result" == "" ];
[code]...
View 4 Replies
View Related
Jan 28, 2010
Is is possible to move a process from one shell to another (local to remote)
e.g.
if
my_code.sh &
#jobs
[1]- Running my_code.sh &
was started on one remote shell is it possible to move it to the foreground on another shell as root or another user?
View 5 Replies
View Related
Apr 1, 2011
I write a script to read a file which is something like a pipe (or) queue , which shows the running status.In normal case, if i open this file with cat command, i have to use ctrl+c to exit this . What command shall i use to do the same inside a shell script ? I have tried ^C in my script , but it does not exit the process.
View 6 Replies
View Related
Jun 25, 2010
I have an Ubuntu server in which a file is dumped every hour and a new file for the next hour and the process continues. If there is any problem due to which the creation of file stops then empty files are created every minute till the process is killed & started again. I need help to make a shell script to check if the empty files are being created and then kill the process and start it again.It would be a great help if anyone can help me regarding this.
View 9 Replies
View Related
May 26, 2010
I need to process billions of small files using bash shell commands with limited memory size (256MB). If any of those files contain certain "keywords", the file will be removed. I tried with command:
find . -type f -exec grep -i -l -H "keyword" '{}' + | xargs rm -rf
where all files are located within the current directory. But the command above failed in "out of memory".
View 1 Replies
View Related
Aug 10, 2010
I have some heavy, long processes running on remote Linux machines. I use my laptop to SSH to these machine and run the processes from my couch.
BUT, when I want to shutdown my laptop, I am in trouble since the remote processes are killed.
I did my research and found out that "screen" is a great solution for me, it is! (As long as I don't SHUTDOWN my laptop). Isn't there a way to "persist" the "screen" sessions so I can shut it down and then re-attach to a session?
View 7 Replies
View Related
Jul 19, 2010
I install the antivirus, ClamAV, onto a RedHat 4.8 box (yes it has to be that release of the OS to work with my other software needs) and after the install and giving the permissions to another user/group dedicated to this AV I get a ton of errors. After the install a few things pop up after a restart/logout. When trying to log back in the Gnome environment crashes so you cannot access any acct aside from using the text based environment. Two other error windows appear as well, one mentioning Bonobo has died and the other saying that Nautilus cannot be started due to Bonobo. I'm not too familiar with Bonobo can anyone fill me in on why those errors occured?
View 2 Replies
View Related
Jun 15, 2010
user@host$ killall -9 -u user Will it definitely kill all processes owned by user (including forkbombs)?
No new processes is spawned to user from other users. No user's processes are in D-sleep and unkillable.No processes are trying to detect and ptrace or terminate this started killall (but they can ptrace or do other things with each other) There is ulimit that prevents too much processes (but killall is already started and allocated it's memory)
E.g. if killall will finish untampered and successfully is it 100% that no processes are left with this uid? If no, how to do it properly (with standard commands and no root access). Will SysRq+I definitely kill all things (even replicating)?
View 2 Replies
View Related
Nov 14, 2010
My server pretty often becomes full up php processes running which are not needed. Is there a way to search for and kill any php process that is more than 3 hours old?
View 7 Replies
View Related
Nov 15, 2010
My server pretty often becomes full up php processes running which are not needed.Is there a way to search for and kill any php process that is more than 3 hours old? as I understand it, i need to use ps piped with awk. awk at the moment seems very complicated to me, do not how to start tackling it.
View 5 Replies
View Related
May 2, 2010
as the tags suggest, i'd like a fresh install of linux using grub2, and partition my harddrive
View 3 Replies
View Related
Jun 9, 2011
I'm building a Linux From Scratch system and partially automating it. I will likely want to do it again, and I would like to try to almost completely automate it.
My current approach is a script that takes an input file and sequentially runs each line in a new instance of bash. If one fails, it gives me the number of the step that failed so that I can use the "--step" option to resume after I fixed the issue.
This has some problems:
A varible created on one line will not be accessible on the next line. This is because each line is run in a separate shell (the reason for this is so that the commands in the input file and the script's internal variables can't interfere). You can't switch users or use chroot, again because each line is run in a separate shell.
What would be nice is to be able to start a bash process in the background and send commands to its stdin. I guess that a named pipe would work, but the named pipe will be gone after a chroot. Is there a way to do it without relying on the filesystem? Also, how do I know if the command failed?
View 14 Replies
View Related
Jun 1, 2009
I use tcl-expect script to ssh to the server. How can I eliminate the first 2 lines if using system(./script.sh) to execute it, as the default output will be shown on shell and the first 2 lines are included.
Essentially I just want to have the "ps" result, not the login process. code...
View 1 Replies
View Related
Nov 19, 2009
Is it possible to have an Expect script spawn an SSH session, log in, then go into interactive mode and give control of the SSH session to a Bash script? Here's a simplified example of the script so far:
Code:
#!/bin/bash
expect -c "
[code]....
View 4 Replies
View Related
Mar 29, 2010
I need show the number of process per user, and after the date of the oldest process per user also.
With "ps -eo user | sort -u" i get all users that are running any process. And with "ps U username | wc -l" i get the number of process that the user "username" is running.
But how can i merge both commands for do what i need? Like a FOR or something like that. There is any method of make a FOR using the list that i get with the first command?
And then for show the date of the oldest process.. with "ps U username | sort -k 4" (4 is TIME field) i can show the process of the user "username" sorting they by time. But how can i get the date of the process takes longer running?? I can get only the time, but no the date.
View 9 Replies
View Related
May 21, 2010
I am trying to write a shell script in order to automate the process of uploading a file onto an FTP server using the built in FTP commands in ubuntu server (lucid). In order to connect I can use the following:
Code:
ftp wsbeorchids.org.uk
Name (wsbeorchids.org.uk:danielgroves): USERNAME
Password: PASSWORD
In need to pass my username and password in when prompted the prompts. How should I go about doing this? I have tried echoing the values without success. Please not that I am something of an amateur with scripting.
View 6 Replies
View Related
Jan 8, 2010
one tell me the internal working of kill command. that is how it kills a process internally or from where it picks file to continue its process.
View 3 Replies
View Related
Jan 21, 2011
I have a high priority service that I start with sudo nice -n -10 process. This process does not need superuser rights though, except for the priority elevation. But nice requires superuser privileges to elevate priority.
View 3 Replies
View Related
Jun 12, 2010
send the details raid configuration how to use in linux el5 and how to indentify the raid degrade process and how to rebuilt the process.
View 4 Replies
View Related