View previous topic :: View next topic |
Author |
Message |
alpha_one_x86 Guru
Joined: 29 Oct 2006 Posts: 544
|
Posted: Sat Dec 30, 2006 11:13 am Post subject: [boot] creation script pour service (résolut) |
|
|
C'est surment une erreur de d�butant car j'ai pas l'habitude de faire de srcipt pour service
/mnt/servstock/l2_serv/login/startLoginServer.sh:
Code: | #!/bin/bash
cd /mnt/servstock/l2_serv/login/
start-stop-daemon --start --quiet --pidfile /var/run/loginl2.pid --startas 'nice -n 5 java -Xms512m -Xmx512m -cp javolution.jar:c3p0-0.9.0.jar:mysql-connector-java-5.0.4-bin.jar:l2jserver.jar net.sf.l2j.loginserver.LoginServer' & |
/etc/init.d/l2j_login:
Code: | #!/sbin/runscript
# Copyright (c) 2007 l2j login alpha.super-one@laposte.net
depend() {
use logger dns
need net
}
start() {
ebegin "Starting Login L2"
/mnt/servstock/l2_serv/login/startLoginServer.sh
eend $?
}
stop() {
ebegin "Stopping Login L2"
start-stop-daemon --stop --quiet --pidfile /var/run/loginl2.pid
eend $?
}
|
et ca marche pas dans le script, car si j'eleve les guillement il me dit que l'option X pour start-stop-daemon n'exite pas, mais cette option doit etre aplliquer a java...
Qui peu me debloquer?
Last edited by alpha_one_x86 on Mon Jan 01, 2007 4:54 pm; edited 5 times in total |
|
Back to top |
|
|
alpha_one_x86 Guru
Joined: 29 Oct 2006 Posts: 544
|
Posted: Sat Dec 30, 2006 1:02 pm Post subject: |
|
|
il faut arriver a lancer la commande tout en veroillant le pid tout en ne bloquand pas le script |
|
Back to top |
|
|
Enlight Advocate
Joined: 28 Oct 2004 Posts: 3519 Location: Alsace (France)
|
Posted: Sat Dec 30, 2006 2:42 pm Post subject: |
|
|
A première vue, je pense que le "&" est mal placé et détache start-stop-daemon, j'utiliserais plutôt l'option -b. |
|
Back to top |
|
|
alpha_one_x86 Guru
Joined: 29 Oct 2006 Posts: 544
|
Posted: Sat Dec 30, 2006 10:27 pm Post subject: |
|
|
Code: | toc ~ # start-stop-daemon -b --start --quiet --pidfile /var/run/loginl2.pid --startas nice -n 5 java -Xms512m -Xmx512m -cp javolution.jar:c3p0-0.9.0.jar:mysql-connector-java-5.0.4-bin.jar:l2jserver.jar net.sf.l2j.loginserver.LoginServer
start-stop-daemon: invalid option -- X
Try `start-stop-daemon --help' for more information.
toc ~ #
|
Marche pas l'option -b. |
|
Back to top |
|
|
Temet Advocate
Joined: 14 Mar 2006 Posts: 2586 Location: 92
|
Posted: Sat Dec 30, 2006 10:34 pm Post subject: |
|
|
Un truc un peu loufoque ...
Je tenterais, juste pour voir, de mettre la commande qui tue dans un script... et je pense que start-stop-daemon ne verra plus le -X.
Tente toujours
(désolé si je dis une connerie ... de plus)
EDIT : Commande qui tue : Code: | nice -n 5 java -Xms512m -Xmx512m -cp javolution.jar:c3p0-0.9.0.jar:mysql-connector-java-5.0.4-bin.jar:l2jserver.jar net.sf.l2j.loginserver.LoginServer |
|
|
Back to top |
|
|
alpha_one_x86 Guru
Joined: 29 Oct 2006 Posts: 544
|
Posted: Sat Dec 30, 2006 10:50 pm Post subject: |
|
|
ca marche pas dans un script. |
|
Back to top |
|
|
Enlight Advocate
Joined: 28 Oct 2004 Posts: 3519 Location: Alsace (France)
|
Posted: Sat Dec 30, 2006 11:23 pm Post subject: |
|
|
Nan mais à mon avis faut quoter de nice à la fin de la commande. D'ailleurs non tu dois pas utiliser nice dans la commande, mais l'option correspondante de start-stop-daemon.
edit : et non la solution magique n'est pas de mettre des quotes en plus... elle estd ans les 5 premières lignes du man... |
|
Back to top |
|
|
alpha_one_x86 Guru
Joined: 29 Oct 2006 Posts: 544
|
Posted: Sat Dec 30, 2006 11:38 pm Post subject: |
|
|
Je suis pas ou tu vois ça:
Code: | START-STOP-DAEMON(8) Debian GNU/Linux START-STOP-DAEMON(8)
NAME
start-stop-daemon - start and stop system daemon programs
SYNOPSIS
start-stop-daemon -S|--start options [--] arguments
start-stop-daemon -K|--stop options
start-stop-daemon -H|--help
start-stop-daemon -V|--version
DESCRIPTION
start-stop-daemon is used to control the creation and termination of system-level processes. Using the --exec, --pidfile, --user, and --name options, start-stop-daemon can be
configured to find existing instances of a running process.
With --start, start-stop-daemon checks for the existence of a specified process. If such a process exists, start-stop-daemon does nothing, and exits with error status 1 (0 if
--oknodo is specified). If such a process does not exist, it starts an instance, using either the executable specified by --exec, (or, if specified, by --startas). Any arguments
given after -- on the command line are passed unmodified to the program being started. If --retry is specified then start-stop-daemon will check that the process(es) have termi-
nated.
With --stop, start-stop-daemon also checks for the existence of a specified process. If such a process exists, start-stop-daemon sends it the signal specified by --signal, and
exits with error status 0. If such a process does not exist, start-stop-daemon exits with error status 1 (0 if --oknodo is specified).
|
EDIT: je suis encore passer plein de fois a coter, j'ai je pense compris mon erreur:
Code: | start-stop-daemon -b --start --quiet --pidfile /var/run/loginl2.pid --startas /mnt/servstock/l2_serv/login/ -x java -Xms512m -Xmx512m -cp javolution.jar:c3p0-0.9.0.jar:mysql-connector-java-5.0.4-bin.jar:l2jserver.jar net.sf.l2j.loginserver.LoginServer |
Ca devrai marcher mais ça marche toujours pas... je re lit le man....
Last edited by alpha_one_x86 on Sat Dec 30, 2006 11:43 pm; edited 1 time in total |
|
Back to top |
|
|
Enlight Advocate
Joined: 28 Oct 2004 Posts: 3519 Location: Alsace (France)
|
Posted: Sat Dec 30, 2006 11:42 pm Post subject: |
|
|
Là?
alpha_one_x86 wrote: | Je suis pas ou tu vois ça:
Quote: | START-STOP-DAEMON( Debian GNU/Linux START-STOP-DAEMON(
NAME
start-stop-daemon - start and stop system daemon programs
SYNOPSIS
start-stop-daemon -S|--start options [--] arguments
start-stop-daemon -K|--stop options
start-stop-daemon -H|--help
start-stop-daemon -V|--version
DESCRIPTION
start-stop-daemon is used to control the creation and termination of system-level processes. Using the --exec, --pidfile, --user, and --name options, start-stop-daemon can be
configured to find existing instances of a running process.
With --start, start-stop-daemon checks for the existence of a specified process. If such a process exists, start-stop-daemon does nothing, and exits with error status 1 (0 if
--oknodo is specified). If such a process does not exist, it starts an instance, using either the executable specified by --exec, (or, if specified, by --startas). Any arguments
given after -- on the command line are passed unmodified to the program being started. If --retry is specified then start-stop-daemon will check that the process(es) have termi-
nated.
With --stop, start-stop-daemon also checks for the existence of a specified process. If such a process exists, start-stop-daemon sends it the signal specified by --signal, and
exits with error status 0. If such a process does not exist, start-stop-daemon exits with error status 1 (0 if --oknodo is specified).
|
|
|
|
Back to top |
|
|
alpha_one_x86 Guru
Joined: 29 Oct 2006 Posts: 544
|
Posted: Sat Dec 30, 2006 11:44 pm Post subject: |
|
|
En fr ça donne?
Eureka, j'ai peu etre trouver.... Non:
Code: | toc ~ # /etc/init.d/l2j_login start
* Caching service dependencies ... [ ok ]
* Starting Login L2 ... [ !! ]
toc ~ # |
/etc/init.d/l2j_login:
Code: | #!/sbin/runscript
# Copyright (c) 2007 l2j login alpha.super-one@laposte.net
depend() {
use logger dns
need net
}
start() {
ebegin "Starting Login L2"
start-stop-daemon -b -N 5 --start --quiet --pidfile /var/run/loginl2.pid --startas /mnt/servstock/l2_serv/login/ -x /mnt/servstock/l2_serv/login/startLoginServer.sh
eend $?
}
stop() {
ebegin "Stopping Login L2"
start-stop-daemon --stop --quiet --pidfile /var/run/loginl2.pid
eend $?
}
|
/mnt/servstock/l2_serv/login/startLoginServer.sh:
Code: | #!/bin/bash
cd /mnt/servstock/l2_serv/login/
java -Xms128m -Xmx512m -cp javolution.jar:c3p0-0.9.0.jar:mysql-connector-java-5.0.4-bin.jar:l2jserver.jar net.sf.l2j.loginserver.LoginServer |
Last edited by alpha_one_x86 on Sat Dec 30, 2006 11:54 pm; edited 1 time in total |
|
Back to top |
|
|
geekounet Bodhisattva
Joined: 11 Oct 2004 Posts: 3772
|
Posted: Sat Dec 30, 2006 11:51 pm Post subject: Re: [boot] creation script pour service (truc de debutant) |
|
|
Bon, je ne voulais pas te répondre parce que la solution est trouvable par une simple lecture du man et que je ne veux pas faire d'effort à aider qq'un qui n'en fait pas un minimum dans ses recherches, mais bon c'est plus fort que moi, j'ai la réponse depuis que j'ai lu le topic en début d'aprem et faut que je donne la solution sinon je vais mal dormir si je laisse des erreurs comme ça ...
Alors déjà, ça sert à rien d'appeller un script externe pour juste un "cd + start-stop-daemon", ensuite le nice ça se donne en paramètre à start-stop-daemon avec --nice-level (ou -N), et enfin le paramètre à donner à --startas est seulement l'executable à lancer et ses arguments sont placés après les -- en fin de ligne.
Et il me semble bien que comme pour les ebuilds, tu n'as pas le droit de poser un copyright sur un script d'init gentoo, ça reste la propriété de gentoo (ça fait polémique pour les ebuilds cette histoire).
Et tout ceci donne celà :
/etc/init.d/l2j_login: | #!/sbin/runscript
depend() {
use logger dns
need net
}
start() {
ebegin "Starting Login L2"
cd /mnt/servstock/l2_serv/login/
start-stop-daemon --start --quiet --pidfile /var/run/loginl2.pid --nice-level 5 --startas java -- -Xms512m -Xmx512m \
-cp javolution.jar:c3p0-0.9.0.jar:mysql-connector-java-5.0.4-bin.jar:l2jserver.jar net.sf.l2j.loginserver.LoginServer
eend $?
}
stop() {
ebegin "Stopping Login L2"
start-stop-daemon --stop --quiet --pidfile /var/run/loginl2.pid
eend $?
}
|
Et la prochaine fois : LIS 10 FOIS LE MAN EN ENTIER AVANT DE POSER UNE QUESTION Je veux bien être sympa mais ya des limites
EDIT : pour le copyright, c'est bien ça parce que le script d'init est exécuté par runscript (pour un source, ce qui revient à l'y inclure) qui appartient à Gentoo, donc le script d'init reste sous copyright Gentoo |
|
Back to top |
|
|
alpha_one_x86 Guru
Joined: 29 Oct 2006 Posts: 544
|
Posted: Sat Dec 30, 2006 11:58 pm Post subject: |
|
|
Avec ton post(merci j'ai fait des effort mes j('**'ai pas compris le man):
Code: | toc ~ # /etc/init.d/l2j_login start
* Caching service dependencies ... [ ok ]
* Starting Login L2 ...
/sbin/start-stop-daemon: unrecognized option `--nice-level'
Try `/sbin/start-stop-daemon --help' for more information. [ !! ]
toc ~ # nano /etc/init.d/l2j_login
toc ~ # /etc/init.d/l2j_login start
* Caching service dependencies ... [ ok ]
* Starting Login L2 ...
/sbin/start-stop-daemon: Unable to start java: No such file or directory (No such file or directory) [ !! ]
toc ~ # |
|
|
Back to top |
|
|
geekounet Bodhisattva
Joined: 11 Oct 2004 Posts: 3772
|
Posted: Sun Dec 31, 2006 12:04 am Post subject: |
|
|
J'ai fais 2-3 fautes de syntaxe et t'es pas capable de les corriger en vérifiant dans le man ??
EDIT: remplace le --startas par --exec, ça devrait mieux marcher
Last edited by geekounet on Sun Dec 31, 2006 12:06 am; edited 1 time in total |
|
Back to top |
|
|
Enlight Advocate
Joined: 28 Oct 2004 Posts: 3519 Location: Alsace (France)
|
Posted: Sun Dec 31, 2006 12:05 am Post subject: |
|
|
Mais bon sang lis ce foutu man, tu verras qu'il a fait une miniscule faute en en mettant nice-level au lieu de nicelevel... et maintenant qu'on t'as maché le script et qu'on doit te faire le débuggage en plus, tu me vires ce copyright stp! |
|
Back to top |
|
|
alpha_one_x86 Guru
Joined: 29 Oct 2006 Posts: 544
|
Posted: Sun Dec 31, 2006 12:13 am Post subject: |
|
|
copyrith virer depuis qu'on me l'a dit, mais j'ai vu quelqu'un (no-ip) qui a mit un copy rith donc j'ai fait pareil...
J'ai lu ce man, voir script + haut, moi aussi j'ai fait quel petite faute... |
|
Back to top |
|
|
alpha_one_x86 Guru
Joined: 29 Oct 2006 Posts: 544
|
Posted: Sun Dec 31, 2006 12:15 am Post subject: |
|
|
Code: | #!/sbin/runscript
depend() {
use logger dns
need net
}
start() {
ebegin "Starting Login L2"
start-stop-daemon --start --quiet --pidfile /var/run/loginl2.pid -N 5 -a /mnt/servstock/l2_serv/login/ --exec java -- -Xms32m -Xmx128m \
-cp javolution.jar:c3p0-0.9.0.jar:mysql-connector-java-5.0.4-bin.jar:l2jserver.jar net.sf.l2j.loginserver.LoginServer
eend $?
}
stop() {
ebegin "Stopping Login L2"
start-stop-daemon --stop --quiet --pidfile /var/run/loginl2.pid
eend $?
}
|
Mais voila c'est normal qu'il marche pas, car le binaire java n'y est pas, et si je change le pach c'est les fichier du serveur qui y sont pas... |
|
Back to top |
|
|
Tuxicomane Apprentice
Joined: 14 Nov 2006 Posts: 290 Location: Val-de-Marne, FRANCE
|
Posted: Sun Dec 31, 2006 12:28 am Post subject: |
|
|
pach c'est pour path ? |
|
Back to top |
|
|
alpha_one_x86 Guru
Joined: 29 Oct 2006 Posts: 544
|
Posted: Sun Dec 31, 2006 5:55 am Post subject: |
|
|
oui, j'ai meme tester:
start-stop-daemon -u root --start --quiet --pidfile /var/run/loginl2.pid -N 5 -a /usr/bin/ --exec java -- -Xms32m -Xmx128m \
-cp javolution.jar:c3p0-0.9.0.jar:mysql-connector-java-5.0.4-bin.jar:l2jserver.jar net.sf.l2j.loginserver.LoginServer |
|
Back to top |
|
|
alpha_one_x86 Guru
Joined: 29 Oct 2006 Posts: 544
|
Posted: Sun Dec 31, 2006 6:05 am Post subject: |
|
|
Code: |
#!/sbin/runscript
depend() {
use logger dns
need net
}
start() {
ebegin "Starting Login L2"
cd /mnt/servstock/l2_serv/login/
start-stop-daemon -b --chdir /mnt/servstock/l2_serv/login/ --start --quiet --pidfile /var/run/loginl2.pid -N 5 --exec /usr/bin/java -- -Xms32m -Xmx128m \
-cp javolution.jar:c3p0-0.9.0.jar:mysql-connector-java-5.0.4-bin.jar:l2jserver.jar net.sf.l2j.loginserver.LoginServer
eend $?
}
stop() {
ebegin "Stopping Login L2"
start-stop-daemon --stop --quiet --pidfile /var/run/loginl2.pid
eend $?
}
|
|
|
Back to top |
|
|
alpha_one_x86 Guru
Joined: 29 Oct 2006 Posts: 544
|
Posted: Sun Dec 31, 2006 7:09 am Post subject: |
|
|
Mon probleme vien d'ici:
Code: | start-stop-daemon -b --chdir /mnt/servstock/l2_serv/login/ --start --quiet --pidfile /var/run/loginl2.pid -N 5 --exec /usr/bin/java -- -Xms32m -Xmx128m \
-cp javolution.jar:c3p0-0.9.0.jar:mysql-connector-java-5.0.4-bin.jar:l2jserver.jar net.sf.l2j.loginserver.LoginServer |
Le fichier n'est pas creer:
/var/run/loginl2.pid
donc ca bug pour l'arret |
|
Back to top |
|
|
dapsaille Advocate
Joined: 02 Aug 2004 Posts: 2366 Location: Paris
|
Posted: Sun Dec 31, 2006 9:32 am Post subject: |
|
|
Salut à toi ..
Peux tu enlever le non-résolu de ton titre svp
Ce matin je me sens l'humeur modératrive ... bon ok je sors
Ceci dit je n'ais pas suivi tout le thread (je viens de me lever et suis plutot du genre à poil et la tete dans le ....)
mais si c'est un lock qui t'empêche de démarrer/arrêter un script perso .. bah crée le dans ce cas :p |
|
Back to top |
|
|
alpha_one_x86 Guru
Joined: 29 Oct 2006 Posts: 544
|
Posted: Sun Dec 31, 2006 7:42 pm Post subject: |
|
|
Il doit etre genere en auto, et c'est pas fait donc l'id de mon processue n'est pas enregistrer, et il me faut cette id et par une id au hazard. |
|
Back to top |
|
|
titoucha Advocate
Joined: 21 Jul 2005 Posts: 2374 Location: Genève
|
Posted: Mon Jan 01, 2007 4:42 am Post subject: |
|
|
Comme le dit si bien @dapsaille, il faut que tu enlèves le non-résolu de ton titre. _________________ Assurez-vous que le titre de votre message soit conforme aux conventions de ce forum (paragraphe 3/3 : Comment poster sur le forum ??) |
|
Back to top |
|
|
alpha_one_x86 Guru
Joined: 29 Oct 2006 Posts: 544
|
Posted: Mon Jan 01, 2007 12:59 pm Post subject: |
|
|
ok, personne ne peu m'aider pour le pid?
Last edited by alpha_one_x86 on Mon Jan 01, 2007 2:56 pm; edited 1 time in total |
|
Back to top |
|
|
Enlight Advocate
Joined: 28 Oct 2004 Posts: 3519 Location: Alsace (France)
|
Posted: Mon Jan 01, 2007 1:14 pm Post subject: |
|
|
Qu'est ce que ça peut me saouler ce genre de reflexion, je crois qu'on t'aide pas mal, après on est pas devant ta machine, et on est pas béta-testeurs de tous les trucs que tu voudrait pouvoir installer sur ta machine!
Par contre je crois que si t'avais un peu de bon sens, tu commencerais par virer le quiet voir si tu reçois un message qui nous éclaire un peu plus au moins... parceque là, mon fichier est pas crée... à part "c'est moche!" tu veux qu'on te dise quoi????
D'ailleurs j'osais pas poser la question mais tant qu'on y'est, tu le lance avec quel utilisateur ton script?
edit : Et quand on te dit de pas mettre (non résolu) e que tu devrais savoir après quelques mois passés ici, ça veut pas dire que tu dopis mettre (résolu) |
|
Back to top |
|
|
|