Autor Thema: Script  (Gelesen 2604 mal)

Offline Christopher

  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 1.060
  • Geschlecht: Männlich
  • Dumm ist der, der dummes tut.
Script
« am: 04.06.02 - 07:44:24 »
Hallo Leute ich habe gestern folgenden Agenten im Web gefunden:

Dieser Agent überprüfte die Göße der MailDatein die MaxGröße kann man per Hand vorgeben wenn die MaxGröße überschritten ist bekommt der Nutzer eine  Mail man selber erhält zum Schluß ein Gesammtbericht. Ich find das Script echt Super funktioniert auch alles soweit.

Bloß was ich nicht hinbekomme ist das der Agent im Verzeichnis "mail" sich die erste DB nimmt. Ich zweifle schon an mir selber.




Jayme Hansen
11 Jun 2001, Rating 3.60 (out of 5)
We have lots of users that use only a local mail file. This is so much faster for them, but a pain for them to monitor the size of their server mail file. This agent sends them a message when they are over quota on the server. We only care about the server as that is all we have to back up.

Code

Sub Initialize
Dim session As New notessession
Dim serverName As String
serverName = "lnt002/tsatest"
Dim directory As NotesDbDirectory
Set directory = New NotesDbDirectory(ServerName)
Dim db As NotesDatabase
Dim doc As NotesDocument
Set db = directory.GetFirstDatabase( Database )
Set db = session.CurrentDatabase

Print "Agent is Running..........."

'notes: you have to open the database after you do the quota and before
you set the size in order for it to work properly.
'go through every database, get the quota, open the database, get the
size.
'if the database's quota isn't 0 and if the size is over the quota
'then populate the information into the lines that will go into the
email sent to the user
'populate the lines into the email

'Summary is going to be the email sent to the admins
Set Summary = New notesdocument(db)
Set SumBody = New NotesRichTextItem (Summary, "Body")
SumLine1 = "The following users are over quota and have been notified:"
SumLine2 = "UserName: Mail File Size Mail Quota"
Call SumBody.AppendText(SumLine1) 'append the line to the Summary
message
Call SumBody.AddNewLine(1)
Call SumBody.AppendText(SumLine2) 'append the line to the Summary
message

Do While Not (db Is Nothing)
On Error Resume Next
dbmax = (db.sizequota)/1024 'puts quota into Megs
Call db.OpenMail 'you have to open the db to get the size property
dbsize = (db.size)/1024 'puts size into kb
dbsize = Round( (dbsize/1024), 0 ) 'puts size into mb, rounds to
nearest integer

If ( dbmax > 0) And (dbsize > dbmax)Then 'if the size is over the
quota, then send them a message
Line1 = "Your server mail file size: " & dbsize & " Mb"
Line2 = "Your server mail file quota: " & dbmax & " Mb"

Set message = New notesdocument(db) 'the message to the users
Set RTBody = New NotesRichTextItem (message, "Body")
Call RTBody.AddNewLine(1)
Call RTBody.AppendText(Line1)
Call RTBody.AddNewLine(2)
Call RTBody.AppendText(Line2)

'populate the summary line with that db's information
SumLine3 = db.Title & " " & dbsize & " " & dbmax 'update the summary
information
Call SumBody.AddNewLine(3) 'add a return
Call SumBody.AppendText(SumLine3) 'add in the line

'populate the email's form and send
With message
Call .ReplaceItemValue("Form","Memo")
Call .ReplaceItemValue("SendTo", db.Title)
Call .ReplaceItemValue("Subject","Your Mail File is over Quota")
Call message.Send(False)
End With
End If
Set db = directory.GetNextDatabase 'get the next database
Loop

'populate and send the summary information to the admins
With Summary 'send the email to the administrators
Call .ReplaceItemValue("Form","Memo")
Call .ReplaceItemValue("SendTo", "aaTSATESTadmin")
Call .ReplaceItemValue("Subject","Over Quota List")
Call Summary.Send(False)

End With

Print "Agent is finished!"
End Sub




