Services in linux mint

How To Configure and setup Systemd Service on Linux Mint 20.3

To Setup and Configure Systemd service On Linux Mint 20.3

Introduction:

Systemd isáthe first daemon to start during booting and the last daemon to terminate during shutdown. The Systemd daemon serves as the root of the user space’s process tree; The first process (PID 1) has a special role on Unix systems, As it replaces the parent of a process when the original parent terminates.

Installation Procedure:

Step 1 : Check the OS version by using the below command

[email protected]:~# lsb_release -a No LSB modules are available. Distributor ID: Linuxmint Description: Linux Mint 20.3 Release: 20.3 Codename: una 

Step 2 : Edit the .sh file in the name of linuxhelp by using the below command

Step 3 : Execute Permission given to linuxhelp.sh file by using the below command

Step 4 : Enter the system service default path by using the below command

Step 5 : Configure the linuxhelp.service file by using the below command

[email protected]:/etc/systemd/system# nano linuxhelp.service 

Step 6 : Start the linuxhelp service by using the below command

[email protected]:/etc/systemd/system# systemctl start linuxhelp 

Step 7 : Check the status of linuxhelp service by using the below command

[email protected]:/etc/systemd/system# systemctl status linuxhelp ΓùÅ linuxhelp.service Loaded: loaded (/etc/systemd/system/linuxhelp.service; static; vendor preset: enabled) Active: active (running) since Wed 2022-04-20 05:15:45 IST; 8s ago Main PID: 4857 (linuxhelp.sh) Tasks: 2 (limit: 4571) Memory: 1.3M CGroup: /system.slice/linuxhelp.service Γö£ΓöÇ4857 /bin/bash /root/linuxhelp.sh ΓööΓöÇ4895 sleep 1 Apr 20 05:15:45 linuxhelp systemd[1]: Started linuxhelp.service. Apr 20 05:15:45 linuxhelp linuxhelp.sh[4857]: The current time is Wednesday 20 April 2022 05:15:45 AM IST Apr 20 05:15:46 linuxhelp linuxhelp.sh[4857]: The current time is Wednesday 20 April 2022 05:15:46 AM IST Apr 20 05:15:47 linuxhelp linuxhelp.sh[4857]: The current time is Wednesday 20 April 2022 05:15:47 AM IST Apr 20 05:15:48 linuxhelp linuxhelp.sh[4857]: The current time is Wednesday 20 April 2022 05:15:48 AM IST Apr 20 05:15:49 linuxhelp linuxhelp.sh[4857]: The current time is Wednesday 20 April 2022 05:15:49 AM IST Apr 20 05:15:50 linuxhelp linuxhelp.sh[4857]: The current time is Wednesday 20 April 2022 05:15:50 AM IST Apr 20 05:15:51 linuxhelp linuxhelp.sh[4857]: The current time is Wednesday 20 April 2022 05:15:51 AM IST Apr 20 05:15:52 linuxhelp linuxhelp.sh[4857]: The current time is Wednesday 20 April 2022 05:15:52 AM IST Apr 20 05:15:53 linuxhelp linuxhelp.sh[4857]: The current time is Wednesday 20 April 2022 05:15:53 AM IST 

Step 8 : View the syslog file by using the below command

[email protected]:/etc /systemd/system# tail /var/log/syslog Apr 20 05:16:24 linuxhelp linuxhelp.sh[4857]: The current time is Wednesday 20 April 2022 05:16:24 AM IST Apr 20 05:16:25 linuxhelp linuxhelp.sh[4857]: The current time is Wednesday 20 April 2022 05:16:25 AM IST Apr 20 05:16:26 linuxhelp linuxhelp.sh[4857]: The current time is Wednesday 20 April 2022 05:16:26 AM IST Apr 20 05:16:27 linuxhelp linuxhelp.sh[4857]: The current time is Wednesday 20 April 2022 05:16:27 AM IST Apr 20 05:16:28 linuxhelp linuxhelp.sh[4857]: The current time is Wednesday 20 April 2022 05:16:28 AM IST Apr 20 05:16:29 linuxhelp linuxhelp.sh[4857]: The current time is Wednesday 20 April 2022 05:16:29 AM IST Apr 20 05:16:30 linuxhelp linuxhelp.sh[4857]: The current time is Wednesday 20 April 2022 05:16:30 AM IST Apr 20 05:16:31 linuxhelp linuxhelp.sh[4857]: The current time is Wednesday 20 April 2022 05:16:31 AM IST Apr 20 05:16:32 linuxhelp linuxhelp.sh[4857]: The current time is Wednesday 20 April 2022 05:16:32 AM IST Apr 20 05:16:33 linuxhelp linuxhelp.sh[4857]: The current time is Wednesday 20 April 2022 05:16:33 AM IST 

