Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Related Tools

Notices

Reply
 
Thread Tools Search this Thread
Old 02-04-2016, 10:55 AM   #1171
mariosipad
Addict
mariosipad knows the difference between 'who' and 'whom'mariosipad knows the difference between 'who' and 'whom'mariosipad knows the difference between 'who' and 'whom'mariosipad knows the difference between 'who' and 'whom'mariosipad knows the difference between 'who' and 'whom'mariosipad knows the difference between 'who' and 'whom'mariosipad knows the difference between 'who' and 'whom'mariosipad knows the difference between 'who' and 'whom'mariosipad knows the difference between 'who' and 'whom'mariosipad knows the difference between 'who' and 'whom'mariosipad knows the difference between 'who' and 'whom'
 
Posts: 225
Karma: 10372
Join Date: Nov 2012
Device: iPad & iPhone with Marvin & Kobo Glo HD
Comparing different versions of the OS (Mint/Debian) and apache (2.2/2.4) I found that file names, content (what is in which file), order of statements in files, etc. can an will change.

However basically the functionality more or less remains the same. It's sometimes just confusing when comparing files from different PC's each with their own version of the OS and web server.

Regarding your "problem": could your installation of OwnCloud have something to do with it?
However it does not really matter to which log file Apache writes. Just use what Apache serves you.

I'm convinced your approach will work for you.
Maybe just search for "/cops/ " (space is intentional or "/cops/$)" ) instead of "getJSON".
mariosipad is offline   Reply With Quote
Old 02-04-2016, 06:17 PM   #1172
teejcee
Enthusiast
teejcee began at the beginning.
 
Posts: 33
Karma: 10
Join Date: Mar 2012
Location: Sydney, Australia
Device: Kindle 3G & Paperwhite
@mariosipad

I'll keep looking again today when time permits.
'Won't have a lot of time as I'll have my grandson here & he'll be wanting attention...as they do.

Cheers,
TC
teejcee is online now   Reply With Quote
Old Yesterday, 11:20 PM   #1173
teejcee
Enthusiast
teejcee began at the beginning.
 
Posts: 33
Karma: 10
Join Date: Mar 2012
Location: Sydney, Australia
Device: Kindle 3G & Paperwhite
@mariosipad

I've finished my script, again with help from my mate, Garry.

Code:
#!/bin/bash
# email log entries of COPS users for previous 24 hours

DATE=$(date +%d-%b-%Y)
LOGFILE=/var/log/apache2/other_vhosts_access.log

cd ~/bin
# get logins  200 2183 are username/password logins
#             200 2328 are 'cached' connections

grep -e "200 2183" -e "200 2328" $LOGFILE > cops-log.txt

#   Get fields from cops_log to show user logins.

LOGFILE=cops-log.txt
TMPFILE=tmp.$LOGFILE

rm -f $TMPFILE 2> /dev/null

cat $LOGFILE 2> /dev/null | while read LINE
do
  IP=$(echo $LINE | cut -f2 -d' ')
  USER=$(echo $LINE | cut -f4 -d' ')
  DATETIME=$(echo $LINE | cut -f2 -d'[' | cut -f1 -d']')
  DATE=$(echo $DATETIME | cut -f1 -d'+')
  echo "$DATE $USER $IP" >> $TMPFILE
done

if [[ ! -s $TMPFILE ]]
then
  echo "There is no data to report." >> $TMPFILE
fi

cat $TMPFILE | mail -s "Today's COPS users $DATE"  me@myemail-addy

rm -f $TMPFILE 2> /dev/null
Once it's been running a while & I'm happy with it, I'll write temp files
out to /tmp

The grep command pulls entries with http status code 200 & return bytes
of either 2183 or 2328. I have no idea what these byte sizes are made up of, only as I've commented in the code.

Any questions...fire away.

Cheers,
TC
teejcee is online now   Reply With Quote
Old Today, 06:14 PM   #1174
mariosipad
Addict
mariosipad knows the difference between 'who' and 'whom'mariosipad knows the difference between 'who' and 'whom'mariosipad knows the difference between 'who' and 'whom'mariosipad knows the difference between 'who' and 'whom'mariosipad knows the difference between 'who' and 'whom'mariosipad knows the difference between 'who' and 'whom'mariosipad knows the difference between 'who' and 'whom'mariosipad knows the difference between 'who' and 'whom'mariosipad knows the difference between 'who' and 'whom'mariosipad knows the difference between 'who' and 'whom'mariosipad knows the difference between 'who' and 'whom'
 
Posts: 225
Karma: 10372
Join Date: Nov 2012
Device: iPad & iPhone with Marvin & Kobo Glo HD
@teejcee

Hmm, I never thought that I would learn something about scripting by using COPS

I copied and installed your script into a debian/apache setup.

Out of the box it did not work so I "debugged" a bit.

Herewith my preliminary findings:

0 - I changed other_vhosts_access.log to access.log

1 - Using the line grep -e "200 2183" -e "200 2328" $LOGFILE > cops-log.txt didn't work for me.
a - neither 2183 nor 2328 showed up in my log file. But this was easily fixed with other (for me) matching numbers.
b - Logging into COPS with OPDS gave other numbers than logging into COPS from a browser. Did you take this into account in your script?
c - are you sure that one of these numbers isn't our old friend getJSON and double login log entries?

2 - Writing to TMPFILE did not get the desired result. I "blame" this on:
a - using another log file with a slightly different layout
b - Debian vs Mint date/time formatting (maybe?)
However even this was fixable with a lithe googling. Hey, I even learned something today!
How is the output to look like in your case? Just so I can compare.

3 - I did not (yet) use the mail functionality.

Greets

Mario
mariosipad is offline   Reply With Quote
Reply

Tags
calibre opds, kobo aura, synology

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Old Thread] Android FBreader and Calibre OPDS server question kalex Calibre 5 12-24-2015 11:16 PM
PHP+Apache web server for calibre ... chaley Related Tools 254 04-28-2014 09:18 PM
External OPDS catalogue in Calibre bolton Calibre 1 09-05-2012 07:14 AM
Calibre OPDS server with windows apps? nickdma Related Tools 9 02-02-2011 04:09 PM
Calibre Command Line usage with PHP artoros Related Tools 13 07-01-2010 10:57 AM


All times are GMT -4. The time now is 07:21 PM.


MobileRead.com is a privately owned, operated and funded community.