/how-to-create-systemd-service-unit-in-linux

SYSTEMD

systemd uses its own .service files (units with the .service suffix)

[Unit]: this section contains information not specifically related to the type of the unit, such as the;
service description

[Unit]
Description=The Apache HTTP Server

the After option, we can state that our unit should be started after the units we provide;

After=network.target remote-fs.target nss-lookup.target httpd-init.service

start the service unit httpd.service only after the network, remove-fs, nss-lookup targets and the httpd-init service

dependencies can be declared by using the Requires option;

Requires=avahi-daemon.socket

list "soft" dependencies by using the Wants option;

Wants=docker-storage-setup.service

[Service] section of a service unit: contains information about the specific type of the unit, we can specify things as the command to be executed when the service is started

[Service]
ExecStart=/usr/sbin/NetworkManager --no-daemon

The command to be executed when a service starts, is declared by using the ExecStart option, declare commands to be executed before and after the service is started, by using the ExecStartPre and ExecStartPost options respectively.

[Install]: This section contains information about the installation of the unit; we can use options related to the service installation.

[Install]
WantedBy=multi-user.target

Sample <service>.service file: (ethtool.service)
Save in : /usr/lib/systemd/system and /etc/systemd/system

[Unit]
Description=Force ens5f5 ethernet interface to 100Mbps
Requires=Network.target
After=Network.target

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/sbin/ethtool -s ens5f5 wol d
ExecStop=/usr/sbin/ethtool -s ens5f5 wol g

[Install]
WantedBy=multi-user.target

Install the service we will copy the file into the /etc/systemd/system directory as ethtools.service, than we will start it:

$ sudo cp ethtools.service /etc/systemd/system && sudo systemctl start ethtools.service

verify the service is active, with the following command:

$ systemctl is-active ethtools.service
active

Source

Difference between ddrescue, dd_rescue, and gddrescue

dd_rescue is packaged under the name ddrescue, and ddrescue is packaged under the name gddrescue

ddrescue is a program written in C++ and produces output on the console/terminal, handles unreadable blocks (recovery).

gddrescue  is the GNU ddrescue version providing the /sbin/ddrescue executable

Reference link

/dev/kvm device: permission denied [solved]

New Ubuntu 18.04 install, fresh Android Studio 4.0 install.  First run....

/dev/kvm device: permission denied

Here's how to fix, the correct way.

Install qemu-kvm.

sudo apt install qemu-kvm

add user to the kvm group.

sudo adduser <username> kvm

reboot your system.

 

how to copy files from windows to linux using command line

Download pscp.exe from here

Copy File from Windows To Linux

pscp -pw password C:\Users\Admin\Desktop\test.txt This email address is being protected from spambots. You need JavaScript enabled to view it.:/home/vagrant

__ -pw for the password
__ replace password
__ C:\Users\file.doc represents the file that will be copied
__ 10.0.0.10 is the IP of the server.
__ /home/mypath is the path to copy the file

Copy File From Linux To Windows

pscp -pw password This email address is being protected from spambots. You need JavaScript enabled to view it.:/mypath/file C:\Users\MyDirectory\ 

References:
Comtechies
Putty pscp
Medium
Serverfault