/home/username/da_test.sh
and paste in the code#!/bin/sh
#DEBUG=0 normal running after settings confirmed
#DEBUG=1 basic output during testing to confirm settings
#DEBUG=2 raw output to see what's going on
DEBUG=0
USER=username
PASSWORD=password
CONFIG=curl_config.txt
echo -n '' > ${CONFIG}
echo "user = \"${USER}:${PASSWORD}\"" >> ${CONFIG}
RUN="curl --config ${CONFIG} --silent --show-error http://127.0.0.1:2222/CMD_API_LOGIN_TEST"
if [ "${DEBUG}" -ge 2 ]; then
eval $RUN
else
#stderr to cron output
RESULT=`eval $RUN 2>&1`
RET=$?
COUNT=`echo "$RESULT" | grep -c 'error=0'`
if [ "${COUNT}" -gt 0 ]; then
if [ "${DEBUG}" -ge 1 ]; then
echo "all is well";
fi
exit 0;
else
if [ "${RET}" -eq 0 ]; then
echo "Unable to verify login. Try DEBUG=2";
echo "curl returned code 0, so is likely a user/pass issue";
exit 1;
else
echo "$RESULT";
echo "curl returned code ${RET}";
exit ${RET}
fi
fi
fi
chmod 700 /home/username/da_test.sh
If you're running DA with https, change http to https in the RUN variable. Same applies if you're not using port 2222, adjust the port there./home/username/da_test.sh; echo $?
If you see '0' as the output, that's a good thing. Set DEBUG to 1 or 2 to help sort out any issues.User Level -> CronJobs
Leave all time values as *, but set the command to be:/home/username/da_test.sh
and do not press the "Prevent E-Mail", or else you won't get any notices.