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.
I have a requirement where I want to extract the full name of the process running in my box. I tired various options of ps. The wide option gave me the full command but that contains command, the interpreter and also the arguments passed.
Code:
XX XX XX XX XX XX /usr/bin/sh /path/to/exe/myexe.sh arg1 arg2 arg3.
Is there any way from ps or any other command I can extract the full name of the command
I need a help regarding ,how to shutdown the running process using C program?..here i attached the porgram to shutdown the system by c program is there any possible to change in this program to shutdown the process?
I have p1,p2,p3,p4 some processes created by me in C. p1, p2, p3 are started individually from several consoles. And I want process p4 to terminates processes p1, p2, p3 if they are running. Which is the easiest way to accomplish that? put all processes in the same process group and send from p4 a kill signal to the group. But I couldn't do that because I cannot call successfully setpgid(getpid(), 15000) from p1-p4. It's there some way to put them in the same group? the processes don't have a child-parent relationship, they are launched manually from consoles.
I am working in HP UNIX. I have one process which is running continuously.There is log file generated for the process. I want to take back up of file without loosing any logs after particular interval of time or say file size increases more that 1GB.
It's called TextRipper and it creates indexable and editable text files from any image. Feel free to copy TextRipper; it's licenced under GPL. My troubles are with cracking passworded pdf's. (As you can see, I meant any when I said any image.)
I can't find a way for the user to cancel the decryption process by exiting the script without pdfcrack orphaning. Line 349 works the rest of the time; the concerned process is line 228. I believe it's a piping/subshell problem. At least that's how I've been going at it in vain.
I've made portability a priority and that the comments still require updating.
Code:
If the result is one output file, TextRipper will open it for you in OpenOffice Writer.
Otherwise all txt output files (editable and indexable) will be in the original file's directory." 0 0
I have an ubuntu 10.10 server and want to run a script on it to check if a process is running. If it is not running, it will start the process and also write into a log file.
When running the script i get the following error message:
Assume someone bind a particular process to a particular CPU core(In multi core machine) by using sched_setaffinity() like functions. Then how we can get that process running core id and CPU core utilisation of that process on that running CPU core(Pragmatically or by a Linux command)?.
Sometimes I connect to my Debian box from another computer (using SSH on Cygwin or Linux), and once ina while I want to run some console apps. And sometimes some of these apps might complain about "another intance, Error: an instance of newsbeuter is already running (PID: 2496)". Is there a work around for this issue at all(without killing the original instance") ? The reason I do not want to kill the app because there might be 2 users connected to the same machine that might be using the same app.
I am new to unix, I am looking for a script to delete files older than 7 days but i also want to exclude certain directories (like arch,log .....) and also some files with extensions ike .ksh, .ch, ..............) in directories and sub directories
Is there any way a non-root user can programmatically determine which days the computer ran during, say, the last month?
The information is in /var/log/messages.* but those files are root:root 640.
Non of the world-readable /var/log files on the Slackware 13.0 development system can be used:boot Not present if boot logging not enabled (default). dmesg No timestamps. lastlog Not enough info. wtmp Rewritten on each boot so not enough info. EDIT: not correct: by default wtmp is rotated weekly and kept for one month as configured in /etc/logrotate.conf xdm.log Not present if xdm not used. Xorg.0.log Not present if X not run.
I got this part from my script working that it will delete a folder is from 8 days agoEightDaysAgo=`(date --date="8 days ago" +%d-%m-%Y)`rm -rf $EightDaysAgoTarHowever I need to remove files that are older than 8days for example if the script is'nt run for a day it will remove both the 9th and 8th day one not just the 8th day one. If I'm making any sense lol
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
Is there any difference in cpu usage for process in init.rc(runs automatic when boot is happened) and manually running process. Will these both have same priority by default...?
I tried googling but didn't get any answer for this.I have a process called "abc" and it is running with PID "123".I have a putty session opened with PID "999".I am giving kill -TERM 123 from putty session.My process "abc" before dying it should catch the PID of the terminal which provided TERM signal to it.Is there any way to find this out
I'm running GNU Emacs 23.1.1 on "Ubuntu 10.04.1 LTS" and any search I perform using the built-in M-x rgrep on the standard Linux kernel source code (vanilla) ends prematurely with the following error printed to the emacs echo area:Grep exited abnormally with code 123.I have been seeing it for a while on Redhat systems as well, and with other (large) code bases.
I am trying to monitor how long an ldap search takes and maybe notify or something that a search takes longer than say 10 seconds.
Code: tail -n 1000 /var/log/ldap.log for SRCH in $( cat monitorldap.log |grep 'SRCH'); do echo search string is echo $SRCH
[Code]....
ok, so to start off with it doesn't appear to get the whole line, just a piece "Aug". How can I get the whole line into a variable so I can then cut it up into the pieces I need?
I'm using Zabbix on which I can use give bash command to the agent.This 1-liner will give me all the interfaces with their IPv4 addresses.I have a 2nd expression which returns a checksum so I can detect a difference whenever someone deletes/adds/changes an ipv4 interface.This is the output on my Ubuntu-server:
1) I need to search a field value to check for exact 0. If the number is 0, it should throw error.
The line to be searched looks like as below. "Output Rows [1], Affected Rows [1], Applied Rows [1], Rejected Rows [0]"
Here I have to search whether the affected rows is 0. But the code below picks up other values also (lie 10, 20.. etc). How do we write to get an exact match for 0? Code: affected=`echo ${line} | cut -f6 -d" " `
affectedcount='echo ${affected} |grep 0 ` 2) Also, I need to check whether the rejected rows > 0 Code: rejected=`echo ${line} | cut -f12 -d" " ` rejectedcount='echo {rejected} |grep [1-9]`
3)Can we combine these two statements in a better way to get the desired results?
I want to see if all the records in the file are present in the contents of the files of a particular directory.
Basically I want to say if grep doesn't return anything, then report.
For example in /tmp dir I have 4 files and flast 2 values (787862348 and 766428634) are present in the files of /tmp dir, but first one (979798707) is not. I want to echo that in a reporting file.
something like:
while read line do # if ! grep -rl $line /tmp echo $line >> are_not_present done < "myFile"
How do I achieve " if ! grep -rl $line /tmp"? That is, if the line is found by grep, then grep will print the output, but if grep does'nt find it, it will print nothing. How can I check if grep didn't find it (i.e. printed nothing)?
I'm just starting out with bash scripting (yesterday, really). I want to add a file to each user's home directory, pretty simple really, and send it out via our Apple Remote Desktop system to our Macs. Here is my script: Code: #!/bin/bash
for i in $(ls -d /Users/*) doif [ -e $i/.tcshrc ] thenecho "$i/.tcshrc exists!"elseecho "$i/.tcshrc does not exist"