Pages : 1
#1 Le 10/05/2012, à 22:48
- Spacemarmotte
Crontab
Bonjour à tous,
je suis nouveau Linuxien (dans un but de self-hosting)
de ce côté là, ça va, je progresse..
par contre et pour profiter du serveur allumé en permanence; je viens d'installer 1 serveur minecraft (pour les enfants !!)
je voudrai que ce serveur démarre le matin et se coupe le soir.. je pensais donc lancer la commande (que je lance normalement dans le terminal) par un crontab...
mais je ne maîtrise pas !!
est-ce que je peux le faire tel quel:
# lancement:
0 7 * * * /home/eric/minecraft_server/ java -Xms1024M -Xmx1024M -jar minecraft_server.jar nogui
# Arret
... bin la je n'en sais rien !! il suffit de taper stop dans le terminal pour éteindre le serveur ... mais comment le mettre en crontab ??
merci pour vos lumières..
Eric
Hors ligne
#2 Le 10/05/2012, à 22:52
- Pacifick_FR42
Re : Crontab
... pour l'arrêt... c'est pas un souci, mais aucune chance pour qu'il ce mettent en route le matin à 7 heures... vu qu'il sera éteint, donc... (??)
Hors ligne
#3 Le 10/05/2012, à 22:54
- Spacemarmotte
Re : Crontab
Merci Pacifik ...
la machine est allumée 24/24 ... c'est le serveur minecraft qui sera éteint.
(ou alors, je n'ai pas compris ta réponse ... ce qui est possible aussi ! ;-) )
Hors ligne
#4 Le 10/05/2012, à 22:57
- Pacifick_FR42
Re : Crontab
Ok, c'est moi qui est mal compris ta question...
Donc donne le retour de :
ls -l /etc/init.d/
Hors ligne
#5 Le 10/05/2012, à 23:03
- Spacemarmotte
Re : Crontab
... je veux bien que tu m'explique ce que c'est ;-)
total 200
lrwxrwxrwx 1 root root 21 déc. 8 19:27 acpid -> /lib/init/upstart-job
-rwxr-xr-x 1 root root 652 janv. 5 2010 acpi-support
lrwxrwxrwx 1 root root 21 avril 4 06:12 alsa-restore -> /lib/init/upstart-job
lrwxrwxrwx 1 root root 21 avril 4 06:12 alsa-store -> /lib/init/upstart-job
lrwxrwxrwx 1 root root 21 avril 18 22:34 anacron -> /lib/init/upstart-job
-rwxr-xr-x 1 root root 7621 févr. 14 18:53 apache2
-rwxr-xr-x 1 root root 4596 avril 12 13:17 apparmor
lrwxrwxrwx 1 root root 21 avril 27 18:34 apport -> /lib/init/upstart-job
lrwxrwxrwx 1 root root 21 oct. 25 2011 atd -> /lib/init/upstart-job
lrwxrwxrwx 1 root root 21 déc. 17 16:40 avahi-daemon -> /lib/init/upstart-job
lrwxrwxrwx 1 root root 21 nov. 25 23:17 binfmt-support -> /lib/init/upstart-job
lrwxrwxrwx 1 root root 21 mars 21 22:05 bluetooth -> /lib/init/upstart-job
-rwxr-xr-x 1 root root 2444 juil. 14 2011 bootlogd
-rwxr-xr-x 1 root root 2125 août 29 2011 brltty
lrwxrwxrwx 1 root root 21 avril 19 18:18 console-setup -> /lib/init/upstart-job
lrwxrwxrwx 1 root root 21 avril 2 10:28 cron -> /lib/init/upstart-job
lrwxrwxrwx 1 root root 21 avril 10 07:25 cups -> /lib/init/upstart-job
lrwxrwxrwx 1 root root 21 févr. 22 09:47 dbus -> /lib/init/upstart-job
lrwxrwxrwx 1 root root 21 mars 30 19:22 dmesg -> /lib/init/upstart-job
-rwxr-xr-x 1 root root 1242 déc. 13 18:11 dns-clean
lrwxrwxrwx 1 root root 21 avril 15 06:29 failsafe-x -> /lib/init/upstart-job
-rwxr-xr-x 1 root root 1946 mars 7 2011 firestarter
lrwxrwxrwx 1 root root 21 mars 14 15:02 friendly-recovery -> /lib/init/upstart-job
-rwxr-xr-x 1 root root 1105 oct. 1 2011 grub-common
-rwxr-xr-x 1 root root 1329 juil. 14 2011 halt
-rwxr-xr-x 1 root root 3060 nov. 10 18:17 hddtemp
lrwxrwxrwx 1 root root 21 avril 18 22:34 hostname -> /lib/init/upstart-job
lrwxrwxrwx 1 root root 21 mars 30 06:49 hwclock -> /lib/init/upstart-job
lrwxrwxrwx 1 root root 21 mars 30 06:49 hwclock-save -> /lib/init/upstart-job
lrwxrwxrwx 1 root root 21 févr. 4 06:33 irqbalance -> /lib/init/upstart-job
-rwxr-xr-x 1 root root 1893 oct. 9 2011 kerneloops
-rwxr-xr-x 1 root root 1293 juil. 14 2011 killprocs
lrwxrwxrwx 1 root root 21 avril 19 23:46 lightdm -> /lib/init/upstart-job
-rwxr-xr-x 1 root root 869 févr. 6 2011 lm-sensors
lrwxrwxrwx 1 root root 21 mars 24 13:42 modemmanager -> /lib/init/upstart-job
lrwxrwxrwx 1 root root 21 nov. 20 23:26 module-init-tools -> /lib/init/upstart-job
-rwxr-xr-x 1 root root 2981 févr. 28 19:23 mumble-server
lrwxrwxrwx 1 root root 21 mars 30 03:42 mysql -> /lib/init/upstart-job
-rwxr-xr-x 1 root root 2797 mai 23 2011 networking
lrwxrwxrwx 1 root root 21 avril 5 03:22 network-interface -> /lib/init/upstart-job
lrwxrwxrwx 1 root root 21 avril 5 03:22 network-interface-container -> /lib/init/upstart-job
lrwxrwxrwx 1 root root 21 avril 5 03:22 network-interface-security -> /lib/init/upstart-job
lrwxrwxrwx 1 root root 21 avril 12 23:25 network-manager -> /lib/init/upstart-job
-rwxr-xr-x 1 root root 882 juil. 14 2011 ondemand
lrwxrwxrwx 1 root root 21 avril 13 17:35 plymouth -> /lib/init/upstart-job
lrwxrwxrwx 1 root root 21 avril 13 17:35 plymouth-log -> /lib/init/upstart-job
lrwxrwxrwx 1 root root 21 avril 13 17:35 plymouth-splash -> /lib/init/upstart-job
lrwxrwxrwx 1 root root 21 avril 13 17:35 plymouth-stop -> /lib/init/upstart-job
lrwxrwxrwx 1 root root 21 avril 13 17:35 plymouth-upstart-bridge -> /lib/init/upstart-job
-rwxr-xr-x 1 root root 7348 avril 13 22:33 postfix
-rwxr-xr-x 1 root root 561 févr. 4 2011 pppd-dns
lrwxrwxrwx 1 root root 21 déc. 12 18:40 procps -> /lib/init/upstart-job
-rwxr-xr-x 1 root root 4978 sept. 14 2011 proftpd
-rwxr-xr-x 1 root root 2180 avril 12 07:16 pulseaudio
-rwxr-xr-x 1 root root 8635 avril 14 11:26 rc
-rwxr-xr-x 1 root root 801 juil. 14 2011 rc.local
-rwxr-xr-x 1 root root 117 avril 14 11:26 rcS
-rw-r--r-- 1 root root 2427 avril 14 11:26 README
-rwxr-xr-x 1 root root 639 juil. 14 2011 reboot
lrwxrwxrwx 1 root root 21 mars 30 00:10 resolvconf -> /lib/init/upstart-job
lrwxrwxrwx 1 root root 21 mars 22 22:01 rfkill-restore -> /lib/init/upstart-job
lrwxrwxrwx 1 root root 21 mars 22 22:01 rfkill-store -> /lib/init/upstart-job
-rwxr-xr-x 1 root root 4395 nov. 8 2011 rsync
lrwxrwxrwx 1 root root 21 mars 30 19:22 rsyslog -> /lib/init/upstart-job
-rwxr-xr-x 1 root root 2344 sept. 21 2011 saned
-rwxr-xr-x 1 root root 4321 déc. 15 07:40 sendsigs
lrwxrwxrwx 1 root root 21 avril 19 18:18 setvtrgb -> /lib/init/upstart-job
-rwxr-xr-x 1 root root 590 juil. 14 2011 single
-rw-r--r-- 1 root root 4304 avril 14 11:26 skeleton
-rwxr-xr-x 1 root root 2107 juin 6 2011 speech-dispatcher
-rwxr-xr-x 1 root root 567 juil. 14 2011 stop-bootlogd
-rwxr-xr-x 1 root root 1143 juil. 14 2011 stop-bootlogd-single
-rwxr-xr-x 1 root root 700 mai 23 2011 sudo
lrwxrwxrwx 1 root root 21 avril 5 21:17 udev -> /lib/init/upstart-job
lrwxrwxrwx 1 root root 21 avril 5 21:17 udev-fallback-graphics -> /lib/init/upstart-job
lrwxrwxrwx 1 root root 21 avril 5 21:17 udev-finish -> /lib/init/upstart-job
lrwxrwxrwx 1 root root 21 avril 5 21:17 udevmonitor -> /lib/init/upstart-job
lrwxrwxrwx 1 root root 21 avril 5 21:17 udevtrigger -> /lib/init/upstart-job
lrwxrwxrwx 1 root root 21 avril 5 20:16 ufw -> /lib/init/upstart-job
-rwxr-xr-x 1 root root 2800 juil. 14 2011 umountfs
-rwxr-xr-x 1 root root 2211 juil. 14 2011 umountnfs.sh
-rwxr-xr-x 1 root root 2926 déc. 15 07:40 umountroot
-rwxr-xr-x 1 root root 1039 nov. 9 2011 unattended-upgrades
-rwxr-xr-x 1 root root 1985 juil. 14 2011 urandom
lrwxrwxrwx 1 root root 21 mars 30 02:12 vsftpd -> /lib/init/upstart-job
lrwxrwxrwx 1 root root 21 avril 18 14:20 whoopsie -> /lib/init/upstart-job
-rwxr-xr-x 1 root root 1342 nov. 12 20:06 winbind
-rwxr-xr-x 1 root root 2666 mars 22 18:35 x11-common
Hors ligne
#6 Le 10/05/2012, à 23:05
- Pacifick_FR42
Re : Crontab
Mauvaise piste...
Je connais pas Mincraft, comment tu démarre habituellement le serveur ?
Hors ligne
#7 Le 10/05/2012, à 23:07
- Spacemarmotte
Re : Crontab
dans le terminal, je me rends dans le dossier /home/eric/minecraft_server/
et je tape: sudo java -Xms1024M -Xmx1024M -jar minecraft_server.jar nogui
(minecraft est un jeu de "construction" en réseau que les gamins adorent !!)
Dernière modification par Spacemarmotte (Le 10/05/2012, à 23:08)
Hors ligne
#8 Le 10/05/2012, à 23:09
- Pacifick_FR42
Re : Crontab
Lance le serveur et donne moi le retour de :
ps -ef | grep minecraft
Hors ligne
#9 Le 10/05/2012, à 23:14
- Pacifick_FR42
Re : Crontab
?? le serveur est lancé ?
Hors ligne
#10 Le 10/05/2012, à 23:15
- Spacemarmotte
Re : Crontab
si je lance le serveur minecraft et que je tape ta commande après, j'ai :
2012-05-10 23:14:02 [INFO] Unknown console command. Type "help" for help
si je tape ta commande dans le dossier sans lancer le jeu:
eric@eric-serveur:~/minecraft_server$ ps -ef | grep minecraft
eric 8753 1 0 22:34 ? 00:00:04 gedit /home/eric/Bureau/lancement minecraft
eric 9100 8925 0 23:15 pts/0 00:00:00 grep --color=auto minecraft
EDIT: "Lancement Minecraft" est le nom d'un fichier texte dans lequel j'ai enregistré la commande de lancement du jeu pour ne pas avoir à me la palucher à chaque fois !
Dernière modification par Spacemarmotte (Le 10/05/2012, à 23:17)
Hors ligne
#11 Le 10/05/2012, à 23:18
- Pacifick_FR42
Re : Crontab
Ben... il te le dit, le serveur n'est pas lancé...
INFO] Unknown console command. Type "help" for help
Hors ligne
#12 Le 10/05/2012, à 23:20
- Spacemarmotte
Re : Crontab
bin si ... lorsque je tape sudo java -Xms1024M -Xmx1024M -jar minecraft_server.jar nogui
il m'affiche bien les lignes (création des cartes, prise en compte de la liste des joueurs autorisés etc etc...) et les joueurs peuvent se connecter dessus
Hors ligne
#13 Le 10/05/2012, à 23:21
- Spacemarmotte
Re : Crontab
j'ai tapé ta commande dans un autre terminal (mais dans le même dossier):
eric@eric-serveur:~/minecraft_server$ ps -ef | grep minecraft
eric 8753 1 0 22:34 ? 00:00:06 gedit /home/eric/Bureau/lancement minecraft
root 9126 8925 0 23:21 pts/0 00:00:00 sudo java -Xms1024M -Xmx1024M -jar minecraft_server.jar nogui
root 9127 9126 25 23:21 pts/0 00:00:06 java -Xms1024M -Xmx1024M -jar minecraft_server.jar nogui
eric 9228 9140 0 23:21 pts/3 00:00:00 grep --color=auto minecraft
eric@eric-serveur:~/minecraft_server$
Hors ligne
#14 Le 10/05/2012, à 23:24
- Pacifick_FR42
Re : Crontab
donne le retour de :
sudo killall -e java -Xms1024M -Xmx1024M -jar minecraft_server.jar nogui
Hors ligne
#15 Le 10/05/2012, à 23:25
- Spacemarmotte
Re : Crontab
Xms1024M: signal inconnu; killall -l liste les signaux.
Hors ligne
#16 Le 10/05/2012, à 23:36
- Pacifick_FR42
Re : Crontab
J'ai trouver une solution qui te permettra à partir d'un crontab de faire :
/etc/init.d/mincraft start (pour le démarrer)
/etc/init.d/mincraft stop (pour l'arrêter)
http://francoispoteau.com/article23/ins … ous-debian
Mais c'est coton...
Hors ligne
#17 Le 10/05/2012, à 23:42
- Spacemarmotte
Re : Crontab
oula oui !! mdr !!
je mets ça en fav. et je verrai demain à tête reposée !!
ça implique aussi craftbukkit ...
ca a l'air d'être ce qu'il me faut .... yapuka !
un grand merci pour le coup de main ;-)
Hors ligne
#18 Le 10/05/2012, à 23:44
- Pacifick_FR42
Re : Crontab
De rien, bonne nuit
Hors ligne
#19 Le 10/05/2012, à 23:48
- Pacifick_FR42
Re : Crontab
Par contre modifie le titre de ton poste (le premier) car c'es pas très explicite, peut-etre que quelqu'un ici connaît un autre moyen, un titre du genre Crontab comment arrêter le server Mincraft ?
Hors ligne
Pages : 1