punktdateien/jobrunner/runjob.sh

23 lines
629 B
Bash
Raw Normal View History

2023-12-08 17:33:11 +01:00
#!/bin/bash
if [ -f "${HOME}/.local/share/jobrunner.env" ]; then
source "${HOME}/.local/share/jobrunner.env"
fi
if [ -z "${*}" ]; then
echo ":: Error: No command supplied"
exit 1
fi
if [ -z "${JOBRUNNER_RUNDIR}" ]; then
export "JOBRUNNER_RUNDIR=${XDG_RUNTIME_DIR}/jobrunner/"
fi
if [ -a "${JOBRUNNER_RUNDIR}" ] && [ ! -d "${JOBRUNNER_RUNDIR}" ]; then
echo ":: Error: \"${JOBRUNNER_RUNDIR}\" is not a directory, aborting."
else
if [ ! -f "${JOBRUNNER_RUNDIR}/jobrunner.pid" ]; then
echo ":: Error: The jobrunner daemon is not running."
exit 1
fi
fi
echo "${@}" &> "${JOBRUNNER_RUNDIR}/jobrunner.cmd"