Faça o início da tela como Daemon para um servidor Minecraft

4

Eu fiz um script que corre bem manualmente, mas não consigo executá-lo com a descrição em Como iniciar um arquivo de script na inicialização? . Eu corri update-rc.d -f minecraft.start defaults

Isso é o que meu /etc/init.d/minecraft.start é como

#!/bin/bash
case "$1" in
  start)
    screen -S minecraft.start /home/phirephoenix/minecraft/bukkitserver/start_server.sh
    echo "Server started on screen minecraft"
    ;;
  stop)
    screen -X -S minecraft.start kill
    echo "Server shutting down"
    ;;
  *)
    echo "Usage: /etc/init.d/minecraft.start {start|stop}"
    exit 1
    ;;

esac

exit 0
~

Como o script funciona, não vou adicioná-lo, pois é o padrão.

E este é o meu log de inicialização /var/log/boot.log

Begin: Loading essential drivers ... done.
Begin: Running /scripts/init-premount ... done.
Begin: Mounting root file system ... Begin: Running /scripts/local-top ... done.
Begin: Running /scripts/local-premount ... done.
Begin: Running /scripts/local-bottom ... done.
done.
Begin: Running /scripts/init-bottom ... done.
fsck from util-linux 2.20.1
/dev/sda1: clean, 66452/4325376 files, 1205648/17301248 blocks
 * Starting configure network device [ OK ]
 * Starting Mount network filesystems [ OK ]
 * Starting Failsafe Boot Delay [ OK ]
 * Stopping Mount network filesystems [ OK ]
 * Starting Bridge socket events into upstart [ OK ]
 * Starting SMB/CIFS File Server [ OK ]
 * Starting configure network device [ OK ]
 * Stopping OpenSSH server [ OK ]
 * Starting OpenSSH server [ OK ]
 * Starting NetBIOS name server [ OK ]
 * Starting Mount network filesystems [ OK ]
 * Stopping Failsafe Boot Delay [ OK ]
 * Starting configure network device [ OK ]
 * Starting System V initialisation compatibility [ OK ]
 * Stopping Mount network filesystems [ OK ]
 * Starting SMB/CIFS File and Active Directory Server [ OK ]
 * Stopping cold plug devices [ OK ]
 * Stopping log initial device creation [ OK ]
 * Starting enable remaining boot-time encrypted block devices [ OK ]
 * Starting configure network device security [ OK ]
 * Starting configure virtual network devices [ OK ]
 * Stopping configure virtual network devices [ OK ]
 * Starting save udev log and update rules [ OK ]
 * Stopping save udev log and update rules [ OK ]
Skipping profile in /etc/apparmor.d/disable: usr.sbin.rsyslogd
 * Starting AppArmor profiles [ OK ]
 * Stopping System V initialisation compatibility [ OK ]
 * Starting System V runlevel compatibility [ OK ]
 * Starting ACPI daemon [ OK ]
 * Starting save kernel messages [ OK ]
 * Starting automatic crash report generation [ OK ]
 * Starting regular background program processing daemon [ OK ]
 * Starting deferred execution scheduler [ OK ]
 * Stopping save kernel messages [ OK ]
 * Starting CPU interrupts balancing daemon [ OK ]
 * Starting crash report submission daemon [ OK ]
 * Starting domain name service... bind9 [ OK ]

**<BIG BLANK AREA RIGHT HERE, DON'T GET IT>**

**[screen is terminating]**
**Server started on screen minecraft**
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
 * Starting web server apache2 [ OK ]
 * Stopping System V runlevel compatibility [ OK ]

Executa o eco dentro do início, mas também diz que a tela está terminando.

O que está causando esse problema aqui? Eu corro o Ubuntu Server, parece que o screen está instalado e funcionando.

Então, uma nova abordagem, usando o recurso upstart (ou o que eu devo chamá-lo). Eu meio que entendi as coisas do runtimelevel depois de um pouco de googeling curto, e agora ele deve começar em um dos quatro níveis de runtim que eu configurei, ou parar, em parar / reinicializar, etc.

feito /etc/init/bukkit.conf muito parecido com o um bruxo feito . Todos os # são adicionados para comentar aqui e não estão no script real.

description     "Bukktiserver"
author          "[email protected]"

start on runlevel [2345]
stop on runlevel [016]

pre-start script
    echo " * Bukkitserver started"
    # I don't know if this does anything at all
end script

    exec sudo /home/phirephoenix/minecraft/bukkitserver/start_server.sh
    # Had to sudo, or else it would get permission denied. Any ideas?

Agora eu posso iniciar o servidor digitando sudo start bukkit, mas ele ainda não roda automaticamente. bukkit está no meu initctl list com bukkit stop/waiting (Para todos perguntando bukkit é um software de servidor minecraft.)

Eu uso um .conf para torná-lo um serviço iniciante, quero que o script seja executado sem que eu tenha que fazer nada (automaticamente antes de qualquer logon). Existe algum problema com o jarfile real a ser executado na minha homefolder? Não consigo me lembrar se a minha homefolder está criptografada ou não, mas pode ser. Isso pode ser um problema? Terei que usar links simbólicos ou algo assim (se os links simbólicos são quase como atalhos, mas não é?)

O que estou perdendo aqui?

Ps: Eu também removi a coisinha de inicialização da tela, com update-rc.d remove.

    
por PhirePhoenix 19.01.2014 / 23:02

1 resposta

3

Não me lembro de screen ter um modo daemon, aparentemente sim. Altere a linha de tela para o seguinte:

screen -dmS minecraft.start /home/phirephoenix/minecraft/bukkitserver/start_server.sh

O novo parâmetro -dmS "Iniciar como daemon: sessão de tela no modo desanexado.", que é a combinação de -d -m e -S que você já está usando.

    
por 19.01.2014 / 23:23