Search Results

Search: Posts Made By: nbsparks
8,569
Posted By Don Cragun
With the sample input shown in the 1st message in...
With the sample input shown in the 1st message in this thread the awk program I provided produces the output:
2013-09-20 09:55:28 [INFO] [Wither] Enabling Wither v2.0
2013-09-20 09:55:28 [INFO]...
8,569
Posted By Don Cragun
I was just confused because you said you wanted...
I was just confused because you said you wanted 10 lines of context before the SEVERE line, but your sample output provided 8 lines instead of 10.

The following awk script seems to do what you...
8,569
Posted By Don Cragun
You said you want 10 lines before the line...
You said you want 10 lines before the line containing SEVERE, but your sample output only shows 8 lines. Is there a reason why the lines:
2013-09-20 09:55:28 [INFO] [Wither] Enabling Wither v2.0...
8,569
Posted By Don Cragun
You dropped the single quote ending the awk...
You dropped the single quote ending the awk script. Change the last line in test.sh from:
} /home/mc/servers/bukkitpvt/server.logto:
}' /home/mc/servers/bukkitpvt/server.logand try again.
8,569
Posted By Don Cragun
The set -x shows you the command the shell is...
The set -x shows you the command the shell is running; it does not trace commands running inside awk.

I'm grasping at straws here. Try changing the lines in my script:...
14,065
Posted By RudiC
Does your date allow for the -d option:date...
Does your date allow for the -d option:date -d"-1day"
Mi 18. Sep 19:46:18 CEST 2013
or even date -dy y meaning yesterday.
14,065
Posted By gacanepa
Just adding my 2 cents here. Since we're still...
Just adding my 2 cents here.
Since we're still 10 days from the end of the month, you could temporarily change the date and time of your system to perform your test in advance:
date --set="1 OCT...
14,065
Posted By RudiC
Why shouldn't above work across month ends? Run...
Why shouldn't above work across month ends? Run it today with -d "-20 days" to test.
3,436
Posted By Corona688
I put it in a trap so that, if you ctrl-C this or...
I put it in a trap so that, if you ctrl-C this or it gets KILL-ed, it still gets rid of /tmp/overviewer.pid

The trap command is meant to respond to software interrupts ( giving it a chance to...
3,436
Posted By Corona688
That's why you save it in a PID file, so you know...
That's why you save it in a PID file, so you know what to check.

#!/bin/bash

if [ -f /tmp/overviewer.pid ] && read PID < /tmp/overviewer.pid && ps "$PID" >/dev/null 2>/dev/null
then
...
3,436
Posted By Corona688
This is what PID files are generally used for. ...
This is what PID files are generally used for.

When you start the first process, save its PID into a file in /var/run/processname.pid to check later.

Next time you want to start another, check...
3,436
Posted By Corona688
That is not a pipe, that's a file redirection. |...
That is not a pipe, that's a file redirection. | is a pipe.

And yes, # Automatically append stdout to this file
exec 1>>/home/mcmaps/scripts/overviewer.log

That opens the file once in advance...
9,845
Posted By Scott
grep -f white-list.txt server.log ...
grep -f white-list.txt server.log

white-list.txt:

player1
player2
player3
player4
player5
player6
9,284
Posted By Don Cragun
I'm glad you were able to get your script...
I'm glad you were able to get your script working.

About 12 minutes after you posted the first message in this thread, you changed the thread's Title from Making a script to copy files not seen...
9,284
Posted By Don Cragun
You could try changing: cd $SRC for f in * ...
You could try changing:
cd $SRC
for f in *
do
FMD5=$(md5sum $f)
grep -q $FMD5 $MD5
if [[ $? -ne 0 ]]; then
cp $f $DST
md5sum $f >> $MD5
fi
done
in your script to something...
9,284
Posted By spacebar
You seem to have it: for f in $SRC/* do ...
You seem to have it:
for f in $SRC/*
do
grep -q $f $MD5
if [[ $? -ne 0 ]]; then
cp $SRC/$f $DST
md5sum $f >> $MD5
fi
done
9,284
Posted By spacebar
You can check if the file name is in your 'md5'...
You can check if the file name is in your 'md5' file and if not copy it:
for f in $SRC/*
do
grep -q $f md5_files.txt
if [[ $? -ne 0 ]]; then
cp $SRC/$f $DST
fi
done
9,284
Posted By gacanepa
First off, I'm a little confused why you're...
First off, I'm a little confused why you're getting an error after running copy.sh but the error points to another file (copy2.sh). Do you have 2 script files?
The error message you are getting...
9,284
Posted By gacanepa
There you go. Refer to this line: + grep -q...
There you go.
Refer to this line:
+ grep -q /hd1/home/nick/test1.md5
The fact that the script stops there (and the fact that the command is incomplete) tells us that the error is in the previous...
9,284
Posted By gacanepa
This will do the trick: #!/bin/bash set -x ...
This will do the trick:
#!/bin/bash
set -x

# The source directory where the photo folder on the phone is mirrored to
SRC=test1

# The destination directory where we want to copy only new...
9,284
Posted By gacanepa
If you do this: ...
If you do this:
SRC=/hd1/home/$USER/.phonesync/photos-backupThen
DST=/hd1/home/$USER/.phonesync/photos-newAnd if your for loop is initialized like this:
for f in $SRC/*The copy command cp $SRC/$f...
9,284
Posted By Don Cragun
The "why not" was explained in message #8 in this...
The "why not" was explained in message #8 in this thread.

But, even if this idea would work, the code presented above would not; $f consists of the expansion of $SRC a slash and filename where...
3,090
Posted By Just Ice
[root@centosgeek ~]# cat testfile4 2013-08-07...
[root@centosgeek ~]# cat testfile4
2013-08-07 18:13:16 [SEVERE] Reached end of stream for /127.0.0.1
2013-08-07 18:13:17 [SEVERE] Reached end of stream for /127.0.0.1
2013-08-07 18:13:19 [SEVERE]...
3,090
Posted By MadeInGermany
This deletes the first line and the corresponding...
This deletes the first line and the corresponding line (searched in the next 2 lines in order to allow another log entry in between).
awk '/\[SEVERE\] Reached end of stream for \/127\.0\.0\.1/ {c=2;...
3,107
Posted By bartus11
echo `date +"%m-%d-%y"``grep eth0 /proc/net/dev |...
echo `date +"%m-%d-%y"``grep eth0 /proc/net/dev | awk '{print ","$2/1024/1024","$10/1024/1024}'`>>test.log
Showing results 1 to 25 of 26

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