Auto Restart and Linux Logs

Tutorial explaining how to create a by the ssh terminal. To auto restart the server and save all the logs that happens on the distro, this script will start the server every time it crashes, closes or on the save server.

1 - Let's see if the nano is installed on your Linux machine, run on the terminal:

sudo apt install nano

2 - Let's go in the way of your server folder everything will be done here:

cd canary

3 - Now let's create the

sudo nano
  • Then enter:

ulimit -c unlimited
while true; do ./canary 2>&1 | awk '{ print strftime("%F %T - "), 
$0; fflush(); }' | tee "logs/$(date +"%F %H-%M-%S.log")"; done
  • Save with CTRL+X after Y and Enter:

4 - Let's give permission to the created script:

sudo chmod 775 -R

5 - Now let's create the folder where the server logs will be saved:

sudo mkdir logs

6 - Now just start in the terminal the script ./, you need to have the screen installed:

  • Install the screen:

sudo apt install screen

6.1 - Basic screen commands:

Open a screen:


Exit a screen:


Back to the last open screen:

screen -r

Close a screen:



With the screen open use ./canary in the project root directory to start the server.


  • Beats.