The administrator can configure the system to run scripts in a schedule – e.g., to back up the database every night at 3:00 AM, perform changes early in the morning, etc.
To configure this option, do the following:
From the menu bar, select. The Scheduled Scripts dialog box displays. Any already defined scripts are displayed.
To add a new script, click the Add button. The Schedule Script dialog box displays.
In the applicable Script name field, type the script name and necessary startup parameters. You must enter all information for the script as you would when invoking the script from the command line. It is assumed that the script is located in the same directory as the Men&Mice Central database file (mmsuite.db); however, if the script is stored in a different location, the path for the script must be entered.
Example 1: Running a script named mytest.vb. To run a script named mytest.vb that is located in the Men&Mice Central directory using the scripting host cscript, the following would be placed in the appropriate field: cscript /B mytest.vb.
Example 2: Running an executable named checkdata.exe. To run an executable named checkdata.exe that is located in the Men&Mice Central directory the following would be placed in the appropriate field: checkdata.exe.
It is possible to create a special user that has permissions to run scripts. When this user exists, it is possible to execute scripts that access Micetro without having to enter a user name and password in the script itself.
To enable this feature, create a user named ScriptRunner. This user must use the Men&Mice Internal authentication method. When this user has been created, you only have to enter $u as a user name and $p as a password when logging in to Micetro through the script.
This method only works if the script scheduler invokes the script. When running the script, Micetro uses a temporary password that changes every time the script runs.
Example 1: The following example shows how the command line interface can be invoked by the scheduler to execute a backup. This statement can be entered directly into the Script name field:
1mmcmd -s 127.0.0.1 -u $u -p $p backup;exit
Example 2: The following Visual Basic script checks which users are logged in and writes the list of logged in users to the file logger.txt. To invoke the script you would enter the following statement into the Script name field:
1cscript /B scripts\test.vbs $u $p 2 3' Script starts here 4Option Explicit 5Dim objArgs, objFSO, objShell, objFile, objTextFile 6Dim strFile, strUser, strPassword, i 7 8strFile = "logger.txt" 9strUser = ""strPassword = "" 10 11' We should get username and password as arguments 12Set objArgs = WScript.Arguments 13If objArgs.Count > 0 Then str 14 User = objArgs(0) 15 End If 16If objArgs.Count > 1 Then 17 strPassword = objArgs(1) 18End If 19 20' First we move into the right directory 21set objShell = createobject("wscript.shell") 22Set objFSO = CreateObject("Scripting.FileSystemObject") 23objShell.CurrentDirectory = objShell.CurrentDirectory & "\scripts" 24 25' write extra info into the log file 26If Not objFSO.FileExists(strFile) Then 27 Set objFile = objFSO.CreateTextFile(strFile) 28End If 29set objFile = nothing 30Set objTextFile = objFSO.OpenTextFile(strFile, 8, True) 31objTextFile.WriteLine("*****") 32objTextFile.WriteLine("Date/Time: " & Now()) 33objTextFile.Close 34 35objShell.Run "cmd /c mmcmd.exe -s 127.0.0.1 -u " & strUser & " -p " & strPassword & " who; exit >> " & strFile, 0, true 36set objShell = nothing 37WScript.Quit
Click the checkbox to enable the scheduling process for the script. Likewise, at any time if you wish to disable the script, return to this dialog box and uncheck this option.
Either type the date the script should run, or click the drop-down list field and select the date from the calendar.
Type or use the up/down arrows to select the time.
If this script should repeat at a designed frequency, click in the checkbox. Then, in the next two fields, select the interval – e.g., 1 week, 1 month, etc.
When all selections/entries are made, click OK.