Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
919 connectés 

  FORUM HardWare.fr
  Windows & Software
  Win NT/2K/XP

  Service windows avec un .bat

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Service windows avec un .bat

n°2769509
fgiuliano
Posté le 01-04-2008 à 11:59:11  profilanswer
 

Bonjour à tous  :)  
 
J'ai installé sur une machine virtuelle avec Windows Server 2003 et une application nommée vTiger.
 
Pour pouvoir accéder à vTiger, on doit lancer un .bat.
Ce que j'aimerai faire c'est que cette application soit tjs lancée même si il n'y a personne de logger sur la machine virtuelle.
 
Donc, ce que j'ai fait, c'est créer un service grâce à instsrv et srvany, ce qui a très bien fonctionné.
 
Ensuite, je suis allée dans HKLM\SYSTEM\CurrentControlSet\Services\Mon_Service, j'ai ajouté une Key du nom Parameters et dedans une sous-clé (string) Application avec comme Value Data le chemin d'accès complet jusqu'à mon .bat.
 
Mais ça ne fonctionne pas... Mon service est bien démarré mais ça ne lance pas le .bat et à chaque redémarrage, ma sous-clé Application a disparu...
 
Est-ce que quelqu'un pourrait m'aider?
 
Merci d'avance

mood
Publicité
Posté le 01-04-2008 à 11:59:11  profilanswer
 

n°2769533
Je@nb
Modérateur
Kindly give dime
Posté le 01-04-2008 à 13:23:17  profilanswer
 

Il fait quoi le bat ?

n°2769535
fgiuliano
Posté le 01-04-2008 à 13:35:18  profilanswer
 

Voici mon fichier .bat:
 

Code :
  1. echo off
  2. set mysql_dir=C:\Program Files\vtigercrm5\mysql
  3. set mysql_username=root
  4. set mysql_password=xxx
  5. set mysql_port=3307
  6. set mysql_bundled=true
  7. set apache_dir=C:\Program Files\vtigercrm5\apache
  8. set apache_bin=APACHEBIN
  9. set apache_conf=APACHECONF
  10. set apache_port=82
  11. set apache_bundled=true
  12. set apache_service=true
  13. echo %WINDIR%
  14. set FIND_STR="%WINDIR%\system32\findstr.exe"
  15. set SLEEP_STR="%WINDIR%\system32\ping.exe"
  16. goto initiate
  17. :initiate
  18. rem if true means , vtiger crm mysql is being used
  19. if "test" == "%1test" goto start1
  20. set VTIGER_HOME=%1
  21. goto start2
  22. :start1
  23. cd ..
  24. set VTIGER_HOME=%cd%
  25. :start2
  26. if %apache_bundled% == true goto checkBundledApache
  27. if %apache_bundled% == false goto checkUserApache
  28. :checkBundledApache
  29. echo "APACHEBUNDLED"
  30. cd /d %apache_dir%
  31. if %apache_service% == true goto StartApacheService
  32. start bin\Apache -f conf\httpd.conf
  33. IF ERRORLEVEL 1 goto stopservice
  34. goto checkmysql
  35. :StartApacheService
  36. echo ""
  37. echo "making an attempt to kill any existing vtigercrm service"
  38. echo ""
  39. bin\apache -k stop -n vtigercrm504
  40. bin\apache -k uninstall -n vtigercrm504
  41. echo "Uninstalling apache service again for confirmation after sleeping for 10 seconds"
  42. echo ""
  43. %SLEEP_STR% -n 10 127.0.0.1>nul
  44. bin\apache -k stop -n vtigercrm504
  45. bin\apache -k uninstall -n vtigercrm504
  46. echo ""
  47. echo ""
  48. echo "Installing  vtigercrm504 apache service after sleeping for 10 seconds"
  49. echo ""
  50. %SLEEP_STR% -n 10 127.0.0.1>nul
  51. bin\apache -k install -n vtigercrm504 -f conf\httpd.conf
  52. echo ""
  53. echo "Starting  vtigercrm504 apache service"
  54. echo ""
  55. bin\apache -n vtigercrm504 -k start
  56. IF ERRORLEVEL 1 goto stopservice
  57. goto checkmysql
  58. :checkUserApache
  59. netstat -anp tcp >port.txt
  60. %FIND_STR% "\<%apache_port%\>" port.txt
  61. if ERRORLEVEL 1 goto apachenotrunning
  62. %FIND_STR% "\<%apache_port%\>" port.txt >list.txt
  63. %FIND_STR% "LISTEN.*" list.txt
  64. if ERRORLEVEL 1 goto apachenotrunning
  65. echo ""
  66. echo "Apache is running"
  67. echo ""
  68. goto checkmysql
  69. :apachenotrunning
  70. echo ""
  71. echo ""
  72. echo "Apache in the location %apache_dir% is not running. Start Apache and then start vtiger crm"
  73. echo ""
  74. echo ""
  75. set /p pt=Press Any Key to Continue...
  76. goto end
  77.                
  78. :checkmysql
  79. cd /d %mysql_dir%\bin
  80. echo %cd%
  81. echo ""
  82. echo "Checking the whether the MySQL server is already running"
  83. echo ""
  84. mysql --port=%mysql_port% --user=%mysql_username% --password=%mysql_password% -e "show databases" > NUL
  85. IF ERRORLEVEL 1 goto startmysql
  86. echo ""
  87. echo ""
  88. ECHO  "MySQL is already started and running"
  89. echo ""
  90. echo ""
  91. goto checkdatabase
  92. :startmysql
  93. echo ""
  94. echo "Starting MySQL on port specified by the user"
  95. echo ""
  96. start mysqld-nt -b .. --skip-bdb --log-queries-not-using-indexes --log-slow-admin-statements --log-error --low-priority-updates --log-slow-queries=vtslowquery.log --default-storage-engine=InnoDB --datadir=../data --port=%mysql_port%
  97. %SLEEP_STR% -n 11 127.0.0.1>nul
  98. mysql --port=%mysql_port% --user=%mysql_username% --password=%mysql_password% -e "show databases" > NUL
  99. IF ERRORLEVEL 1 goto notstarted
  100. echo ""
  101. echo "Started MySQL on port specified by the user"
  102. echo ""
  103. goto checkdatabase
  104. :checkdatabase
  105. echo ""
  106. echo "check to see if vtigercrm504 database already exists"
  107. echo ""
  108. mysql --port=%mysql_port% --user=%mysql_username% --password=%mysql_password% -e "show databases like 'vtigercrm504'" | "%WINDIR%\system32\find.exe" "vtigercrm504" > NUL
  109. IF ERRORLEVEL 1 goto dbnotexists
  110. echo ""
  111. ECHO  "vtigercrm504 database exists"
  112. echo ""
  113. goto end
  114. :dbnotexists
  115. echo ""
  116. ECHO "vtigercrm504 database does not exist"
  117. echo ""
  118. echo %cd%
  119. echo ""
  120. echo "Proceeding to create database vtigercrm504 and populate the same"
  121. echo ""
  122. mysql --user=%mysql_username% --password=%mysql_password% --port=%mysql_port% -e "create database if not exists vtigercrm504"
  123. echo ""
  124. echo "vtigercrm504 database created"
  125. echo ""
  126. goto end
  127. :notstarted
  128. echo ""
  129. echo ""
  130. ECHO "Unable to start the MySQL server at port %mysql_port%. Check if the port is free"
  131. echo ""
  132. echo ""
  133. set /p pt=Press Any Key to Continue...
  134. goto end
  135. :stopservice
  136. echo ""
  137. echo ""
  138. echo ""
  139. echo "********* Service not started as port # %apache_port% occupied ******* "
  140. echo ""
  141. echo ""
  142. echo ""
  143. echo ""
  144. echo "********* I am sorry. I am not able to start the product as the apache port that you have specified:  port # %apache_port% seems to be occupied ******* "
  145. echo ""
  146. echo ""
  147. echo "You could give me a different port number if you wish by doing the following ...."
  148. echo ""
  149. echo ""
  150. echo "********* Open the apache/conf/httpd.conf file, search for 'Listen' and change the port number ******* "
  151. echo ""
  152. echo ""
  153. echo ""
  154. echo ""
  155. echo "********* Change the apache port in startvTiger.bat and stopvTiger.bat too and then access the product from the browser in the following manner http://localhost:apacheport******* "
  156. echo ""
  157. echo ""
  158. echo "Thank You"
  159. echo ""
  160. echo ""
  161. set /p pt=Press Any Key to Continue...
  162. goto end
  163. :end
  164. cd /d %VTIGER_HOME%\bin