Step 9 : View the log while it is running every second by using the below command

[email protected]:/etc/systemd/system# journalctl -u linuxhelp -f -- Logs begin at Sat 2022-04-02 00:59:05 IST. -- Apr 20 05:17:06 linuxhelp linuxhelp.sh[4857]: The current time is Wednesday 20 April 2022 05:17:06 AM IST Apr 20 05:17:07 linuxhelp linuxhelp.sh[4857]: The current time is Wednesday 20 April 2022 05:17:07 AM IST Apr 20 05:17:08 linuxhelp linuxhelp.sh[4857]: The current time is Wednesday 20 April 2022 05:17:08 AM IST Apr 20 05:17:09 linuxhelp linuxhelp.sh[4857]: The current time is Wednesday 20 April 2022 05:17:09 AM IST Apr 20 05:17:10 linuxhelp linuxhelp.sh[4857]: The current time is Wednesday 20 April 2022 05:17:10 AM IST Apr 20 05:17:11 linuxhelp linuxhelp.sh[4857]: The current time is Wednesday 20 April 2022 05:17:11 AM IST Apr 20 05:17:12 linuxhelp linuxhelp.sh[4857]: The current time is Wednesday 20 April 2022 05:17:12 AM IST Apr 20 05:17:13 linuxhelp linuxhelp.sh[4857]: The current time is Wednesday 20 April 2022 05:17:13 AM IST Apr 20 05:17:14 linuxhelp linuxhelp.sh[4857]: The current time is Wednesday 20 April 2022 05:17:14 AM IST Apr 20 05:17:15 linuxhelp linuxhelp.sh[4857]: The current time is Wednesday 20 April 2022 05:17:15 AM IST Apr 20 05:17:16 linuxhelp linuxhelp.sh[4857]: The current time is Wednesday 20 April 2022 05:17:16 AM IST Apr 20 05:17:17 linuxhelp linuxhelp.sh[4857]: The current time is Wednesday 20 April 2022 05:17:17 AM IST Apr 20 05:17:18 linuxhelp linuxhelp.sh[4857]: The current time is Wednesday 20 April 2022 05:17:18 AM IST Apr 20 05:17:19 linuxhelp linuxhelp.sh[4857]: The current time is Wednesday 20 April 2022 05:17:19 AM IST Apr 20 05:17:20 linuxhelp linuxhelp.sh[4857]: The current time is Wednesday 20 April 2022 05:17:20 AM IST Apr 20 05:17:21 linuxhelp linuxhelp.sh[4857]: The current time is Wednesday 20 April 2022 05:17:21 AM IST Apr 20 05:17:22 linuxhelp linuxhelp.sh[4857]: The current time is Wednesday 20 April 2022 05:17:22 AM IST ^Z [2]+ Stopped journalctl -u linuxhelp –f 

Step 10: Stop the service of linuxhelp by using the below command

[email protected]:/etc/systemd/system# systemctl stop linuxhelp 

Step 11 : Edit the linuxhelp.service file by using the below command

[email protected]:/etc/systemd/system# nano linuxhelp.service 

Step 12 : Enable the service of linuxhelp by using the below command

[email protected]:/etc/systemd/system# systemctl enable linuxhelp Created symlink /etc/systemd/system/mylti-user.target.wants/linuxhelp.service → /etc/systemd/system/linuxhelp.service. 

Step 13 : Reload the daemon service by using the below command

[email protected]:/etc/systemd/system# systemctl daemon-reload 

Step 14 : Restart the service of linuxhelp by using the below command

[email protected]:/etc/systemd/system# systemctl restart linuxhelp 

