Q:

Auto pull git repositories for opengrok indexing

I've installed opengrok from a docker image on an Ubuntu server.
Inside /var/opengrok/src, I cloned the desired repositories.
I'd like to auto pull and auto index changes periodically.
I'm not at ease with cron, is there a way to tell opengrok to pull before indexing?

/var/opengrok/

docker-compose.yml
etc/
data/
src/

repo1-master/   <- need to git pull
repo1-dev/      <- need to git pull
repo2-master/   <- need to git pull
repo2-dev/      <- need to git pull

A:

I finally wrote a cron task to run this script:
pull-repos.sh:
#!/bin/bash
repo_dirs=`ls -d /home/myuser/docker/opengrok/src/*`

for dir in $repo_dirs
do
        echo "Git pulling in $dir"
        cd $dir && git pull && cd ..
done

Here is the cron line:
*/15 9-18 * * mon,tue,wed,thu,fri /home/myuser/docker/opengrok/pull-repos.sh