« Letzte Änderung: 01.01.70 - 01:00:00 von 1034200800 »
Client & Server R 5.011
Principal Certified Lotus Professional R5 System Administration
Microsoft Certified Systems Engineer 2000
Microsoft Certified Systems Administrator 2000
Microsoft Certified Systems Administrator 2003
Microsoft Certified Systems Engineer 2003

Offline eknori

  • @Notes Preisträger
  • Moderator
  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 11.728
  • Geschlecht: Männlich
Re: Script
« Antwort #1 am: 04.06.02 - 08:11:31 »
Wenn ich die Notes Hilfe richtig interpretiere, kannst du kein "Startverzeichnis" setzen. NotesDBDirectory setzt immer im root des Notes Data Verzeichnisses auf.

Da bleibt dir nix anderes übrig, als über eine IF-Abfrage festzustellen, ob du schon im mail Verzeichnis bist.

etwa so

Hole die erste Datenbank

If Instr(db.filepath, "mail\") > 0 Then

aha, wir sind im Mailverzeichnis, dann wollen wir mal
 .....

end  if

und weiter mit der nächsten DB

eknori
Egal wie tief man die Messlatte für den menschlichen Verstand auch ansetzt: jeden Tag kommt jemand und marschiert erhobenen Hauptes drunter her!

Offline Christopher

  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 1.060
  • Geschlecht: Männlich
  • Dumm ist der, der dummes tut.
Re: Script
« Antwort #2 am: 04.06.02 - 08:17:25 »
Hallo Eknori,

danke für Deine Hilfe werde es gleich mal ausprobieren. Hab da zwei Server wo ich den Nutzer´n mal solche Newlsetter senden muß  ;D

Gruß

Christopher

« Letzte Änderung: 01.01.70 - 01:00:00 von 1034200800 »
Client & Server R 5.011
Principal Certified Lotus Professional R5 System Administration
Microsoft Certified Systems Engineer 2000
Microsoft Certified Systems Administrator 2000
Microsoft Certified Systems Administrator 2003
Microsoft Certified Systems Engineer 2003

Offline Felix

  • Aktives Mitglied
  • ***
  • Beiträge: 222
  • Geschlecht: Männlich
  • Es ist noch kein Meister vom Himmel gefallen!
Re: Script
« Antwort #3 am: 04.06.02 - 14:13:14 »
Hallo Christopher,

kannst du das fertige Script posten ?? ???

Felix

« Letzte Änderung: 01.01.70 - 01:00:00 von 1034200800 »

Offline Christopher

  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 1.060
  • Geschlecht: Männlich
  • Dumm ist der, der dummes tut.
Re: Script
« Antwort #4 am: 10.06.02 - 21:36:31 »
Hallo Felix,

bekommst Du gedulde Dich bitte noch etwas.
« Letzte Änderung: 01.01.70 - 01:00:00 von 1034200800 »
Client & Server R 5.011
Principal Certified Lotus Professional R5 System Administration
Microsoft Certified Systems Engineer 2000
Microsoft Certified Systems Administrator 2000
Microsoft Certified Systems Administrator 2003
Microsoft Certified Systems Engineer 2003

Offline Christopher

  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 1.060
  • Geschlecht: Männlich
  • Dumm ist der, der dummes tut.
Re: Script
« Antwort #5 am: 10.06.02 - 21:42:15 »
Hallo Leute so funtz es  ;D

Sub Initialize
     Dim session As New notessession
     Dim serverName As String
     serverName = ""
     Dim directory As NotesDbDirectory
     Set directory = New NotesDbDirectory(ServerName)
     Dim db As NotesDatabase , db2 As notesdatabase
     Dim doc As NotesDocument
     Set db = directory.GetFirstDatabase( Database )
     Set db = session.CurrentDatabase
     
     Print "Agent is Running..........."
     
'notes: you have to open the database after you do the quota and before you set the size in order for it to work properly. 'go through every database, get the quota, open the database, get the size.
'if the database's quota isn't 0 and if the size is over the quota
'then populate the information into the lines that will go into theemail sent to the user
'populate the lines into the email
     
'Summary is going to be the email sent to the admins
     
     
     
     Set Summary = New notesdocument(db)
     Set SumBody = New NotesRichTextItem (Summary, "Body")
     SumLine1 = "The following users are over quota and have been notified:"
     SumLine2 = "UserName: Mail File Size Mail Quota"
     Call SumBody.AppendText(SumLine1) 'append the line to the Summary       message
     Call SumBody.AddNewLine(1)
     Call SumBody.AppendText(SumLine2) 'append the line to the Summary       message
     
     
     verzeichnis=Inputbox("Bitte Verzeichnis eingeben",,"mail\")      
     Do While Not (db Is Nothing)
           On Error Resume Next
           
           If Instr(db.filepath, "verzeichnis") > 0 Then
                 
                 dbmax = (db.sizequota)/1024 'puts quota into Megs
                 Call db.OpenMail 'you have to open the db to get the size property
                 dbsize = (db.size)/1024 'puts size into kb
                 dbsize = Round( (dbsize/1024), 0 ) 'puts size into mb, rounds to nearest integer
                 
                 If ( dbmax > 0) And (dbsize > dbmax)Then 'if the size is over the quota, then send them a message
                       Line1 = "Your server mail file size: " & dbsize & " Mb"
                       Line2 = "Your server mail file quota: " & dbmax & " Mb"
                       
                       Set message = New notesdocument(db) 'the message to the users
                       Set RTBody = New NotesRichTextItem (message, "Body")
                       Call RTBody.AddNewLine(1)
                       Call RTBody.AppendText(Line1)
                       Call RTBody.AddNewLine(2)
                       Call RTBody.AppendText(Line2)
                       
'populate the summary line with that db's information
                       SumLine3 = db.Title & " " & dbsize & " " & dbmax 'update the summary information
                       Call SumBody.AddNewLine(3) 'add a return
                       Call SumBody.AppendText(SumLine3) 'add in the line
                       
'populate the email's form and send
                       With message
                             Call .ReplaceItemValue("Form","Memo")
                             Call .ReplaceItemValue("SendTo", db.Title)
                             Call .ReplaceItemValue("Subject","Your Mail File is over Quota")
                             Call message.Send(False)
                       End With
                 End If
           End If                  
           Set db = directory.GetNextDatabase 'get the next database
     Loop
     
'populate and send the summary information to the admins
     With Summary 'send the email to the administrators
           Call .ReplaceItemValue("Form","Memo")
           Call .ReplaceItemValue("SendTo", "aaTSATESTadmin")
           Call .ReplaceItemValue("Subject","Over Quota List")
           Call Summary.Send(False)
           
     End With
     
     Print "Agent is finished!"
End Sub
« Letzte Änderung: 01.01.70 - 01:00:00 von 1034200800 »
Client & Server R 5.011
Principal Certified Lotus Professional R5 System Administration
Microsoft Certified Systems Engineer 2000
Microsoft Certified Systems Administrator 2000
Microsoft Certified Systems Administrator 2003
Microsoft Certified Systems Engineer 2003

Offline Felix

  • Aktives Mitglied
  • ***
  • Beiträge: 222
  • Geschlecht: Männlich
  • Es ist noch kein Meister vom Himmel gefallen!
Re: Script
« Antwort #6 am: 12.06.02 - 13:59:31 »
Hey Super Christopher sowas kann mann frau immer gut
gebrauchen.

Felix
« Letzte Änderung: 01.01.70 - 01:00:00 von 1034200800 »

Offline Christopher

  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 1.060
  • Geschlecht: Männlich
  • Dumm ist der, der dummes tut.
Re: Script
« Antwort #7 am: 12.06.02 - 14:20:19 »
Ich habe mal noch was geändert:

Hab damit auch gleich mal die Nutzer generft  ;D ;D ;D

Sub Initialize
     Dim session As New notessession
     Dim serverName As String
     serverName = Inputbox("Bitte Server eingeben",,"Servername")
     Dim directory As NotesDbDirectory
     Set directory = New NotesDbDirectory(ServerName)
     Dim db As NotesDatabase , db2 As notesdatabase
     Dim doc As NotesDocument
     Set db = directory.GetFirstDatabase( Database )
     Set db = session.CurrentDatabase
     
     Print "Agent is Running..........."
     
'notes: you have to open the database after you do the quota and before youset the size in order for it to work properly. 'go through every database,get the quota, open the database, get the size.
'if the database's quota isn't 0 and if the size is over the quota
'then populate the information into the lines that will go into theemailsent to the user
'populate the lines into the email
     
'Summary is going to be the email sent to the admins
     
     
     
     Set Summary = New notesdocument(db)
     Set SumBody = New NotesRichTextItem (Summary, "Body")
     SumLine1 = "The following users are over quota and have been notified:"
     SumLine2 = "UserName: Mail File Size Mail Quota"
     Call SumBody.AppendText(SumLine1) 'append the line to the Summary  message
     Call SumBody.AddNewLine(1)
     Call SumBody.AppendText(SumLine2) 'append the line to the Summary  message
     
     
     verzeichnis=Inputbox("Bitte Verzeichnis eingeben",,"Mail\")
     Do While Not (db Is Nothing)
           On Error Resume Next
           
           ver=Lcase(db.filepath)
           If Instr(ver, Lcase(verzeichnis)) > 0 Then
                 
                 dbmax = 50
                 Call db.OpenMail 'you have to open the db to get the size property
                 dbsize = (db.size)/1024 'puts size into kb
                 dbsize = Round( (dbsize/1024), 0 ) 'puts size into mb, rounds to nearestinteger
                 
                 If ( dbmax > 0) And (dbsize > dbmax)Then 'if the size is over the quota,then send them a message
                       Line1 = "Die Größe Ihrer MailDatei auf dem Server beträgt: " & dbsize & " Mb"
                       Line2 = "Ihre MailDatei sollte nicht größer als " & dbmax & " Mb sein. Bitte löschen Sie EMails auf dem Server."
                       
                       Set message = New notesdocument(db) 'the message to the users
                       Set RTBody = New NotesRichTextItem (message, "Body")
                       Call RTBody.AddNewLine(1)
                       Call RTBody.AppendText(Line1)
                       Call RTBody.AddNewLine(2)
                       Call RTBody.AppendText(Line2)
                       
'populate the summary line with that db's information
                       SumLine3 = db.Title & " " & dbsize & " " & dbmax 'update the summary                        information
                       Call SumBody.AddNewLine(3) 'add a return
                       Call SumBody.AppendText(SumLine3) 'add in the line
                       
'populate the email's form and send
                       With message
                             Call .ReplaceItemValue("Form","Memo")
                             Call .ReplaceItemValue("SendTo", db.Title)
                             Call .ReplaceItemValue("Subject","Achtung Ihre MailDatei auf dem Server ist zu groß geworden!")
                             Call message.Send(False)
                       End With
                 End If
           End If
           Set db = directory.GetNextDatabase 'get the next database
     Loop
     
'populate and send the summary information to the admins
     With Summary 'send the email to the administrators
           Call .ReplaceItemValue("Form","Memo")
           Call .ReplaceItemValue("SendTo", "Christopher Schoeneich@Bundeswehr")
           Call .ReplaceItemValue("Subject","Over Quota List")
           Call Summary.Send(False)
           
     End With
     
     Print "Agent is finished!"
End Sub
« Letzte Änderung: 01.01.70 - 01:00:00 von 1034200800 »
Client & Server R 5.011
Principal Certified Lotus Professional R5 System Administration
Microsoft Certified Systems Engineer 2000
Microsoft Certified Systems Administrator 2000
Microsoft Certified Systems Administrator 2003
Microsoft Certified Systems Engineer 2003

 

Impressum Atnotes.de  -  Powered by Syslords Solutions  -  Datenschutz