Forum Discussion

12 Replies

  • Convert the script to powershell (I am trying it on this :smileywink: ) or use cygwin to run this script.

    • Ranjit1's avatar
      Ranjit1
      Level 4

      Hi Tape_Archived,

       

      Thnaks for the response

       

      Can you please share me the powershell script actually i am not good in powershell

       

       

      Thaank you in advance

    • Ranjit1's avatar
      Ranjit1
      Level 4

      Hi, 

       

      I tried to modify in powershell, Can you please confirm will it work or not 

       


      $date = Get-Date -Format "yyyy-MM-dd"

      $rpt_file ="c:\temp\backup_rpt_"+$date+".csv"


      ALARM_TRESHOLD=84000
      RUNTIME=0
      bpdbjobs -most_columns | awk -F "," ' $3 ~ /^1$/ { print } ' | awk -F "," ' $2 ~ /^0$/ { print } ' | awk -F "," '{ print $1, $3, $6, $7, $10 }' | while read PID STATE SCHEDULE CLIENT RUNTIME
      do
      if [ RUNTIME -gt ALARM_TRESHOLD ]
      then
      echo "Job ${PID} ${CLIENT} ${SCHEDULE} runtime is ${RUNTIME}. It's exceeded runtime treshold of ${ALARM_TRESHOLD} "
      fi
      done

      # Sending email

      set $SMTPport=Port number
      set $Mailto=xyz.com
      set $Mailfrom=abc.com
      set $Mailsubject="Long Backup Report"
      set $AttachmentDir=" c:\temp"
      set $AttachmentFile_UK=$rpt_file


      Send-MailMessage -SmtpServer "X.X.X.X" -From "abc.com" -To "xyz.com" -Attachments $rpt_file -Subject "Long Backup Report"

       

    • Ranjit1's avatar
      Ranjit1
      Level 4

      Hi Tape_Archived,

       

      Thnaks for the response

       

      Can you please share me the powershell script actually i am not good in powershell

       

       

      Thaank you in advance

      • Tape_Archived's avatar
        Tape_Archived
        Moderator

        I didn't try translating this script to powershell. I may try but it will take some time. I will update when I am ready.