ExcessiveEvil Posted September 28, 2011 Share Posted September 28, 2011 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 More sharing options...
LFA Posted September 28, 2011 Share Posted September 28, 2011 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.tcascriptstart in = C:\Program Files\TCAdmin Control Panel\Monitor Link to comment Share on other sites More sharing options...
ExcessiveEvil Posted September 29, 2011 Author Share Posted September 29, 2011 Thanks for the help. I've updated my task and will see if it now runs tomorrow morning Link to comment Share on other sites More sharing options...
ExcessiveEvil Posted October 11, 2011 Author Share Posted October 11, 2011 Okay i've tried running the script like this a few times, and it still isn't working Seems like it likes to change the parameter you told me to put in Any ideas? (or am I doing it wrong? ) Link to comment Share on other sites More sharing options...
LFA Posted October 11, 2011 Share Posted October 11, 2011 I think you uploaded the wrong image. Take a look at the tcadmin task that is created automatically. Configure it the same way. Link to comment Share on other sites More sharing options...
ExcessiveEvil Posted October 11, 2011 Author Share Posted October 11, 2011 Sorry correct image is there now. Link to comment Share on other sites More sharing options...
LFA Posted October 11, 2011 Share Posted October 11, 2011 Set "program/script" to the full path to tcadminscripting.exe Set "add arguments" to the full path to Servers.tcascript Set "start in" to the TCAdmin\Monitor folder Link to comment Share on other sites More sharing options...
ExcessiveEvil Posted October 12, 2011 Author Share Posted October 12, 2011 Got it working! Thanks Link to comment Share on other sites More sharing options...
Teko Jim Posted October 20, 2011 Share Posted October 20, 2011 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.