Open-source News

Improved Arch Linux Installer Experience Being Readied With Archinstall 2.4-RC1

Phoronix - Mon, 03/28/2022 - 18:07
Debuting on the Arch Linux monthly ISOs a year ago was Archinstall as a way to carry out quick and easy installations of this popular Linux distribution. Over the past year Archinstall has matured into increasingly robust shape for quickly installing Arch Linux...

LLVM Clang Adds "-march=native" Support For The Apple M1

Phoronix - Mon, 03/28/2022 - 18:00
A subtle but notable change worth mentioning last week for LLVM Clang 15.0 is "-march=native" now working for this compiler when running on Apple M1 SoCs...

Linux 5.18 KVM Prepares For Intel IPI Virtualization, Larger AMD VMs

Phoronix - Mon, 03/28/2022 - 17:48
The initial batch of KVM virtualization changes were merged last week for the ongoing Linux 5.18 merge window...

Linux 5.18 Hardens The Kernel For 64-bit Arm With Shadow Call Stack Support

Phoronix - Mon, 03/28/2022 - 17:29
In addition to supporting the Tesla FSD chip, Raspberry Pi Zero 2 W, and other new Arm SoCs in Linux 5.18, this kernel will also be more secure for 64-bit Arm with adding Shadow Call Stack support...

Scheduling tasks with the Linux cron command

opensource.com - Mon, 03/28/2022 - 15:00
Scheduling tasks with the Linux cron command Don Watkins Mon, 03/28/2022 - 03:00 Up Register or Login to like.

Early in my Linux journey, I came to appreciate the numerous command-line utilities of the operating system and the way they streamlined regular tasks. For example, backing up applications on my Windows server frequently required expensive add-on software packages. By contrast, the tar command makes backing up Linux relatively easy, and it's powerful and reliable too.

When backing up our school district email system, however, I faced a different challenge. Backups couldn't occur during the workday or early evening because people were using the system. The backup had to occur after midnight, and it needed to be reliable. I was used to Windows Task Manager, but what was I going to use on Linux? That's when I learned about cron.

More Linux resources Linux commands cheat sheet Advanced Linux commands cheat sheet Free online course: RHEL technical overview Linux networking cheat sheet SELinux cheat sheet Linux common commands cheat sheet What are Linux containers? Our latest Linux articles Scheduling tasks on Linux with cron

Cron is a daemon used to execute scheduled commands automatically. Learning how to use cron required some reading and experimenting, but soon I was using cron to shut down our email server, back up the data in a compressed tar file, then restart the email service at 3AM.

The commands for a cron job are stored in the crontab file on a Linux system, which is usually found in /etc/crontab. Display the contents of your crontab file with $ crontab -l.

Edit the crontab file with $ crontab -e.

Some systems default to the Vi editor for cron editing. You can override this setting using environment variables:

$ EDITOR=nano crontab -e

