h1. Server Scripts
The Location for each of these scripts is both where they should live, but also where the most recent copies can currently be found.

* [#Statistics]
* [#Reference Movie Generation]
* [#V2X Generation]
* [#Access Pages]
* [#Database]
* [#Server]

h2. Statistics
Note: These scripts are dependent on the timestamp scheme currently being used (MMM dd yyyy HH:mm:ss.SSS).  These scripts assume that administrators will want to break down usage into the groups In Music Library, On Campus, Off Campus, and Totals which are specified by IP addresses.  These scripts only deal with *UI* and *Darwin Streaming Server* log processing and analyzing.

h3. generateStats.pl
|Location: | /home/dmlserv/dml/bin/ |
|Language: | Perl |
|Usage: | generateStats.pl Mmm dd yyyy filename   (Analyze only specified date) \\ generateStats.pl filename   (Analyze an entire file) \\ generateStats.pl   (Analyze today) |
|When to run: | Nightly or Hourly |
|Notes: | |
|Changes to make for test sites: | configure *dml.statistics.path* in *dml/conf/server/dmlscript.conf* \\
                                    configure *dml.statistics.uilogpath* in *dml/conf/server/dmlscipt.conf*\\
                                    configure *dml.statistics.ipfile.inlibrary* in *dml/conf/server/dmlscipt.conf*\\
                                    configure *dml.statistics.ipfile.oncampus* in *dml/conf/server/dmlscipt.conf* |

h3. generateQTStats.pl
|Location: | /home/dmlserv/dml/bin/ |
|Language: | Perl |
|Usage: | generateQTStats.pl filename   (Analyze an entire file) \\ generateQTStats.pl   (Analyzes the logfile /var/streaming/logs/StreamingServer.*.log that corresponds to the current date or /var/streaming/logs/StreamingServer.log) |
|When to run: | Nightly or Hourly |
|Notes: | |
|Changes to make for test sites: | configure *dml.statistics.path* in *dml/conf/server/dmlscript.conf* \\
                                    configure *dml.statistics.dsslogpath* in *dml/conf/server/dmlscipt.conf*\\
                                    configure *dml.statistics.ipfile.inlibrary* in *dml/conf/server/dmlscipt.conf*\\
                                    configure *dml.statistics.ipfile.oncampus* in *dml/conf/server/dmlscipt.conf* |

h3. viewStats.cgi
|Location: | /var/www/cgi-bin/ |
|Language: | Perl |
|Usage: | viewStats.cgi?\[current\]\[year=yyyy\]\[month=Mmm\]\[day=dd\]\[location=In+Music+Library\|On+Campus\|Off+Campus\|Totals\]\[view=yearly\|monthly\|daily\] |
|When to run: | Whenever an administrator wants to view statistics |
|Notes: | For this script to work *dml.statistics.path* should be linked into an apache viewable directory that is specified with *dml.statistics.urlpath*. \\ This script now displays *both* UI and Darwin statistics. |
|Changes to make for test sites: | configure *dml.statistics.path* in *dml/conf/server/dmlscript.conf* \\
                                    configure *dml.accesspage.urlpath* in *dml/conf/server/dmlscipt.conf*\\
                                    configure *dml.statistics.urlpath* in *dml/conf/server/dmlscipt.conf*\\
                                    configure *dml.statistics.abouturl* in *dml/conf/server/dmlscipt.conf*\\
                                    configure *dml.statistics.cssurlpath* in *dml/conf/server/dmlscipt.conf* |

h2. Reference Movie Generation

h3. generate-ref-movie.mov
|Location: | /var/www/cgi-bin/ |
|Language: | Perl |
|Usage: | generate-ref-movie.mov?path=leasedir/mediafile |
|When to run: | Whenever an user wants to access a media file |
|Notes: | This script is adapted from the generate-ref-movie shell script that called Java code. \\ The script currently generates a reference movie for any derivative files of supported bitrates located in the lease directory. \\ The script does not check that QTAtom children added to a QTAtom are of the allowable types. |
|Changes to make for test sites: | configure *dml.leases.rtspurl* in *dml/conf/server/dmlscript.conf* \\
                                    configure *dml.leases.path* in *dml/conf/server/dmlscipt.conf* |

h2. V2X Generation

h3. variationsURL.v2x
|Location: | /var/www/cgi-bin/ |
|Language: | Perl |
|Usage: | variationsURL.v2x?type=timeline&ref=urlthatholdsv2xfile \\ variationsURL.v2x?type=opus&instatiation_id=LIB/Instantiation/xxx=&start_offset=xxx&work_start=xxx&work_end=xxx&work_id=LIB/Work/xxx \\ variationsURL.v2x?type=anything&container_id=LIB/Container/xxx&start_offset=xxx |
|When to run: | When a link is clicked on from an access page or when directed to from another source|
|Notes: | Most references to Variations1 has been deleted and support dropped for simplicity. \\ Query string parameters vary widely as can be seen in the usage above and thus are currently gathered into a hash from $ENV\{'QUERY_STRING'\} as opposed to using $cgi->param('paramname]) like in the other scripts.  This may want to be changed for standardization or to be used under mod_perl. \\ MIME types are set to application/x-variations2-* and might want to be generalized if there is a name change to Variations 3 or any other name. |
|Changes to make for test sites: | Line 104-121: Usage information is specific to Variations 2 and to IU.   |

h2. Access Pages

h3. access.pl
|Location: | /var/www/cgi-bin/ |
|Language: | Perl |
|Usage: | access.pl?id=notisSyleID |
|When to run: | When a link is clicked on from a catalog page or from another source |
|Notes: | Depends on access.xsl and score-access.xsl which have entries below as well as access.css and v2-logo.jpg. \\ This script depends on Notis style identifiers. |
|Changes to make for test sites: | Line 27: audio_access_dir - filesystem directory where audio access pages are stored \\ Line 28: score_access_dir - filesystem directory where score access pages are stored \\ Line 29: audio_xsl_file - path to audio access xslt file \\ Line 30: score_xsl_file - path to score access xslt file |

h3. access.xsl
|Location: | /home/content/access/ |
|Language: | XSLT |
|Usage: | |
|When to run: | When called by access.pl for rendering an audio access page |
|Notes: | This script depends on the name Variations2 and will need to be changed whenever a name change occurs. |
|Changes to make for test sites: | Line 114: url of variationsURL.v2x script \\ Line 131: url of access.css stylesheet \\ Line 138: url of v2-logo.jpg \\ Line 146: "The Indiana University Digital Music Library" \\ Line 266-267: "IU Music Library" \\ Line 268: "Indiana University Cook Music Library" \\ Line 307: url of library catalog \\ Line 311: "View IUCAT ..." \\ Line 324: url of where page in the user's guide \\ Line 329: "IU Music Library computer" \\ Line 335: url of user's guide \\ Line 402: "Indiana University" \\ Line 416: url of support page in the user's guide |

h3. score-access.xsl
|Location: | /home/content/access/ |
|Language: | XSLT |
|Usage: |  |
|When to run: | When called by access.pl for rendering an audio access page |
|Notes: | This script depends on the name Variations2 and will need to be changed whenever a name change occurs. |
|Changes to make for test sites: | Line 30: url of variationsURL.v2x script \\ Line 44: url of access.css stylesheet \\ Line 52: url of v2-logo.jpg \\ Line 60: "The Indiana University Digital Music Library" \\ Line 168-169: "IU Music Library" \\ Line 170: "Indiana University Cook Music Library" \\ Line 211: url of library catalog \\ Line 214: "View IUCAT ..." \\ Line 227: url of where page in the user's guide \\ Line 233: "IU Music Library computer" \\ Line 239: url of user's guide \\ Line 251: url to html version of scores \\ Line 305: "Indiana University" \\ Line 322: url of support page in the user's guide |

h3. generateAccessPage.sh
|Location: | /home/dmlserv/dml/bin/ |
|Language: | sh calling Java |
|Usage: | generateAccessPage.sh service_name \[variationsID \| variationsID_file\] out_directory |
|When to run: | Whenever a new Container is created or updated (not currently setup) |
|Notes: | Calls v2run on edu.indiana.dml.util.AccessPageGenerator. \\ variationsIDs (notis-style) passed to this script must be for Containers |
|Changes to make for test sites: |  |

h2. Database


h3. dumpDB.sh

|Location: | /home/dmlserv/dml/bin/ |
|Language: | sh calling Java |
|Usage: | dumpDB.sh <library_name> <filename> \[\{-after <date>\} \|
          \{-lastdays <num>\} \| \{-contributors_and_works\} \| \{<list_of_entity_ids>\}\] \\
<date> must be in Timestamp format, eg. 2002-08-29 \\
The -lastdays option will only dump the last num days worth of edits. |
|Examples: | dumpDB.sh RHS_CAT2 rhs_data -lastdays 10 |
|When to run: | When data needs to be dumped from a database for backup or copying. |
|Notes: | Command for dumping the data from a metadata database into a file in XML. \\
          This command accesses the database as a client, so \\
          the specified server must be running for this command to work. |
|Changes to make for test sites: |  (?) \\
                                
h3. initDB.sh

|Location: | /home/dmlserv/dml/bin/ |
|Language: | sh calling Java |
|Usage: | initDB.sh  \[-user_only\] service_name |
|Examples: | initDB.sh IU_TEST2 \\
             initDB.sh -user_only RHS_A |
|When to run: | When the tables in a database need to be created. |
|Notes: | Command for creating the Variations tables in a database.  \\
          The specified server must be running for this command to work. \\
          The "-user_only" option only initializes the Access Manager database; by default \\
          both the Access Manager and Metadata databases are initialized. |
|Changes to make for test sites: |  configure *dml.server.sqlRepository.userid* in *dml/conf/server/dmlscript.conf* \\
                                    configure *dml.server.userProfileManager.userid* in *dml/conf/server/dmlscipt.conf* |

h3. setDB2Permissions.pl

|Location: | /home/dmlserv/dml/bin/ |
|Language: | Perl |
|Usage: | setDB2Permissions.pl ( grant \| revoke ) <schema_name> <user_name> |
|Examples: | setDB2Permissions.pl grant RHS_CAT2 dmlrhs \\
             setDBP2ermissions.pl revoke RHS_CAT2 dmlrhs | 
|When to run: | After new Variations3 phase 1 test site schema and user account have been set up. |
|Notes: | The grant option gives the specified user the necessary permissions to use the specified schema with Variations. \\
          The revoke option takes away the users permissions to access the specified schema.|
|Changes to make for test sites: | N/A - This script is intended for use only at IU by the Variations group. |

h3. varGroup.sh

|Location: | /home/dmlserv/dml/bin/ |
|Language: | sh calling Java |
|Usage: | varGroup.sh  delete \[-f\] <group_name> \\
                       \| dump \[-f\] \[-g <group_name>\] <file_name> \| -dir <dir_name> \\
                       \| list \\
                       \| load <file_name1> \[<file_name2> ...\]|
|When to run: | As needed. |
|Notes: | Command line utility for the Access Manager Database that is used for authorization.  For more information see [varGroup.sh] \\
|Changes to make for test sites: |  configure *dml.server.script.library* in *dml/conf/server/dmlscript.conf* |

h2. Server

h3. serverTools.sh

|Location: | /home/dmlserv/dml/bin/ |
|Language: | sh calling Java |
|Usage: | serverTools.sh <service_name> {showUsers \| showStats \| garbageCollect \| uiLogMessage <message> \| delete <idNum>} |
|When to run: | The following is run at 12:00am (midnight) and 12:01am daily as a cron job:\\
                {{serverTools.sh IU_4 uiLogMessage "Forced log file rollover."}} |
|Notes: | \\
|Changes to make for test sites: | (?) |