Do I have the init script correct for starting Craftbukkit at server boot

Discussion in 'Bukkit Discussion' started by KitsuneBoy, May 12, 2018.

  1. Offline

    KitsuneBoy

    Hi,

    I have been writing this thing in preparation for when I install Crafbukkit on my Debian server. Can you tell me if this is written correctly to start Crafbukkit automatically when my server boots up?
    Code:
    [Unit]
    Description="Personal Bukkit Server"
    
    [Service]
    WorkingDirectory=/games/craftbukkit/socialfoxes
    User=bksfserver
    
    ExecStart=/usr/bin/screen -DmS bksf /bin/java -Xmx2048M -jar bksfserver.jar nogui
    
    ExecStop=/usr/bin/screen -p 0 -S bksf -X eval 'stuff "say SERVER SHUTTING DOWN. Saving map..."\\015'
    ExecStop=/usr/bin/screen -p 0 -S bksf -X eval 'stuff "save-all"\\015'
    ExecStop=/usr/bin/screen -p 0 -S bksf -X eval 'stuff "stop"\\015'
    ExecStop=/bin/sleep 2
    
    [Install]
    WantedBy=multi-user.target
    Basically the plan is to get the above script to run at server boot using a cron job or something so that the server is always running

    Also, just incase something goes wrong I plan to be able to manually start the server by manually running the above script like this
    Code:
    systemctl enable bksfserver
    systemctl start bksfserver
    Once I have everything working and stuff then I will increase the amount of RAM allocated by the script to make sure the server runs smoothly.

    Also, I should say that I plan on creating a group in my sudoers file called bukkit, allowing the group to run only this init as root (nothing else) and then adding the user bksdserver to that group.

    Would really appreciate so help with this

    Cheers
    Jay
     

Share This Page