• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 550
  • Last Modified:

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
0
mhavranek
Asked:
mhavranek
  • 3
1 Solution
 
gheistCommented:
Indeed it shows "dosmd" is not a command line tool. What does it do?
0
 
mhavranekAuthor Commented:

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

Open in new window

0
 
mhavranekAuthor Commented:
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.

0
 
woolmilkporcCommented:
dosmd should have a "-display [display]" option.
0
 
mhavranekAuthor Commented:
That works too. Thank you.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now