Files
dotfiles/kde/.local/share/templates/.source/template.service
2025-11-12 18:18:12 +08:00

103 lines
3.8 KiB
Desktop File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units
# https://www.shellhacks.com/systemd-service-file-example/
# https://linuxhandbook.com/create-systemd-services/
[Unit]
# A short description of the unit.
Description=
# A list of URIs referencing documentation.
# Documentation=
# The order in which units are started.
# Before=
# After=
# If this unit gets activated, the units listed here will be activated as well. If one of the other units gets deactivated or fails, this unit will be deactivated.
# Requires=
# Configures weaker dependencies than Requires. If any of the listed units does not start successfully, it has no impact on the unit activation. This is the recommended way to establish custom unit dependencies.
# Wants=
# If a unit has a Conflicts setting on another unit, starting the former will stop the latter and vice versa.
# Conflicts=
[Install]
#A space-separated list of additional names for the unit. Most systemctl commands, excluding systemctl enable, can use aliases instead of the actual unit name.
# Alias=
# The current service will be started when the listed services are started. See the description of Wants and Requires in the [Unit] section for details.
# RequiredBy=
WantedBy=multi-user.target
# Specifies a list of units to be enabled or disabled along with this unit when a user runs systemctl enable or systemctl disable.
# Also=
[Service]
# Configures the process start-up type. One of:
# simple (default) starts the service immediately.
# It is expected that the main process
# of the service is defined in ExecStart.
# forking considers the service started up once the
# process forks and the parent has exited.
# oneshot similar to simple, but it is expected that
# the process has to exit before systemd starts
# follow-up units (useful for scripts that do a
# single job and then exit). You may want to set
# RemainAfterExit=yes as well so that systemd
# still considers the service as active after
# the process has exited.
# dbus similar to simple, but considers the service
# started up when the main process gains a D-Bus name.
# notify similar to simple, but considers the service
# started up only after it sends a special signal
# to systemd.
# idle similar to simple, but the actual execution of the
# service binary is delayed until all jobs are finished.
Type=
# Commands with arguments to execute when the service is started.Type=oneshot enables specifying multiple custom commands that are then executed sequentially. ExecStartPre and ExecStartPost specify custom commands to be executed before and after ExecStart.
ExecStart=
# Commands to execute to stop the service started via ExecStart.
ExecStop=
# Commands to execute to trigger a configuration reload in the service.
ExecReload=
# With this option enabled, the service shall be restarted when the service process exits, is killed, or a timeout is reached with the exception of a normal stop by the systemctl stop command.
Restart=
# If set to True, the service is considered active even when all its processes exited. Useful with Type=oneshot. Default value is False.
RemainAfterExit=
User=<yourUser>anthony
#Code to execute
#Can be the path to an executable or code itself
WorkingDirectory=/home/ubuntu/mydaemon
ExecStart=/home/ubuntu/mydaemon/executable
Type=simple
TimeoutStopSec=10
Restart=on-failure
RestartSec=5
######################
# ln -s ./template.service /etc/systemd/system/mydaemon.service