Lance un programme
Le redemarre si crash ou le ferme
le ferme après un certain temps ( qui serait probablement mieux de fermer en fonction d'une date )
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.6.1
Author: DC_Volo
Script Function: Server Auto
Template AutoIt script.
#ce ----------------------------------------------------------------------------
; Script Start - Add your code below here
Sleep(5000)
; Open Server console
Run (" SWRepublicCommandohor2.exe CTF_engine?game=dc.ctfgamedc?GoalScore=3?timelimit=0?RespawnDelay=6?GameStats=False?BalanceTeams=false?FF=1.00?MaxPlayers=10?Maxspectators=0?MapListType=MPGame.MapListTeamDeathMatch -ini=RC4v4ctf2.ini -userini=server_user.ini -log=RC4v4ctf.log -server")
Sleep(3000)
; Reboot server if closed or crashed
if not processexists("SWRepublicCommandohor2.exe") then
run("SWRepublicCommandohor2.exe CTF_engine?game=dc.ctfgamedc?GoalScore=3?timelimit=0?RespawnDelay=6?GameStats=False?BalanceTeams=false?FF=1.00?MaxPlayers=10?Maxspectators=0?MapListType=MPGame.MapListTeamDeathMatch -ini=RC4v4ctf2.ini -userini=server_user.ini -log=RC4v4ctf.log -server")
EndIf
if ProcessClose ("SWRepublicCommandohor2.exe") Then
run("SWRepublicCommandohor2.exe CTF_engine?game=dc.ctfgamedc?GoalScore=3?timelimit=0?RespawnDelay=6?GameStats=False?BalanceTeams=false?FF=1.00?MaxPlayers=10?Maxspectators=0?MapListType=MPGame.MapListTeamDeathMatch -ini=RC4v4ctf2.ini -userini=server_user.ini -log=RC4v4ctf.log -server")
EndIf
Sleep(2592000000)
; Kill the server after 1 month
ProcessClose("SWRepublicCommandohor2.exe")
$PID = ProcessExists("SWRepublicCommandohor2.exe") ; Will return the PID or 0 if the process isn't found.
If $PID Then ProcessClose($PID)
Il lance bien le programme et l'arrête bien après un certain temps ( si quelqu'un aurai une idée pour la date au passage, j'irai voir l'aide mais une aide en plus c'est toujours ça )
Mais il ne redemarre pas
Modifié en dernier par DCVolo le dim. 24 juil. 2011 22:14, modifié 1 fois.
; Démarre le processus
$HDeb = TimerInit()
While 1
If TimerDiff($HDeb) >= (31*24*3600)*1000 Then
; Kill the server after "about" a month
$HDeb = TimerInit()
; Redemarre le processus
EndIf
; Reboot server if closed or crashed
If not processexists("SWRepublicCommandohor2.exe") Then
Run("SWRepublicCommandohor2.exe CTF_engine?game=dc.ctfgamedc?GoalScore=3?timelimit=0?RespawnDelay=6?GameStats=False?BalanceTeams=false?FF=1.00?MaxPlayers=10?Maxspectators=0?MapListType=MPGame.MapListTeamDeathMatch -ini=RC4v4ctf2.ini -userini=server_user.ini -log=RC4v4ctf.log -server")
EndIf
If ProcessClose ("SWRepublicCommandohor2.exe") Then
Run("SWRepublicCommandohor2.exe CTF_engine?game=dc.ctfgamedc?GoalScore=3?timelimit=0?RespawnDelay=6?GameStats=False?BalanceTeams=false?FF=1.00?MaxPlayers=10?Maxspectators=0?MapListType=MPGame.MapListTeamDeathMatch -ini=RC4v4ctf2.ini -userini=server_user.ini -log=RC4v4ctf.log -server")
EndIf
WEnd
A+
Y a pas de problème, y a que des solutions. Reste à les trouver.
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.6.1
Author: DC_Volo
Script Function: Server Auto
Template AutoIt script.
#ce ----------------------------------------------------------------------------
; Script Start - Add your code below here
#include <Date.au3>
Sleep(10000)
; Open Server console
Run (" SWRepublicCommandohor2.exe CTF_engine?game=dc.ctfgamedc?GoalScore=3?timelimit=0?RespawnDelay=6?GameStats=False?BalanceTeams=false?FF=1.00?MaxPlayers=10?Maxspectators=0?MapListType=MPGame.MapListTeamDeathMatch -ini=RC4v4ctf2.ini -userini=server_user.ini -log=RC4v4ctf.log -server")
Sleep(10000)
While 1
; Reboot server if closed or crashed
If not processexists("SWRepublicCommandohor2.exe") Then
Run("SWRepublicCommandohor2.exe CTF_engine?game=dc.ctfgamedc?GoalScore=3?timelimit=0?RespawnDelay=6?GameStats=False?BalanceTeams=false?FF=1.00?MaxPlayers=10?Maxspectators=0?MapListType=MPGame.MapListTeamDeathMatch -ini=RC4v4ctf2.ini -userini=server_user.ini -log=RC4v4ctf.log -server")
Sleep(10000)
EndIf
Sleep(10000)
; Kill the server definitly after about 30 days since the date Y/M/D
$DateCalc = _DateDiff( 'd',"2011/07/24 00:00:00",_NowCalc())
if $DateCalc >= 30 Then
Run ("Kill_Server.exe")
EndIf
Sleep(10000)
WEnd
RunWait à la place de run suivi d'un Sleep
$DateCalc = _DateDiff( 'M',$debut,_NowCalc()) ;Calcul en mois
Pourquoi deux programmes ? Tu peux inclure le code du second dans le premier et pour alléger faire une fonction
La boucle fonctionnera sur un mois car tu ne définis pas une nouvelle date de calcul.
$debut = _NowCalc()
While 1
; Reboot server if closed or crashed
If not processexists("SWRepublicCommandohor2.exe") Then
RunWait("SWRepublicCommandohor2.exe CTF_engine?game=dc.ctfgamedc?GoalScore=3?timelimit=0?RespawnDelay=6?GameStats=False?BalanceTeams=false?FF=1.00?MaxPlayers=10?Maxspectators=0?MapListType=MPGame.MapListTeamDeathMatch -ini=RC4v4ctf2.ini -userini=server_user.ini -log=RC4v4ctf.log -server")
;~ Run("SWRepublicCommandohor2.exe CTF_engine?game=dc.ctfgamedc?GoalScore=3?timelimit=0?RespawnDelay=6?GameStats=False?BalanceTeams=false?FF=1.00?MaxPlayers=10?Maxspectators=0?MapListType=MPGame.MapListTeamDeathMatch -ini=RC4v4ctf2.ini -userini=server_user.ini -log=RC4v4ctf.log -server")
;~ Sleep(10000)
EndIf
Sleep(10000)
; Kill the server definitly after about 30 days since the date Y/M/D
$DateCalc = _DateDiff( 'M',$debut,_NowCalc()) ;Calcul en mois
If $DateCalc >= 1 Then ;Déjà 1 mois ?
Kill_Server()
$debut = _NowCalc() ; Régénère la date du début
EndIf
Sleep(10000)
WEnd
Func Kill_Server()
Sleep(10000)
ProcessClose("Server_Hor.exe")
Sleep(5000)
ProcessClose("SWRepublicCommandohor2.exe")
EndIf ; ==> Kill_server
Le problème c'est que si le serveur dedié est relancé ( windows), sa relancera pour un mois et ça je veux pas.
Oui je voulais le faire sur un seul programme le truc c'est qu'a cause de la boucle infini pour redemarrer le serveur je pense qu'il pourrait y avoir conflit et que sa eteindrait le programme mais pas le serveur.
ce que je comprend pas c'est que dans ton exemple tu kill en premier temps
le programme qui doit ensuite killer le serveur, alors que comment un programme eteint pourrait il faire quoique se soit après avoir été eteint ? A moins qu'il garde en memoire l'action quelque part et que sa fin prend vraiment fin à la fin de toute action?