Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CMS SCRIPT SCHEDULING via Scheduled Tasks 2

Status
Not open for further replies.

QMGR

Technical User
Jul 28, 2006
11
US
I have been trying to have some scripts run automatically via Scheduled Tasks in the control panel. I can get them to run successfully if we run them as daily, every half hour. However, due to certain constraints, we need them to run M-F, 10:01 AM to 7:00 PM every half an hour. When we set up the scheduled task to run this way, it never kicks off. I figure there is a “toggle” or something somewhere that I am missing.

Any help is greatly appreciated.

Thanks!

QMGR
 
If I remember correctly I had a similar problem when I tried. The way around it that I used was to create a Windows VB Script to export the data for me.
Basically the scripts that CMS creates are VB-esque scripts, all you need to do is open the in notepad and stick in a wait and a loop for the desired duration, after that exit the script in the usual manner. There are a few issues around the report engine not closing correctly; I can provide more information if you need, just let me know - it all depends on how good your vbscripting is (and mine aint that good at all!!! so it can't be that hard :)

Cheers,
NJ

PS: Please let me know if my advice has been of any use.
 
Thanks NJ! I will need for you to explain further as I have never created a Windows VB Script and I am unsure of what one is :).

I will take you up on your offer to provide more information just remember, I never "vbscripted" before, :)

QMGR
 
Can you identify if Scheduler is actually kicking them off? You should be able to go into the Task Manager and see the executable begin when the script kicks off.

We had a similar problem and it turned out to be not enough licenses during the day. The script would simply kick off and then close with no message. I had to go into the CMS Unix box and type 'who -u' to see how many users we had logged in.

Good Luck!
Perry
 
Hi Perry,

I am not that technically savvy... How would I verifiy that Scheduler is actually kicking them off? I can get them to kick off if I choose daily every half hour between 1000 - 1900, but not M-F 1000-1900.

Does that make any sense? [surprise]

Errol
 
If you paste the following into a text file and rename it to xxxx.vbs

The script will simply check for a CACHE.TMP file (amend the folder locations as to your environment), delete the file if available and then run the cms report (again, insert the location of the script file).

-- For all of you 'proper' developers/scripters out there, I don't claim to be any good at development so before any comments are made about how the script could be made better/actually have error handling... I KNOW but it worked for me. However if you want to make it better feel free ;)

on error resume next
Dim bLoop
on error resume next
bLoop = true

'Run CMS Script file
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "c:\centrevu\CVSCRIPT.EXE <enter the full UNC for CMS file>"

'Start of loop...
Do While bLoop
'Set up File system objects to create/copy files.
dim filesys, filehandle
set filesys = CreateObject ("Scripting.FileSystemObject")

'Copy file if needed?? Not needed but in case you want to copy anything!
'
' set filehandle = filesys.CreateTextFile (<DestinationFile>, true)
' set filehandle = filesys.GetFile(<SourceFile>)
' filehandle.Copy(<DestinationFile>)
'
'Check for and Delete CACHE.TMP file - helps with CACHE.TMP issues where the file gets locked!
if filesys.fileexists ("C:\CentreVu\Cache\cache.tmp") then
filesys.deletefile "C:\CentreVu\Cache\cache.tmp"
end if
'Wait for 3000 milliseconds(?) - play with this figure until it runs as frequently as you want.
wscript.sleep(3000)

'End of loop...
Loop

Cheers,
NJ

PS: Please let me know if my advice has been of any use.
 
I've just noticed something as well - the script will continue to run forever!! There's not breakout step; so if you want this to stop at a specific time you will need to enter an "exit sub" somewhere or simply kill the process from Windows taskmanager!

Cheers,
NJ

PS: Please let me know if my advice has been of any use.
 
Hmmm... Perhaps the script is running but not stopping. The way to verify that the script is in fact kicking off is to look at the Task Manager by 'Ctrl-Alt-Del' and then choose Task Manager. You should see the applications that are running listed in a window. When the scheduler kicks off CMS, it should appear on the list as soon as the application starts. When the script is done, the application should go away. If you don't see it go away then something got stuck... That might lead you to the root cause...
 
Hi All,

Thank you so much for the valuable feedback. I have determined via the task mamanger that the tasks are not hanging. Thus, I went to the comments and wanted to try the the check for a CACHE.TMP file. I built this but I get the following error message:

Script: C:\Documents and Settings\Qmanager\my documents\xxxx.vbs
Line: 30
CHar: 1
Error: Expected 'Loop'
Code: 800A03FB
Source: Microsoft VBScript Compilation Editior

I know that it was mentioned adding in a break out step "exit sub" but I am unsure of exactly where to place it and how to define it.

Sorry, I do not mean to be ignorant, but I want to make this auto script work correctly. :)

Thank you all!

Mycroft [pipe]
 
Right I've worked on this one and it works on my PC so you shouldn't have any issues.

This script will run the specified CMS Script every 5 seconds indefinately until a file is created in c:\ called end.now is created

'Setup Variable...
count = 0
EndFile="c:\end.now"
dim filesys, filehandle
set filesys = CreateObject ("Scripting.FileSystemObject")
Set WshShell = WScript.CreateObject("WScript.Shell")

'Setup command line to run, amend second bit to run different CMS Script file.
Cmd="""c:\Program Files\Avaya\CentreVu Supervisor 9.0\cvscript.exe""" & "c:\SplitSkillSummaryInterval.cvsauto"

'Start Loop
do while count <1
'Run Script and wait until complete the wait for 5 seconds.
WshShell.Run(CMD)
ReturnCode = WshShell.Run(CMD, 1, True)
wscript.sleep(5000)

'Check for EndFile, if exists then delete file and set COUNT=1 to drop out of loop
if filesys.fileexists (EndFile) then
filesys.deletefile EndFile
Count=1
Else
End If

'End of loop
loop


Cheers,
NJ

PS: Please let me know if my advice has been of any use.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top