Skip to content

Temporary fix lot of entries in nextclouds user "Devices & sessions"

Hello there,

when logged into my nextcloud server as user, I clicked to User Bubble -> Settings -> Security and found a long list of entries below Devices & sessions.

After searching the issue list, I found this issue ticket.

The issue is know but either it is a kind of special issue ore no one really cares about it.

There is currently no real solution but I want to offer a temporary one.

You can create a cronjob that executes the following sql statement once per week or day.

```sql
--- 
--- You have to replace <user_name> with your user name
--- 

DELETE FROM 
  `oc_authtoken` 
WHERE 
  `uid` = <user> 
  AND `last_activity` < UNIX_TIMESTAMP(DATE_SUB(CURRENT_DATE(), INTERVAL 16 DAY));

OPTIMIZE TABLE `oc_authtoken`;
```

From my point of view, it looks like Firefox is doing something strange. Maybe other browsers behave the same.

Best regards, artodeto

Upgrade gitea via bash on an uberspace webspace

I've just finished writing a little bash script to almost automatically upgrade my gitea instance on my uberspace webspace.

Hope it will help you.

    cat > "${HOME}/upgrade_gitea.sh" <<DELIM
#!/bin/bash
####
# @see: https://lab.uberspace.de/guide_gitea/
# @since: 2022-05-16
# @author: stev leibelt <artodeto@bazzline.net>
####

function _do_the_update () {
    local PATH_TO_GITEA="${HOME}/gitea/gitea"

    if [[ -f "\${PATH_TO_GITEA}" ]];
    then
        echo ":: Stopping all running gitea process."

        killall gitea

        echo ":: Moving >>\${PATH_TO_GITEA}<< to >>\${PATH_TO_GITEA}.previous<<"

        mv "\${PATH_TO_GITEA}" "\${PATH_TO_GITEA}.previous"
    fi

    echo ":: Please visit >>https://github.com/go-gitea/gitea/releases/tag/latest<<."
    echo ""

    echo ":: Please insert latest Version number without the v."
    read LATEST_GITEAVERSION

    wget -O "\${PATH_TO_GITEA}" https://github.com/go-gitea/gitea/releases/download/v\${LATEST_GITEAVERSION}/gitea-\${LATEST_GITEAVERSION}-linux-amd64

    if [[ -f "\${PATH_TO_GITEA}" ]];
    then
        wget --output-document "\${PATH_TO_GITEA}.asc" https://github.com/go-gitea/gitea/releases/download/v\${LATEST_GITEAVERSION}/gitea-\${LATEST_GITEAVERSION}-linux-amd64.asc

        curl --silent https://keys.openpgp.org/vks/v1/by-fingerprint/7C9E68152594688862D62AF62D9AE806EC1592E2 | gpg --import

        gpg --verify "\${PATH_TO_GITEA}.asc" "\${PATH_TO_GITEA}"

        chmod u+x "\${PATH_TO_GITEA}"

        echo ":: Starting migration"

        \${PATH_TO_GITEA} migrate

        echo ":: Starting gitea"

        \${PATH_TO_GITEA} web
    else
        echo ":: Something went wrong."

        if [[ -f "\${PATH_TO_GITEA}.previous" ]];
        then
            echo ":: Restoring previous gitea."

            mv "\${PATH_TO_GITEA}.previous" \"${PATH_TO_GITEA}"

            echo ":: Starting gitea"

            \${PATH_TO_GITEA} web
        fi
    fi
}

_do_the_update
DELIM

    chmod +x ${HOME}/upgrade_gitea.sh

Best regards, artodeto.

Simple zabbix mysql/mariadb housekeeping script to maintain zabbix.history and zabbix.history_uint tables

I've just finished a simple houseskeeping/maintenance script for zabbix if you use mariadb or mysql as database.

You can find it here.

It installs a systemd timer to automatically run optimize on the two tables zabbix.history and zabbix.history_uint.

All you have to do is to add your username and passwort to the created file /etc/net.bazzline/zabbix/housekeeping/local_configuration.sh.