mhavranek
asked on
How do I use Hummingbird's "dosmd" in a cronjob
Hi,
I wrote a script that basically checks for the results of a database query on the file-system and copies those files to a Windows machine on the network using Exceed's internal tools, e.g. dosdir, dosmd, u2dos.
Now, the script works perfectly - executed manually. The goal would be to have that script run every night via crontab.
Which brings me to my problem:
dosdir does not seem to have any problem with that, but dosmd has. It gives me the following error:
/opt/local/bin/dosmd: Cannot Open Display
I understand that crond has a different environment as the console I am logging in through but this tool being a command line tool - why does it need a display? I am pretty new to exceed, so I do not know much about it. The main question is: is it possible to execute that command through crond or do I have to settle for the version without creating a new directory (this would mean more work archiving things...)?
Thank you in advance,
Marcus
I wrote a script that basically checks for the results of a database query on the file-system and copies those files to a Windows machine on the network using Exceed's internal tools, e.g. dosdir, dosmd, u2dos.
Now, the script works perfectly - executed manually. The goal would be to have that script run every night via crontab.
Which brings me to my problem:
dosdir does not seem to have any problem with that, but dosmd has. It gives me the following error:
/opt/local/bin/dosmd: Cannot Open Display
I understand that crond has a different environment as the console I am logging in through but this tool being a command line tool - why does it need a display? I am pretty new to exceed, so I do not know much about it. The main question is: is it possible to execute that command through crond or do I have to settle for the version without creating a new directory (this would mean more work archiving things...)?
Thank you in advance,
Marcus
Indeed it shows "dosmd" is not a command line tool. What does it do?
ASKER
Attached you will find the part of my script where I use the command (see line 10). 'dosmd' creates directories on a remote DOS/Windows machine. Interestingly enough the previous command seems to work (dosdir), which just checks for the existence of the directory.
BTW: the version of Exceed used here is 6.2 - pretty old as I have seen.
# copy the data
if [ $EXISTS=1 ]
then
export DOSDIR="I:/PAYROLL_RETRO_TEST/RET5$CHECKDATE"
# check if target directory exists - if not, create it
/opt/local/bin/dosdir $DOSDIR >/dev/null 2>&1
if [ $? -ne 0 ]
then
/opt/local/bin/dosmd $DOSDIR
if [ $? -ne 0 ]
then
echo "[`date`] ERROR - Unable to create DOS directory: $DOSDIR"
exit 255
else
# get filenames
set -A FILENAMES `ls -1 $RESULTSET`
# set counters
typeset -i index=0 maxIndex=0
export maxIndex=${#FILENAMES[*]}-1
while (( $index <= $maxIndex ))
do
# rename files to be readable by users and copy them to the target dir
/opt/local/bin/u2dos -ln $RESULTSET"/"${FILENAMES[$index]} $DOSDIR"\\"`echo ${FILENAMES[$index]} | sed s/'\.'/_/`".txt"
if [ $? -ne 0 ]
then
echo "[`date`] ERROR - Unable to copy file $RESULTSET/${FILENAMES[$index]}"
exit 255
fi
export index=$index+1
done
fi
else
echo "[`date`] ERROR - Destination directory already there!"
exit 255
fi
fi
ASKER
I just found it out: setting the display variable inside my script did the trick. No errors and the files are copied to the destination.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That works too. Thank you.