Connecting to a Shared Drive

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Connecting to a Shared Drive

  • Creator
    Topic
  • #55136
    Vanessa Rivera
    Participant

      Does anyone know how to connect to a shared drive using a UPOC?  I’m trying to pull in a charge file from a shared drive and have been unsuccessful .  I can pull from the sitedir but not a shared drive.

      proc read_rad_chrg_sharedrive { args } {

         keylget args MODE mode                  ;# Fetch mode

         set dispList {}                ;# Nothing to return

         global HciSiteDir

             global env

         

         set rootdir $env(HCIROOT)

         set sitedir $env(HCISITEDIR)

         set tclpath [file join $rootdir bin tcl]

         set perlpath [file join $rootdir bin perl]

         switch -exact — $mode {

           start {

      # Perform special init functions

      # N.B.: there may or may not be a MSGID key in args

           }

           run {

           }

           time {

      # Timer-based processing

      # N.B.: there may or may not be a MSGID key in args

                       set dtback [clock scan “1 day ago”]

                       set dtb [clock format $dtback -format %Y%m%d]

                       set ts [clock format [clock seconds] -format %Y%m%d]

                         set fname MtSinaiDailyRADChargeFile$ts.txt

                         #set cpath $sitedir\exec\processes\rad_chrg\ftp_in

                         set cpath Z:\RADCharges

               set newcpath $cpath\$fname

               

               

               if {[file exists $newcpath]} {

                       set chrgfile [read_file $newcpath]

                       set newmsg [split $chrgfile rn]

                               

                       foreach seg $newmsg {

                               set mh [msgcreate -recover]

                               msgset $mh $seg

                               lappend dispList “CONTINUE $mh”

                               #exec rm $fpath$seg $cpath$seg

                       }        

                           

                       #catch {file delete $newcpath}

               } else {

                       echo “”

                       echo “*****************************************************************”

                       echo “***** EXITING UPOC read_rad_chrg_file NO CHARGE FILE PRESENT $cpath $newcpath *****”

                       echo “*****************************************************************”

                       echo “”

                   

               }

           }

           shutdown {

      # Doing some clean-up work

           }

         }

         return $dispList

      }

    Viewing 2 reply threads
    • Author
      Replies
      • #84275

        Try reversing the slashes.

        Try the UNC path. Ex. //rdcgrpfld01/gf01/gf01/

        And triple check the permissions on the share. Remember that the Cloverleaf service and engines run as the hci user (or the system user you chose), so that user needs read/write permissions on the share.

        -- Max Drown (Infor)

      • #84276
        Vanessa Rivera
        Participant

          It worked!  Thank you.  However, I have another issue the UPOC keeps looping and grabbing the same file over and over again.

        • #84277

          If you are not using the fileset protocols, then Cloverleaf will not automatically delete the files. You’ll have to handle file management using code in you proc.

          Here’s an example proc used on a Linux server.

          Code:

          proc tps_it_get_files { args } {
             global HciConnName HciSiteName HciSiteDir
             keylget args MODE mode
             set ctx “”   ; keylget args CONTEXT ctx
             set uargs {} ; keylget args ARGS uargs
             set module “tps_it_get_files/$HciConnName/$ctx”
             set debug 0
             set dispList {}

             switch -exact — $mode {
                 start {}

                 run {
                     keylget args MSGID mh
                     #set msg [msgget $mh]
                     lappend dispList “CONTINUE $mh”
                 }

                 time {
                     set mnt /opt/cloverleaf/mnt/imagetrend
                     set data $HciSiteDir/data/imagetrend
                     set fileList [glob -nocomplain -directory $mnt *.xml]
                     foreach file $fileList {
                         set now [clock scan now]
                         set mtime [file mtime $file]
                         if {[expr $now – $mtime > 60]} {
                             echo INFO: $module: File found: $file
                             file rename -force $file $data
                         }
                     }
                 }
                 shutdown {}
                 default {}
             }

             return $dispList
          }

          -- Max Drown (Infor)

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