Re: cron update of database

"Ben Carlisle" <[email protected]> Sun, 14 Sep 2003 17:28:29 -0500
Newsgroups gmane.comp.audio.netjuke.user
Message-ID <004f01c37b0f$875b4f60$0401a8c0@6usye>
Yeah, I run the following shell script by cron. It clears any bad references
in the database, as well as scans for new files recursively. It logs to the
syslog facility using "logger".

good luck.
-B

---------------------------------------------------------
#!/bin/sh

MPLOGIN="[email protected]"
MPPASS="cronpassword"
MPHOST="mp3.myhost.com"
LOGSUBSYS="mp3scan"
WGET="/usr/bin/wget"

# Perform cleanup...
${WGET} -q -O /tmp/wget.1
"http://${MPHOST}/admin/db-maintain.php?netjuke_login=${MPLOGIN}&netjuke_pas
sword=${MPPASS}&do=maintain"
MPDELETED=`grep "missing audio files have been found" /tmp/wget.1|awk -F" "
'{ print $2 }'`

/usr/bin/logger -t ${LOGSUBSYS} "Performed database cleanup: ${MPDELETED}
record(s) removed"

# Rescan files recursively
${WGET} -q -O /tmp/wget.2
"http://${MPHOST}/admin/tabfile-recursive.php?netjuke_login=${MPLOGIN}&netju
ke_password=${MPPASS}&do=process&recursive_scan=on&auto_queue=on&direct_impo
rt=on"
MPINFOLINE=`grep "Inserted " /tmp/wget.2|awk -F"<br>" '{print $3}'`
if [ "$MPINFOLINE" == "" ]; then
  MPINFOLINE="No changes detected"
fi

/usr/bin/logger -t ${LOGSUBSYS} "Executed recursive scan: ${MPINFOLINE}"

# Logout and cleanup
${WGET} -q -O /dev/null "http://${MPHOST}/login.php?netjuke_logout=1"
rm -f /tmp/wget.1
rm -f /tmp/wget.2
------------------------------------------------------------

----- Original Message ----- 
From: "Steven Adeff" <[email protected]>
To: <[email protected]>
Sent: Thursday, September 11, 2003 12:55 PM
Subject: [Netjuke-users] cron update of database


> I know this was discussed before but I forgot/deleted the emails. Did
anyone
> come up with a good method for updating the database via a cron job?
>
> thanks!
> -- 
> Steven Adeff
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Netjuke-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/netjuke-users
>
>



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf