rebuild_index.sh (544B)
1 #!/bin/bash 2 BASEDIR="$1" 3 XDG_RUNTIME_DIR="/run/user/1000" 4 DBUS_SESSION_BUS_ADDRESS="unix:path=${XDG_RUNTIME_DIR}/bus" 5 6 cd "${BASEDIR}" 7 LOCKFILE="${BASEDIR}/crawl.lock" 8 9 touch "${LOCKFILE}" 10 11 mkdir -p "${BASEDIR}/index.new/" 12 /usr/bin/systemctl --user stop gus 13 cp "${BASEDIR}/index/gus.sqlite" "${BASEDIR}/index.new/" 14 /usr/bin/systemctl --user start gus 15 /home/gus/.local/bin/poetry run build_index -d 16 mv "${BASEDIR}/index" "${BASEDIR}/index.old" 17 mv "${BASEDIR}/index.new" "${BASEDIR}/index" 18 /usr/bin/systemctl --user restart gus 19 20 rm "${LOCKFILE}"