Jump to content

Trouble Running Script


ExcessiveEvil

Recommended Posts

I have the following script to restart all my game servers (its posted somewhere on this forum):

 

<tcascript> 
<language name="VB" /> 
<waitForUserAction value="false"/> 

<scriptCode><![CDATA[ 

Imports System 
Imports TCAdminSDK.Objects

Public Class RestartGameServers
  Public Shared Sub Main() 
     'Get a list of all services
     Dim services() As Service = Service.GetServices() 
     for each s as Service in services 
           If s.CurrentStatus = ServiceStatus.Running Then
               Console.WriteLine("Restarting " & s.ServiceID)
               s.Stop()
               Threading.Thread.CurrentThread.Sleep(1000)
               s.Start()
               'Wait a few seconds before restarting the 
               'next service to avoid high loads on server
               Threading.Thread.CurrentThread.Sleep(10000)
           End If
     next 

     Console.WriteLine("Done. Press any key to continue.") 
  End Sub 
End Class 

]]></scriptCode> 

</tcascript>

 

I can run it manually, but when I schedule the task it fails to run :/

 

-I have a windows 2008 server

-The job is set to run at 6am everyday

-Runs whether the user is logged in or not

-Runs with the highest privileges

-Action: Start a program

-Details: c:\Scripts\restartAllServers.tcascript (does this need to be located elsewhere?)

 

Event log: (everyday in the following order)

Task Triggered on scheduler

Task Engine received message to start task

Task Start

Action started

Action failed to start

Action start failed

 

I've tried multiple settings in the scheduler and moved the script to some different locations. Is there anything i'm missing here?

 

Thanks in advance

Link to comment
Share on other sites

It should start correctly the way you have it configured but try configuring it to run this command:

"C:\Program Files\TCAdmin Control Panel\Monitor\TCAdminScripting.exe" c:\Scripts\restartAllServers.tcascript

start in = C:\Program Files\TCAdmin Control Panel\Monitor

Link to comment
Share on other sites

  • 2 weeks later...

In its most basic form, a shell script can provide a convenient variation of a system command where special environment settings, command options, or post-processing is applied automatically, but in a way that allows the new script to still act as a fully normal Unix command. One example would be to create a version of ls, the command to list files, giving it a shorter command name of l, which would be normally saved in a user's bin directory as /home/username/bin/l, and a default set of command options pre-supplied.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Terms of Use