Message édité par fgiuliano le 01-04-2008 à 13:35:40
n°2769536
Je@nb
Modérateur
Kindly give dime
Posté le 01-04-2008 à 13:37:56  profilanswer
 

Configure apache et mysql pour qu'ils démarrent en auto et ça devrait se lancer auto

n°2769542
fgiuliano
Posté le 01-04-2008 à 13:47:13  profilanswer
 

Je l'avais déjà fait et ça ne fonctionnait pas...
Mais je vais retenter.
 
Et en mettant quand même un service pour mon .bat?
 
Merci beaucoup de ta réponse.  :)

n°2769547
Je@nb
Modérateur
Kindly give dime
Posté le 01-04-2008 à 13:52:20  profilanswer
 

Non, ça se fait pas de mettre en service un .bat
 
D'ailleurs pourquoi ta pas installé apache, mysql et après installer vtiger plutôt que d'utiliser leur truc infame qui combine les 3 ?

n°2769556
fgiuliano
Posté le 01-04-2008 à 14:14:05  profilanswer
 

C'est ce que j'avais fait au départ mais ça ne fonctionnait pas...
J'ai dû louper qqch...
 
Bon je teste tout ça et vous redis si ça fonctionne!  
Merci


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Windows & Software
  Win NT/2K/XP

  Service windows avec un .bat

 

Sujets relatifs
Service windows désactivé seulWindows 2003 Small Business Server Service Pack 2
[Topic Unique] Windows Vista Service Pack 2Service windows
[service] creer un service windows d'un exe quelconqueProblème installation service pack ss windows server 2003
le Service Pack 1 de Windows Vista devrait voir le jourProblème interaction mstsc et service windows
Probleme demarage service sans fil windowscomment faire pour qu'un service windows 'attende' un autre?
Plus de sujets relatifs à : Service windows avec un .bat


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR