Unable to run a tcl from cronjob

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Unable to run a tcl from cronjob

  • Creator
    Topic
  • #52882
    Mason Miller
    Participant

      I can run my script from command prompt fine but when I add to crontab it will not run anyone know what I am doing wrong? I think it has something to do with calling hcitcl here is what I have

      Code:

      #!/quovadx/qdx5.4/integrator/bin/hcitcl

      #move all .old files to smatfiles directory and delete from process directory

      #get current date
      set dt [clock format [clock seconds]  -f  “%m_%d_%Y” ]

      #set directory where whats are
      set sourcedir “/quovadx/qdx5.4/integrator/smat_data”

      #searches for any file in source directory with .old
      set sourcefiles [glob -path  $sourcedir “/*.old*”]

      #Moves files from source directory to archivesmat directory
      foreach sourcedir $sourcefiles {
      set path [split $sourcedir “/”]
      set filename [lindex $path 5]
      set destdir “/quovadx/qdx5.4/integrator/archivesmat/$dt/”
      file mkdir $destdir
      file copy $sourcedir $destdir
      file delete -force $sourcedir
      }
      exit

    Viewing 6 reply threads
    • Author
      Replies
      • #75779
        James Cobane
        Participant

          Mason,

          Are you running it under the ‘hci’ user’s crontab?  Also, in your cron entry, are you setting your root and site before executing the script? i.e.

          59 23 * * * setroot;setsite mysite;myscript

          What error message do you see being returned from cron?

          Jim Cobane

          Henry Ford Health

        • #75780
          Mason Miller
          Participant

            Code:


            exec(): 0509-036 Cannot load program /quovadx/qdx5.4/integrator/bin/hcitcl because of the following errors:
            0509-150   Dependent module libtcl8.3.so could not be loaded.
            0509-022 Cannot load module libtcl8.3.so.
            0509-026 System error: A file or directory in the path name does not exist.

            *****************************************************************
            cron: The previous message is the standard output

            This is the error

            here is my crontab entry

            0 8 * * * /quovadx/qdx5.4/integrator/scripts/smatmove.tcl

            And yes I am running under hci crontab

          • #75781
            Mason Miller
            Participant

              Thanks for the help I was not using setroot; in my crontab it is working now

            • #75782
              Robert Milfajt
              Participant

                What’s the difference between using

                Code:

                setroot;setsite mysite;myscript

                from James’ reply and using

                Code:

                /usr/bin/ksh -c ‘eval `/qvdx/qdx5.5/integrator/sbin/hcisetenv -root ksh /qvdx/qdx5.5/integrator mysite`;myscript’

                as I find in my crontab.

                Bob

                Robert Milfajt
                Northwestern Medicine
                Chicago, IL

              • #75783
                Chris Williams
                Participant

                  cron jobs do not default to running with the same environment as the user who creates the job. You must explicitly establish the environment variables, particularly those relating to Cloverleaf activity.

                  You can do them in the individual cron scripts, or you can make them apply to ALL jobs in the crontab file by defining them in that file prior to the job entries.

                  Depending on your OS, doing “set | more” should show you all of your currently active environment variables .

                  Chris

                • #75784
                  Steve Carter
                  Participant

                    More food for thought:

                    * * * * * (. ./home/hci/.profile ; myScript.tcl) >/dev/null 2>&1

                  • #75785
                    Chris Williams
                    Participant

                      If you’re asking about the scheduling, cron checks the crontab list once every minute. Using all astks will run your scrpt:

                      Once each minute

                      of every hour

                      on every day of the month

                      of every month

                      on all days of the week.

                      You usually wouldn’t use an asterisk in the first position unless you really want it to run once a minute.

                      As to setting the environment variables, my approach is to do that at the beginning of the crontab file, so you can treat the individual job entries as regular scripts rather than doing all the extra stuff repeatedly. The crontab files are specific to each user. How many hci jobs would you want to run outside of an hci environment?

                  Viewing 6 reply threads
                  • The forum ‘Cloverleaf’ is closed to new topics and replies.