A
A
Alex Kyznetsov2020-06-17 15:53:02
Java
Alex Kyznetsov, 2020-06-17 15:53:02

How to autoload sh script?

hello everyone, there is such a script

#!/bin/sh

while :;
do
    java -server -Dfile.encoding=UTF-8 -Xmx6g -cp config/xml:../serverslibs/*:  gameserver.GameServer > log/stdout.log 2>&1

    [ $? -ne 2 ] && break
    sleep 30;
done

I'm trying to set it to autoload, but something doesn't start
ubuntu 18.4
, when I reboot, the script starts, but the server that should run this script doesn't start

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
pfg21, 2020-06-17
@360157

throw out the script
and write a systemd.unit
, it will launch you and restart if the server breaks off.
and logs can be redirected to files.

S
Saiputdin Omarov, 2020-06-17
@generalx

# crontab -e (as desired user)
# @reboot script path

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question