Files
Testing/videoconv-test.sh
sean 0e8a8b3028
Some checks are pending
deploy-testing / deploy (push) Waiting to run
Initial testing snapshot
2026-11-17 16:15:01 -05:00

46 lines
1.0 KiB
Bash

#!/bin/bash
# andrej.golis@gmail.com
JOBNAME="videoconv"
LOCKFILE="/var/lock/bateworld/cron.${JOBNAME}.lock"
OUTPUT=$(mktemp)
CURL=$(which curl)
FLOCK=$(which flock)
URL="https://vidchat.bateworld.com/video_conversion_cronjob-sean.php?password=123456&age_verification=1&test=1&ignorecookies=1"
CURLCMD="${CURL} -s '${URL}'"
(
exec 2>&1
${FLOCK} "${LOCKFILE}" -c "${CURLCMD}"
) | tee ${OUTPUT} | logger -it "${JOBNAME}"
EXITCODE=${PIPESTATUS[0]}
if [ "${EXITCODE}" -eq 1 ];
then echo "Job failed with exit status (${EXITCODE}) which may indicate lockfile is held." | tee /dev/stderr | logger -it "${JOBNAME}"
elif [ "${EXITCODE}" -ne 0 ];
then echo "Job failed with status ${EXITCODE} (command: $@)" | tee /dev/stderr | logger -it "${JOBNAME}"
fi
if [ "${EXITCODE}" -eq 0 ];
then echo "Job ran successfully with exit status ${EXITCODE} (command: $@)" | logger -it "${JOBNAME}"
else echo "Something weird happened - you should debug further (exitcode: ${EXITCODE}" | tee /dev/stderr | logger -it "${JOBNAME}"
fi
rm ${OUTPUT}
exit ${EXITCODE}