HenniOKF
Documentation

Guide

In a web console

How to work in the web console of a VPS provider, also on a tablet, when the connection drops on switching windows.

What it is about

Without a computer of your own you reach the VPS through the web console of the provider in the browser, also on a tablet. There the connection often drops as soon as you switch windows, for example to copy a token from another app. A command that is running can abort with it. This is how you work safely anyway.

Combine commands into one line

Prepare everything and paste it at once. Connect several steps with &&: the next runs only if the previous one worked. Such a line also survives a repetition.

mkdir -p /srv/henniokf && chown 1000:1000 /srv/henniokf && cd /opt/henniokf && cp docker/vps.env.example docker/.env && chmod 600 docker/.env

Write the lines into a note beforehand and copy one whole line at a time.

Insert a token locally

If the console waits for an input while you switch apps, the session is often gone. Insert the token into the command in the note already and paste the finished line. For the registry that works without a prompt:

 echo TOKEN | docker login ghcr.io -u <github-user> --password-stdin

TOKEN here is the token (classic) with read:packages. A value in docker/.env you replace with sed, without opening nano:

 sed -i 's/^HENNIOKF_SYNC_TOKEN=.*/HENNIOKF_SYNC_TOKEN=VALUE/' /opt/henniokf/docker/.env

Delete the note with the token afterwards.

A space in front against the history

The two lines above begin with a space. Then Bash does not write them into the history, provided HISTCONTROL has the value ignorespace or ignoreboth. Check:

echo $HISTCONTROL

If it shows neither, set it for the session:

export HISTCONTROL=ignoreboth

Long commands with nohup

A command that takes minutes, such as a build on the VPS, should keep running when the connection drops. nohup and & detach it from the session; the output goes into a file:

cd /opt/henniokf && nohup docker/build.sh -t ghcr.io/arpablo/henniokf:latest > /root/henniokf-build.log 2>&1 &

After reconnecting this command shows the state:

tail -n 20 /root/henniokf-build.log

A session that stays: tmux

tmux keeps a session on the VPS open, even when the web console loses it. If it is missing, install it once:

apt-get update && apt-get install -y tmux
tmux new -s work

After an abort, back in:

tmux attach -t work

Detach without ending: Control-B, then D.

Back to Operation and backup.