Category Archives: Server

Update Column with value from another Table


title: “Update Column with value from another Table”
date: 2021-04-07T00:27:34
slug: update-column-with-value-from-another-table


UPDATE transponders INNER JOIN satellites ON transponders.name = satellites.name SET transponders.sat\_id = satellites.id

Ubuntu enable disable Timesync


title: “Ubuntu enable disable Timesync”
date: 2021-03-31T22:04:00
slug: ubuntu-enable-disable-timesync


Sync Time to NIST Atomic Clock

You can set your Ubuntu system to synchronize to the NIST atomic clock:

timedatectl set–ntp yes

If you need to turn off NTP synchronizing to be able to adjust the time and date manually, use:

timedatectl set-ntp no

Changing Root Password (Mariadb)


title: “Changing Root Password (Mariadb)”
date: 2021-03-10T20:42:44
slug: changing-root-password-mariadb


UPDATE mysql.user SET authentication\_string = PASSWORD('new\_password') WHERE user = 'root';
UPDATE mysql.user SET plugin = 'mysql\_native\_password' WHERE user = 'root';
FLUSH PRIVILEGES;

Execute Shell Command with STDIN Pipe


title: “Execute Shell Command with STDIN Pipe”
date: 2020-11-27T08:47:38
slug: execute-shell-command-with-stdin-pipe


 tasks:
 - name: Add ImageContentSourcePolicy for internal image proxy
 when: enable\_openshift\_registry\_mirror | default(true)
 shell:
 cmd: "oc apply -f -"
 stdin: |
 apiVersion: operator.openshift.io/v1alpha1
 kind: ImageContentSourcePolicy
 metadata:
 name: internal-image-mirror
 spec:
 repositoryDigestMirrors:
 - mirrors:
 - harbor.qsu.paas.pop.noris.de/quay.io
 source: quay.io
 - mirrors:
 - harbor.qsu.paas.pop.noris.de/registry.redhat.io
 source: registry.redhat.io

Bootstrap New Cluster


title: “Bootstrap New Cluster”
date: 2020-05-05T17:23:46
slug: bootstrap-new-cluster


On Primary Node (of you think its the primary one):
/usr/bin/mysqld_safe –wsrep-new-cluster

2020-05-05 19:21:02 0 [ERROR] WSREP: It may not be safe to bootstrap the cluster from this node. It was not the last one to leave the cluster and may not contain all the updates. To force cluster bootstrap with this node, edit the grastate.dat file manually and set safe_to_bootstrap to 1 .
vi /data/mysql/data/grastate.dat

Start mariadb on other nodes
systemctl start mariadb

Check for primary
SHOW GLOBAL STATUS LIKE ‘wsrep_cluster_status’;

Wenn das hier im Log File steht, wird repliziert:
WSREP_SST: [INFO] Waiting for SST streaming to complete! (20200506 14:59:19.575)

non interactive apt


title: “non interactive apt”
date: 2020-03-04T15:43:37
slug: non-interactive-apt


if [ -x /usr/bin/apt ]; then
 apt update -qq
 DEBIAN\_FRONTEND=noninteractive apt-get install -y -qq awscli curl gettext-base git jq openssh-client sudo wget > /dev/null
fi

Create self signed Cert without key


title: “Create self signed Cert without key”
date: 2020-02-16T10:42:16
slug: create-self-signed-cert-without-key


openssl req -newkey rsa:4096 \
 -x509 \
 -sha256 \
 -days 3650 \
 -nodes \
 -out example.crt \
 -keyout example.key \
 -subj "/C=SI/ST=Ljubljana/L=Ljubljana/O=Security/OU=IT Department/CN=www.example.com"

mysqlbinlog binlog anzeigen


title: “mysqlbinlog binlog anzeigen”
date: 2020-02-12T09:02:55
slug: mysqlbinlog-binlog-anzeigen


mysqlbinlog --start-datetime="2020-02-12 06:00:00" --stop-datetime="2020-02-12 10:00:00" --base64-output=decode-rows mysql-bin.000190

Create User with Database and grant remote rights


title: “Create User with Database and grant remote rights”
date: 2020-01-26T11:41:46
slug: create-user-with-database-and-grant-remote-rights


create database mqtt;

# Allow general Connection to DB
CREATE USER 'mqtt'@'localhost' IDENTIFIED BY 'mqtt';
CREATE USER 'mqtt'@'%' IDENTIFIED BY 'mqtt';

# Allow Connection to DB mqtt
GRANT ALL ON mqtt.\* TO 'mqtt'@'localhost';
GRANT ALL ON mqtt.\* TO 'mqtt'@'%';