JRehkemper.de

JRehkemper.de

- Homepage and Wiki of Jannik Rehkemper -

New Posts

Increase JVM Heap Size of Graylog Docker Container

If you are running Graylog in a Docker Container or Docker-Compose, you will sooner or late experience, that the Graylog-Server will use most of it’s heap space, which is set to 4Gi by default. Assuming your Docker-Host has some more Memory to spare, you can increase the Heap Size by using an environment variable. Set the -Xms to you desired minimum used memory and -Xmx to the allowed maximum. services: graylog: hostname: "server" image: "${GRAYLOG_IMAGE:-graylog/graylog:6.

Add Programm to KDE Systemmenu

Some Applications are not listed in the Systemmenu of KDE. One example for that are AppImages. But it is quite easy to add them to the Systemmenu. You only need to create a .desktop file in ~/.local/share/applications. [Desktop Entry] Type=Application Nmae=Zettlr Comment=Zettlr Exec=/home/n5557/software/zettlr/Zettlr Icon=/home/n5557/software/zettlr/zettlr.png Terminal=false Categories=office After that you will find your Application in the Systemmenu

Restore Crontab From Backup

Restore from Filesystem Backup If you deleted your Crontab for example with crontab -r but have full filesystem backup you can restore it by recovering /var/spool/cron/<your-user>. After that you can reload it into your active Crontab by executing crontab </path/to/restored/crontab/file> Restore from Syslog If you don’t have a backup you best chance is to have a look at /var/log/cron. There you will find all the Commands executed and based on the timestamps you can reverse-engineer the cron-expression.

Upsert in PostgreSQL - Update if exists

It is quite a common scenario: You have a table and want to insert a new record, but in case it already exists, you want to update it. One way would be to start with the update, look at the rows affected and execute the insert if the rowCount is 0. But there is a neater way. The so called Upsert. INSERT INTO table1 (id, firstname, lastname, age) VALUES (1, 'john', 'doe', 25) ON CONFLICT(id) DO UPDATE SET id = 1, firstname = 'john', lastname = 'doe', age = 25 ; This will try an insert but if there is already an entry with the same id it will update that one.

Update a Joined Table in PostgreSQL

If you joined two tables and need to update one of them, there are multiple ways to do so. Select Query My Example uses a join to lookup a name to an id. SELECT a.id b.name a.value1 a.value2 FROM tablea a JOIN tableb b ON a.id = b.id; Using Subquery One approach is to use a subquery. UPDATE tablea a SET value1 = 1, value2 = 2 WHERE a.id = (SELECT "id" FROM tableb WHERE "name" = 'John'); Using Joined Update You can also join while doing the update.