Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I Need help writing an Linux Service for systemd, please SEE BELOW Write a systemd service unit called heartbeat. The function of this service is

I Need help writing an Linux Service for systemd, please SEE BELOW

Write a systemd service unit called heartbeat. The function of this service is to write a log message to /var/log/messages every ten seconds. Start this service.

When you run the command systemctl status heartbeat, you should see output similar to the following:

[root@localhost system]$ systemctl status heartbeat.service  heartbeat.service - heartbeat service Loaded: loaded (/etc/systemd/system/heartbeat.service; disabled; vendor preset: disabled) Active: active (running) since Mon 2018-01-08 21:15:14 EST; 1min 34s ago Main PID: 24626 (bash) CGroup: /system.slice/heartbeat.service 24626 /usr/bin/bash -c while sleep 10; do /usr/bin/logger Still alive...; done 27946 sleep 10 Jan 08 21:15:14 localhost.localdomain systemd[1]: Started heartbeat service. Jan 08 21:15:14 localhost.localdomain systemd[1]: Starting heartbeat service... 

When you run the command tail /var/log/messages, you should see output similar to the following:

[root@localhost system]$ tail /var/log/messages Jan 8 21:16:25 localhost logger: Still alive... Jan 8 21:16:35 localhost logger: Still alive... Jan 8 21:16:45 localhost logger: Still alive... Jan 8 21:16:55 localhost logger: Still alive... Jan 8 21:17:05 localhost logger: Still alive... Jan 8 21:17:15 localhost logger: Still alive... Jan 8 21:17:25 localhost logger: Still alive... Jan 8 21:17:35 localhost logger: Still alive... Jan 8 21:17:45 localhost logger: Still alive... Jan 8 21:17:55 localhost logger: Still alive... 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Distributed Relational Database Architecture Connectivity Guide

Authors: Teresa Hopper

4th Edition

0133983064, 978-0133983067

More Books

Students also viewed these Databases questions