: use /bin/sh

# This may fail but is better than nothing
# Reboot should clear the locks?

if [ -r /usr/spool/locks/LCK..fidonet ]
then
	echo "Already going"
	exit 0
fi
echo $$ > /usr/spool/locks/LCK..fidonet

# dont try to make a call if there has been a successfull call already

if [ -r `rfconfig libdir`/out/* ]
then
	echo Doing a fidonet call
	cd `rfconfig libdir`
	DIALDEBUG=a
	export DIALDEBUG
	fpack >> loki 2>&1
	fcall -m -d >> loki 2>&1
	funpack	>> loki 2>&1
else
	echo Already called, no need to try again
fi

rm /usr/spool/locks/LCK..fidonet

