Reply To: TCL in Crontab Problem

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf TCL in Crontab Problem Reply To: TCL in Crontab Problem

#57685
Nicole Goodyear
Participant

    Here is my tcl proc.

    proc processLogs {} {

       set getMonth [fmtclock [getclock] “%m”]

       set deleteMonth 0

       set formatMonth 0

       if {$getMonth != 10 || $getMonth != 11 || $getMonth != 12} {

    set formatMonth [string trimleft $getMonth 0]

       } else {

    set formatMonth $getMonth

       }

       if {[cequal $formatMonth “1”]} {

    set deleteMonth 11

       } elseif {[cequal $formatMonth “2”]} {

    set deleteMonth 12

       } else {

    set deleteMonth [expr $formatMonth – 2]

       }

    #   remove all files that do equal deleteMonth

       rm /hci/process_logs_test/*.$deleteMonth*

    }

    One thing I am confused with, how can hardcoding the directory structure inside the proc find the proc if it cannot access it in the first place?  Could you please clarify? Thanks!