Step 15 : Check the status of linuxhelp by using the below command

[email protected]:/etc/systemd/system# systemctl status linuxhelp ΓùÅ linuxhelp.service - My linuxhelp service Loaded: loaded (/etc/systemd/system/linuxhelp.service; enabled; vendor preset: enabled) Active: active (running) since Wed 2022-04-20 05:21:56 IST; 8s ago Main PID: 5297 (linuxhelp.sh) Tasks: 2 (limit: 4571) Memory: 1.1M CGroup: /system.slice/linuxhelp.service Γö£ΓöÇ5297 /bin/bash /root/linuxhelp.sh ΓööΓöÇ5335 sleep 1 Apr 20 05:21:56 linuxhelp systemd[1]: Started My linuxhelp service. Apr 20 05:21:56 linuxhelp linuxhelp.sh[5297]: The current time is Wednesday 20 April 2022 05:21:56 AM IST Apr 20 05:21:57 linuxhelp linuxhelp.sh[5297]: The current time is Wednesday 20 April 2022 05:21:57 AM IST Apr 20 05:21:58 linuxhelp linuxhelp.sh[5297]: The current time is Wednesday 20 April 2022 05:21:58 AM IST Apr 20 05:21:59 linuxhelp linuxhelp.sh[5297]: The current time is Wednesday 20 April 2022 05:21:59 AM IST Apr 20 05:22:00 linuxhelp linuxhelp.sh[5297]: The current time is Wednesday 20 April 2022 05:22:00 AM IST Apr 20 05:22:01 linuxhelp linuxhelp.sh[5297]: The current time is Wednesday 20 April 2022 05:22:01 AM IST Apr 20 05:22:02 linuxhelp linuxhelp.sh[5297]: The current time is Wednesday 20 April 2022 05:22:02 AM IST Apr 20 05:22:03 linuxhelp linuxhelp.sh[5297]: The current time is Wednesday 20 April 2022 05:22:03 AM IST Apr 20 05:22:04 linuxhelp linuxhelp.sh[5297]: The current time is Wednesday 20 April 2022 05:22:04 AM IST 

With this, the process of Configuring Systemd Service On Linux Mint 20.3 has comes to an end

Читайте также:  Starting oracle on linux

Источник

How to Check Status of a Service in Linux Mint 21

There are a lot of services running in the background of a Linux system that belong to the applications installed on a Linux system. Some applications require enabling their services for using them, moreover if there is any application on your Linux system that is not working correctly, or you are having issues while using them.

For that Linux provides the option of checking the status of services that shows if the application is enabled or not and is active or not. So, if you are looking for a way to check the status of an application on your Linux system then give this guide a read.

How to Get the List of Services on Linux Mint 21

To see status of all the services collectively use the following command in Linux Mint terminal as it will display the all the services on your Linux system:

Checking the Status of a Service in Linux Mint 21

Checking the status of any service plays a vital role if one is facing an issue while using any application on a Linux system and there are two ways to check the status of any service in Linux Mint 21:

1: Using systemctl Command

To use systemctl command for checking the status of any service of Linux Mint 21 the following syntax that should be used:

For example, if you want to check the status of SSH service in your Linux Mint 21 then:

The systemctl command in Linux is primarily used to control and manage the services present in a Linux system.

Читайте также:  Usb programming in linux

2: Using service Command

To use service command for checking the status of any service of Linux Mint 21 the following syntax that should be used:

For better understanding the is an example that has been done for you:

How to Enable or Disable a Service in Linux Mint 21 using systemctl

Sometimes services need to be enabled to work properly so always first check the status of newly installed applications to see if it requires enabling or not. To enable any service on Linux Mint 21, follow the syntax given below:

For example, if you want to enable the service of Bluetooth on Linux Mint then use:

Similarly, to disable any service just replace enable with disable in the above command:

Conclusion

Services are the applications installed on Linux Mint 21 and to see if any service is working correctly normally the status of the service is checked either using systemctl command or service command. This command can be further used to list the status of all services installed on your Linux system.

About the author

Aaliyan Javaid

I am an electrical engineer and a technical blogger. My keen interest in embedded systems has led me to write and share my knowledge about them.

Источник

Оцените статью
Adblock
detector