Creating a systemd timer as a user on Debian 9.9

To set up a simple systemd timer as a user on Debian 9.9, here are the following steps to make it work.

Systemd version :

systemctl --version
systemd 232

As a user, both the .service unit and .timer unit must be located in $HOME/.config/systemd/user.
If this folder does not exist, create it :

mkdir -p $HOME/.config/systemd/user

If both the .service and .timer files are named as test, it must be enabled and started :


systemctl --user enable test

systemctl --user start test

The expected output should be found using journalctl :

journalctl -f

References :

https://wiki.archlinux.org/index.php/Systemd/Timers

systemd.time(7) manpage

Using systemd as a user

Advertisements

[:ne binary operator expected

[:ne binary operator expected

In addition to the explanation here, this error pops up when comparing two values.
Pay attention either comparing is about comparing two strings or two numeric values.

As a reminder :

Numeric comparisons


val1 -eq val2
val1 -ne val2
val1 -ge val2
val1 -gt val2
val1 -le val2
val1 -lt val2

Strings comparisons


val1 = val2
val1 != val2
val1 val2
-n val1
-z val2

Further readings :

https://www.linuxtechi.com/compare-numbers-strings-files-in-bash-script/

java.awt.headless

What is java.awt.headless ?

As well detailed in the article below,

Java contains a lot of classes which assume that there is a some sort of display and a keyboard attached. Sometimes, you are writing code to run on a server which does not have these and this is called Headless mode

For some Java-based web applications, graphics can be generated. Either you need to configure the application to use the local X Window server or use the Java Headless option.

Source : https://blog.idrsolutions.com/2013/08/what-is-headless-mode-in-java/

Use case example for headless image processing : https://github.com/processing/processing/wiki/Running-without-a-Display

At : Garbled time

If you need to run a job once, at is the tool perfectly suited for this need.

The at tool requires some options to run a job at a given moment.

Without any parameters, at pops up the following error :

Garbled time

The job can be either specified from the at prompt or using the -f

Here is an example to run a job in a minute from the time the command at is executed :

at now + 1 minute

at>echo "This is a test"

at now + 1 minutes

at>echo "This is a test"

Using a text file :

at now + 1 minute -f job_file

Once the job is completed, an email is sent. Check your local Mailbox using the mail command.

Good tutorials around at providing additional examples :

https://www.computerhope.com/unix/uat.htm

https://tecadmin.net/one-time-task-scheduling-using-at-commad-in-linux/

https://linuxconfig.org/how-to-schedule-tasks-using-at-command-on-linux

https://www.thegeekstuff.com/2010/06/at-atq-atrm-batch-command-examples/

[WARNING] This document format requires a nonempty title element.

If you are using pandoc as a document converter from markdown to html, you may have this warning message while using the -s (–standalone) option.

[WARNING] This document format requires a nonempty title element.
Please specify either ‘title’ or ‘pagetitle’ in the metadata.

For more details about adding metadata information to your pandoc command line : https://pandoc.org/MANUAL.html#option–metadata
For example, if you want to produce an HTML file from a markdown file, the -s option uses a default template that only sets the header and the footer.
No html-based title is generated unless you explicitly request it using the -M option that sets the title metadata info.

pandoc -s -f gfm -t html -M title:Test -o test.html test.md

More info on the -s / –standalone option

Unicode primer

Understanding and manipulating character sets encoding can not be underestimated.

Here are a few interesting Unicode primers found on the Internet :