Results 1 to 7 of 7
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 ...
- 09-07-2010 #1
Alter a running process without killing it
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,
But I can't figure out what I should do if I want to edit a running bash script.Code:cd /proc/`pgrep process_name`
Can anyone help me with this?Registered Linux user #388328 || Registered LFS user #15880
AMD 64 X2 4600+ :: 2X1GB DDR2 800 :: GeForce 9400 GT 512MB :: ASUS M2N32 Deluxe :: 4X250GB SATAII
Need instant help? Try us on IRC -- #linuxforums on freenode
- 09-10-2010 #2
I guess this is a bit high-level for most folks (including me)

Ah well. Thanks for reading
Registered Linux user #388328 || Registered LFS user #15880
AMD 64 X2 4600+ :: 2X1GB DDR2 800 :: GeForce 9400 GT 512MB :: ASUS M2N32 Deluxe :: 4X250GB SATAII
Need instant help? Try us on IRC -- #linuxforums on freenode
- 09-10-2010 #3Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
You can do most anything with Linux, including this, but the gating factor in this case is "how fast can you type?"...

So, what is the problem you are really trying to solve?Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 09-10-2010 #4
SIGHUP will initiate graceful restart, meaning configuration files are re-read. Is this what you want?
- 09-10-2010 #5
/proc/<PID>/cmdline
It's the command line right there, never tried to alter it.
Why don't you try and tell us?
- 09-10-2010 #6
Thanks guys.
Segfault: I tried your suggestion, but it appears that file is unwriteable.
Maybe the guy who made the original comment was just lying?Registered Linux user #388328 || Registered LFS user #15880
AMD 64 X2 4600+ :: 2X1GB DDR2 800 :: GeForce 9400 GT 512MB :: ASUS M2N32 Deluxe :: 4X250GB SATAII
Need instant help? Try us on IRC -- #linuxforums on freenode
- 09-11-2010 #7
procfs is for getting information about running processes. I believe that it is mostly read-only, and that you cannot modify processes through it. Indeed, according to the proc man page:
Having said that, it is possible to modify running processes by using a system call called ptrace, which is how gdb works. ptrace allows you to access and modify the memory and registers of a running process. However, doing so meaningfully can be very difficult.The proc filesystem is a pseudo-filesystem which is used as an interface to kernel data structures. It is commonly mounted at /proc. Most of it is read-only, but some files allow kernel variables to be changed.
I cannot see the comment thread of the entry that you posted, but I've certainly never heard of modifying a process through procfs, and even doing so via ptrace would be quite difficult.DISTRO=Arch
Registered Linux User #388732


Reply With Quote