We are not using different Linux distros. I am using a UNIX system where the output produced by the ipcs utility follows the formatting requirements specified by the standards.
If what you are trying to do is to remove message queues, shared memory segments, and semaphore sets that you own, the problem you stated in this thread seems to be useless. If you save the following script in $HOME/bin/cleanipc:
and make it executable using:
then the command:
it will show you an ipcrm command that will remove all shared memory segments and semaphore sets owned by "bob". If that looks like what you want to do, remove the echo shown in red in the script to have the script actually remove those IPC facilities.
Use different (or no options) on the ipcs command to process just message queues (-q), just shared memory segments (-m), just semaphore sets (-s), or everything (no options).
Note that the above script will NOT work on any system where the output produced by ipcs conforms to the standards. If your ipcs produced standard format output, the following code in the above awk script:
would be replaced by:
Does my ipcs conform to standards? How do I know if it conforms to standards? The first method worked.
Is my understanding of this correct? After Shared is matched. Then it runs what is in {}. Then the next makes it read the next line? It ignore the Message block and Semaphore block until the column 2 is matched? It then goes to ^0x block? The process starts back over on the next line?
Can you please explain this part? I know you are anchoring the 0 to the beginning, then you making sure column 3 matches user which has been set to bob.
Did I do this right? I replaced everything in the single quotes ' '. It looked like you needed to keep the first part. I thought my ipcs conformed to standards but the first method worked.
Thank you for your very detailed explanation. I wouldn't have remembered to use the bin directory.
hi,
i have a script that runs on bash and would like to run it on a machine that has csh and bash. the default setting on that machine is csh. i dont want to change my code to run it with a csh shell. is there any way i can run the script (written in bash) on this machine? in other words is there... (3 Replies)
If I have a script like this:
while true
do
wget www.***.com >> file
sleep 3600
done
Is it possible to upload it to a webhost and have it run indefinitely.
I have a hostgator account. How do I do this? (1 Reply)
There's a JavaScript file that I call from command line (there's a framework) like so:
./RunDiag.js param1:'string one here' param2:'string two here'
I have a shell script where I invoke the above command. I can run it in a script as simple as this
#!/bin/bash
stuff="./RunDiag.js... (4 Replies)
Hi,
I would like to run following code in bash inside a zsh script. (In this case is output unfortunately very different if you run it in zsh).
I tried to put "bash" in front of the code but I obtained following error message "bash: do: No such file or directory
" eve though I merged the whole... (7 Replies)
How to run several bash commands put in bash command line without needing and requiring a script file.
Because I'm actually a windows guy and new here so for illustration is sort of :
$ bash "echo ${PATH} & echo have a nice day!"
will do output, for example:... (4 Replies)
Hi everyone,
I want to kill process through the web, so I create html page with single bottom that run kill command in shell script with CGI.
Here is html code:
<td><form METHOD="GET" action="http://IP:port/cgi_bin/script.cgi" > <input type="submit" value= "Submit" > <INPUT name="q"... (7 Replies)
Hi,
I downloaded source code file from The GNU website and changed the source code of ls.c file, added printf command to it. It worked fine. Then, I deleted the printf command, saved the file and ran the command 'make sudo && make install' closed the terminal and printf statement went away.
I... (1 Reply)