This allows you to use the nano editor to edit your personal crontab (if you don't have one yet, one is created automatically for you).

All crontab commands have parameters denoted by an asterisk until you insert an integer value. The first represents minutes, then hours, day of the month, month of the year, and finally, day of the week.

Comments are preceded by a hash. Cron ignores comments, so they're a great way to leave yourself notes about what a command does and why it's important.

A sample cron job

Suppose you want to scan your home directory for viruses and malware with clamscan every week on Monday at 10AM. You also want to back up your home directory every week on Tuesday at 9AM. Using cron and crontab files ensures that your system maintenance occurs every week whether you remember to run those utilities or not.

Edit your crontab file to include the following, using your own username instead of "don" (my user name):

# Scan my home directory for viruses
0 10 * * 1 clamscan -ir /home/don
# Backup my home directory
0 9 * * 2 tar -zcf /var/backups/home.tgz /home/don

If you're using the nano editor, save your work with Ctrl+O to write the file out and Ctrl+X to exit the editor. After editing the file, use crontab -l to list the contents of your cron file to ensure that it has been properly saved.

You can create crontab jobs for any job required on your system. This takes full advantage of the cron daemon.

Scheduling from the Linux command line

It's no secret that the hardest part of cron is coming up with the right values for those leading asterisks. There are websites, like crontab.guru, that dynamically translate cron time into human-readable translations, and Opensource.com has a cron cheat sheet you can download to help you keep it straight.

Additionally, most modern cron systems feature shortcuts to common values, including:

  • @hourly : Run once an hour (0 * * * *)
  • @daily : Run once a day (0 0 * * *)
  • @weekly : Run once a week (0 0 * * 0)
  • @monthly : Run once a month (0 0 1 * *)
  • @reboot : Run once after reboot

There are also alternatives to cron, including anacron for jobs you want to run regularly but not according to a specific schedule, and the at command for one-off jobs.

Cron is a useful task scheduling system, and it's as easy to use as editing text. Give it a try!

Try this way to conquer challenging scheduling problems right from the Linux command line.

Linux What to read next This work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License. Register or Login to post a comment.

Simplify Java persistence implementation with Kotlin on Quarkus

opensource.com - Mon, 03/28/2022 - 15:00
Simplify Java persistence implementation with Kotlin on Quarkus Daniel Oh Mon, 03/28/2022 - 03:00 Up Register or Login to like.

For decades, developers have struggled with optimizing persistence layer implementation in terms of storing business data, retrieving relevant data quickly, and—most importantly— simplifying data transaction logic regardless of programming languages.

Fortunately, this challenge triggered the invention of Java ecosystems in which developers can implement the Java Persistence API (JPA). For instance, Hibernate Object Relational Mapper (ORM) with Panache is the standard framework for JPA implementation in the Java ecosystem.

Explore the open source cloud Free online course: Developing cloud-native applications with microservices arc… eBook: Modernize your IT with managed cloud services Try for 60 days: Red Hat OpenShift Dedicated What is Kubernetes? Understanding edge computing Latest articles for IT architects

Kotlin is a programming language designed to run business applications with multiple programming languages on top of Java Virtual Machine (JVM) for the Java persistence implementation. But there's still the hurdle for Java developers to catch up on the new syntax and JPA APIs of Kotlin.

This article will explain how Quarkus makes it easier for developers to implement Kotlin applications through the Quarkus Hibernate ORM Panache Kotlin extension.

Create a new Hibernate ORM Kotlin project using Quarkus CLI

First, create a new Maven project using the Quarkus command-line tool (CLI). The following command will add Quarkus extensions to enable Hibernate ORM Panache Kotlin and PostgreSQL JDBC extensions:

$ quarkus create app hibernate-kotlin-example \
 -x jdbc-postgresql, hibernate-orm-panache-kotlin

The output should look like this:

...
<[SUCCESS] ✅ quarkus project has been successfully generated in:
--> /Users/danieloh/Downloads/demo/hibernate-kotlin-example
...Create a new entity and repository

Hibernate ORM with Panache enables developers to handle entities with active record patterns with the following benefits:

  • Auto-generation of IDs
  • No need for getters/setters
  • Super useful static methods for access such as listAll() and find()
  • No need for custom queries for basic operations (e.g. Person.find ("name", "daniel"))

Kotlin doesn't support the Hibernate ORM with Panache in the same way Java does. Instead, Quarkus allows developers to bring these capabilities into Kotlin using the companion object, as illustrated below:

@Entity(name = "Person")
class Person : PanacheEntity() {
lateinit var name: String
}

Here is a simple example of how developers can implement PanacheRepository to access the entity:

@ApplicationScoped
class PersonRepository: PanacheRepository<Person> {
fun findByName(name: String) = find("name", name).firstResult()
}

Super simple! Now I'll show you how to implement resources to access data by RESTful APIs.

Create a resource to handle RESTful APIs

Quarkus fully supports context and dependency injection (CDI), which allows developers to inject PersonRepository to access the data (e.g., findByName(name)) in the resources. For example:

@Inject
lateinit var personRepository: PersonRepository

@GET
@Produces(MediaType.TEXT_PLAIN)
@Path("/{name}")
fun greeting(@PathParam("name") name: String): String {
return "Hello ${personRepository.findByName(name)?.name}"
}Run and test the application

As always, run your Quarkus application using Developer Mode:

$ cd hibernate-kotlin-example
$ quarkus dev

The output should look like this:

...
INFO [io.quarkus] (Quarkus Main Thread) Profile dev activated. \
Live Coding activated.
INFO [io.quarkus] (Quarkus Main Thread) \
Installed features: [agroal, cdi, hibernate-orm, \
hibernate-orm-panache-kotlin, jdbc-postgresql, \
kotlin, narayana-jta, resteasy, smallrye-context-propagation, vertx]

--
Tests paused
Press [r] to resume testing, [o] Toggle test output, \
[:] for the terminal, [h] for more options>

Quarkus Dev services stand up a relevant database container automatically when you run a container runtime (e.g., Docker or Podman) and add a database extension. In this example, I already added the jdbc-postgresql extension, so a PostgreSQL container will be running automatically when the Quarkus Dev mode begins. Find the solution in my GitHub repository.

Access the RESTful API (/hello) to retrieve the data by the name parameter. Execute the following curl command line in your local terminal:

& curl localhost:8080/hello/Daniel

The output should look like this:

Hello DanielConclusion

This is a basic explanation of how Quarkus enables developers to simplify JPA implementation using Kotlin programming APIs for reactive Java applications. Developers can also have better developer experiences, such as dev services and live coding, while they keep developing with Kotlin programming in Quarkus. For more information about Quarkus, visit the Quarkus web page.

This article demonstrates how Quarkus enables developers to simplify JPA implementation using Kotlin programming APIs for reactive Java applications.

Image by:

Image by Mapbox Uncharted ERG, CC-BY 3.0 US

Java Kubernetes Cloud What to read next This work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License. Register or Login to post a comment.

How to Install Icinga2 Monitoring Tool on Ubuntu 20.04/22.04

Tecmint - Mon, 03/28/2022 - 14:41
The post How to Install Icinga2 Monitoring Tool on Ubuntu 20.04/22.04 first appeared on Tecmint: Linux Howtos, Tutorials & Guides .

Icinga2 is a powerful free and open-source monitoring tool that keeps an eye on your network resources and sends alerts or notifications in case of failure or outages. It also collects metrics from network

The post How to Install Icinga2 Monitoring Tool on Ubuntu 20.04/22.04 first appeared on Tecmint: Linux Howtos, Tutorials & Guides.

8 Best KDE Based Linux Distributions That You’ll Love

Tecmint - Mon, 03/28/2022 - 12:19
The post 8 Best KDE Based Linux Distributions That You’ll Love first appeared on Tecmint: Linux Howtos, Tutorials & Guides .

The KDE Plasma desktop is an attractive and feature-rich environment to use. It provides a fluid interface with a touch of elegance that leaves many other Linux desktop environments in the dust. The desktop’s

The post 8 Best KDE Based Linux Distributions That You’ll Love first appeared on Tecmint: Linux Howtos, Tutorials & Guides.

Pages