Skip to content

Updated with dummy service - #5

Open
fzahir786 wants to merge 3 commits into
developfrom
topic/NOJIRA-1234
Open

Updated with dummy service#5
fzahir786 wants to merge 3 commits into
developfrom
topic/NOJIRA-1234

Conversation

@fzahir786

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new systemd unit intended as a “dummy” service in the repository’s systemd/system units set.

Changes:

  • Introduces systemd/system/default.service with basic [Unit], [Service], and [Install] sections.
  • Configures ordering via After=myservice.service and a simple ExecStart/ExecStartPost flow.

Comment on lines +2 to +8
After=myservice.service

[Service]
Type=simple
ExecStart=mydaemon --option
ExecStartPost=mkdir -p /var/run/myapp
RemainAfterExit=no

Copilot AI Feb 17, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type=simple is prone to readiness race conditions (systemd considers the service started immediately). Prefer Type=notify for long-running daemons (with sd_notify readiness) or Type=oneshot for one-time setup tasks, consistent with the other units in this directory.

Suggested change
After=myservice.service
[Service]
Type=simple
ExecStart=mydaemon --option
ExecStartPost=mkdir -p /var/run/myapp
RemainAfterExit=no
Description=Default mydaemon service
After=myservice.service
Requires=myservice.service
[Service]
Type=notify
ExecStart=/usr/bin/mydaemon --option
ExecStartPost=/usr/bin/mkdir -p /var/run/myapp
ExecReload=/bin/kill -HUP $MAINPID
TimeoutStartSec=30
TimeoutStopSec=10

Copilot uses AI. Check for mistakes.
Comment on lines +2 to +7
After=myservice.service

[Service]
Type=simple
ExecStart=mydaemon --option
ExecStartPost=mkdir -p /var/run/myapp

Copilot AI Feb 17, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exec* commands should use absolute paths. ExecStart=mydaemon --option should point to the full path of the binary (e.g., under /usr/bin), otherwise it may fail under systemd due to a restricted PATH.

Suggested change
After=myservice.service
[Service]
Type=simple
ExecStart=mydaemon --option
ExecStartPost=mkdir -p /var/run/myapp
Description=Default mydaemon service
After=myservice.service
Requires=myservice.service
[Service]
Type=notify
ExecStart=/usr/bin/mydaemon --option
ExecStartPost=/usr/bin/mkdir -p /var/run/myapp
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
RestartSec=5
TimeoutStartSec=30
TimeoutStopSec=10

Copilot uses AI. Check for mistakes.
[Service]
Type=simple
ExecStart=mydaemon --option
ExecStartPost=mkdir -p /var/run/myapp

Copilot AI Feb 17, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ExecStartPost=mkdir ... should also use an absolute path to mkdir. Also consider replacing this with systemd’s built-in directory management (e.g., RuntimeDirectory=) to avoid spawning an extra process during startup.

Suggested change
ExecStartPost=mkdir -p /var/run/myapp
RuntimeDirectory=myapp
TimeoutStartSec=30
TimeoutStopSec=10

Copilot uses AI. Check for mistakes.
Comment on lines +6 to +8
ExecStart=mydaemon --option
ExecStartPost=mkdir -p /var/run/myapp
RemainAfterExit=no

Copilot AI Feb 17, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RemainAfterExit= is only meaningful for services that exit (typically Type=oneshot). With Type=simple this setting is redundant/confusing; either remove it or switch to Type=oneshot and set RemainAfterExit= based on the desired persistent state.

Suggested change
ExecStart=mydaemon --option
ExecStartPost=mkdir -p /var/run/myapp
RemainAfterExit=no
ExecStart=/usr/bin/mydaemon --option
ExecStartPost=/usr/bin/mkdir -p /var/run/myapp

Copilot uses AI. Check for mistakes.
Comment on lines +2 to +8
After=myservice.service

[Service]
Type=simple
ExecStart=mydaemon --option
ExecStartPost=mkdir -p /var/run/myapp
RemainAfterExit=no

Copilot AI Feb 17, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add explicit TimeoutStartSec= and TimeoutStopSec= so boot/shutdown can’t hang indefinitely on this unit (systemd defaults are relatively long). Pick values appropriate to this service’s expected startup/shutdown time.

Suggested change
After=myservice.service
[Service]
Type=simple
ExecStart=mydaemon --option
ExecStartPost=mkdir -p /var/run/myapp
RemainAfterExit=no
Description=Default application service
After=myservice.service
[Service]
Type=simple
ExecStart=/usr/bin/mydaemon --option
ExecStartPost=/usr/bin/mkdir -p /var/run/myapp
ExecReload=/bin/kill -HUP $MAINPID
RemainAfterExit=no
TimeoutStartSec=30
TimeoutStopSec=10
Restart=on-failure
RestartSec=5

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,11 @@
[Unit]

Copilot AI Feb 17, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a meaningful Description= in the [Unit] section. All other unit files in systemd/system/ include Description=, and without it this service will be harder to identify in systemctl output and logs.

Suggested change
[Unit]
[Unit]
Description=Default service for mydaemon

Copilot uses AI. Check for mistakes.
Comment on lines +2 to +8
After=myservice.service

[Service]
Type=simple
ExecStart=mydaemon --option
ExecStartPost=mkdir -p /var/run/myapp
RemainAfterExit=no

Copilot AI Feb 17, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this unit truly depends on myservice.service being present/started, After= alone only enforces ordering and won’t pull it in; add an appropriate dependency (Requires= for hard dependency or Wants= for soft dependency) alongside After=. If it’s not a real prerequisite, consider removing the After= to avoid accidental ordering constraints.

Suggested change
After=myservice.service
[Service]
Type=simple
ExecStart=mydaemon --option
ExecStartPost=mkdir -p /var/run/myapp
RemainAfterExit=no
Description=Default service
After=myservice.service
Wants=myservice.service
[Service]
Type=simple
ExecStart=/usr/bin/mydaemon --option
ExecStartPost=/usr/bin/mkdir -p /var/run/myapp
ExecReload=/bin/kill -HUP $MAINPID
RemainAfterExit=no
Restart=on-failure
RestartSec=5
TimeoutStartSec=30
TimeoutStopSec=10

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants