<commit_before>#!/bin/sh
#
# tileserver This shell script takes care of starting and stopping the tile
#   server for newspaper JP2 images
#
# chkconfig:    - 80 20
# description:  Tile server for newspaper JP2 images
# processname:  tileserver
# pidfile:      /var/run/tileserver.pid

### BEGIN INIT INFO
# Provides:           tileserver
# Required-Start:     $local_fs $remote_fs $network $named $time
# Required-Stop:      $local_fs $remote_fs $network $named $time
# Short-Description:  Start and stop jp2 tile server
# Description:        tileserver serves tiles as JPG images for front-end
#                     viewers to present a "pan & zoom" view of specially-
#                     formatted JP2 images
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions

name=`basename $0`
pid_file="/var/run/$name.pid"
stdout_log="/var/log/$name.log"
stderr_log="/var/log/$name.err"

prog="jp2tileserver"
exec="/opt/chronam-support/$prog"
cmd="$exec --tile-path=/opt/chronam/data/batches --address=:8080"

restartfile=/tmp/$prog.restart
lockfile=/var/lock/subsys/$prog

loop_tileserver() {
  # Until this file is gone, we want to restart the process
  touch $restartfile
  retry=5

  while [ -f $restartfile ] && [ $retry -gt 0 ]; do
    laststart=`date +%s`
    $cmd >>$stdout_log 2>>$stderr_log

    let timediff=$newdate-$laststart
<commit_msg>Fix "seconds since start" bug<commit_after>#!/bin/sh
#
# tileserver This shell script takes care of starting and stopping the tile
#   server for newspaper JP2 images
#
# chkconfig:    - 80 20
# description:  Tile server for newspaper JP2 images
# processname:  tileserver
# pidfile:      /var/run/tileserver.pid

### BEGIN INIT INFO
# Provides:           tileserver
# Required-Start:     $local_fs $remote_fs $network $named $time
# Required-Stop:      $local_fs $remote_fs $network $named $time
# Short-Description:  Start and stop jp2 tile server
# Description:        tileserver serves tiles as JPG images for front-end
#                     viewers to present a "pan & zoom" view of specially-
#                     formatted JP2 images
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions

name=`basename $0`
pid_file="/var/run/$name.pid"
stdout_log="/var/log/$name.log"
stderr_log="/var/log/$name.err"

prog="jp2tileserver"
exec="/opt/chronam-support/$prog"
cmd="$exec --tile-path=/opt/chronam/data/batches --address=:8080"

restartfile=/tmp/$prog.restart
lockfile=/var/lock/subsys/$prog

loop_tileserver() {
  # Until this file is gone, we want to restart the process
  touch $restartfile
  retry=5

  while [ -f $restartfile ] && [ $retry -gt 0 ]; do
    laststart=`date +%s`
    $cmd >>$stdout_log 2>>$stderr_log

    newdate=`date +%s`
    let timediff=$newdate-$laststart

{'fraction_non_alphanumeric': 0.12441399206635413, 'fraction_numerical': 0.012261089073205915, 'mean_word_length': 3.327613104524181, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '303546', 'n_tokens_mistral': 970, 'n_tokens_neox': 906, 'n_words': 256}