Search Results

Search: Posts Made By: anil510
1,191
Posted By anil510
Watch a directory for files with a pecific pattern
I dont know if this possible. I need to watch a directory and if any file gets appeneded with a particular entry say, nologin.php, we should get output of that.
4,800
Posted By anil510
Thanks. Its centos an d no etimes available....
Thanks.

Its centos an d no etimes available.


# man ps | grep etime
during the entire lifetime of a process. This is not ideal, and it does not
%t etime ELAPSED
4,800
Posted By anil510
Get how much time process has been running in seconds
I use this command to get the time elapsed for a process

ps -eo pid,pcpu,pmem,user,args,etime,cmd --sort=start_time | grep perl

It gives in format

19990 0.0 0.0 user /usr/bin/php ...
1,803
Posted By anil510
Thanks it worked.
Thanks it worked.
1,803
Posted By anil510
Print after colon
I have entries like below in a file

11.22.33.44:80
22.33.44.55:81
:::587
:::465

What I need is to take out the part after colon ( : )
Output should be as follows.

80
81
587
465


I...
1,329
Posted By anil510
Process to read a new file entry and execute a command
I need to develop a process/daemon which will constantly monitor a file for new entry and execute a command.

for eg, there is a file /var/log/inotify.log

When a new entry like below gets...
1,917
Posted By anil510
I have modified to /bin/sh and changed script to...
I have modified to /bin/sh and changed script to 755. Still same result. I am using ssh keys between servers.


# cat /root/yesno.sh
#!/bin/sh


-rwxr-xr-x 1 root root 116 Feb 20 05:17...
1,917
Posted By anil510
Run yes/no script remotely
I have this script in server2



[root@server2 ~]# cat /root/yesno.sh
#!/bin/bash

read -p "are you sure?" -n 1 -r

if [[ $REPLY =~ ^[Yy]$ ]]; then
echo ""
echo "YES"
else...
1,249
Posted By anil510
Thank you all. It works pefectly.
Thank you all. It works pefectly.
1,249
Posted By anil510
sed match exactly and delete
I am using following sed rule to delete 2 lines after a pattern match inclusive.


[root@server ~]# cat /tmp/temp.txt
dns.com
11
22
mydns.com
11
22
dns.com.au
11
22
LAST LINE...
797
Posted By anil510
Thanks Vbe, It works very fine.
Thanks Vbe, It works very fine.
797
Posted By anil510
Not able ot collect perldoc output to a file
I need the output of perldoc command collected to a file


[root@ser]# perldoc -l File::Scan::ClamAV > /usr/src/asas.txt
No documentation found for "File::Scan::ClamAV".

[root@ser]# cat...
3,105
Posted By anil510
Thanks Don, I am checking that only now. ...
Thanks Don,

I am checking that only now.

---------- Post updated at 07:40 AM ---------- Previous update was at 07:28 AM ----------

It describes the usage of inotify_add_watch with a c...
3,105
Posted By anil510
Dynamically add paths to inotify
I have initiated an inotify process with --fromfile option and the file contain the paths to be monitored.


/usr/local/maldetect/inotify/inotifywait -d -r -o...
1,545
Posted By anil510
I have found the solution. ...
I have found the solution.


multimalcron=`grep -rl maldet /etc/cron* | grep -v maldet_daily`

if [ "$(echo $multimalcron)" ]; then
echo " Multiple maldet cron found: echo...
1,545
Posted By anil510
Almost fine it seems. But not the real result. ...
Almost fine it seems. But not the real result.

root@server [~]# grep -rl maldet /etc/cron*
/etc/cron.d/maldetweekly
/etc/cron.d/maldet_daily
/etc/cron.d/malcron
root@server [~]# A=`grep -rl ...
1,545
Posted By anil510
R singh, Sorry, Its not working
R singh, Sorry, Its not working
1,545
Posted By anil510
Print if found non-desired result
I have a result like this


root@server [~]# grep -rl maldet /etc/cron*
/etc/cron.d/maldet_daily
/etc/cron.d/malcron
/etc/cron.d/malcrondaily
/etc/cron.d/malcronweekly


What I need is, I...
2,112
Posted By anil510
Scrtinizer, It worked thanks
Scrtinizer,

It worked thanks
2,112
Posted By anil510
Partial variable substitution in script
I have a script.


filecreatenew () {
touch /usr/src/$1_newfile.txt
var=$1
echo $var
touch /usr/src/$var_newfile_with_var.txt
}

filecreatenew myfile

...
1,370
Posted By anil510
Thanks rubic and junior-helper. How can we insert...
Thanks rubic and junior-helper. How can we insert to file using awk, ie similar to sed -i
1,533
Posted By anil510
Binary1 its working fine. Thanks
Binary1 its working fine. Thanks
1,370
Posted By anil510
Add comment if not present
I have a file


cat /root/file
#import node1
#import node2
import node2
import node4


After sed/awk operation the file should be as follows


cat /root/file
#import node1
#import...
1,533
Posted By anil510
Complex positioning
I got these entries in a file


alias server.domain.com='ssh 192.168.1.1@user1 '
alias server1.domain.com='ssh user2 @192.168.1.1'
alias server1.domain.com='ssh user3@192.168.1.1'


In the...
753
Posted By anil510
Selecting groups
I have a file with contents like


host1.domain.com:9090,host2.domain.com:9090,host3.domain.com:9090


I am looking for such an operation so that, the output should be

host1.domain.com:9090...
Showing results 1 to 25 of 100

 
All times are GMT -4. The time now is 11:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy