Skip to content

Commit

Permalink
Automatically use systemd journal and run in foreground when under sy…
Browse files Browse the repository at this point in the history
…stemd

Signed-off-by: Florian Schmaus <flo@geekplace.eu>
  • Loading branch information
Flowdalic committed Nov 10, 2023
1 parent 5069982 commit 75a15c5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions irqbalance.c
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,16 @@ int main(int argc, char** argv)

parse_command_line(argc, argv);

/*
* Check if we are run under systemd and enable journal_logging
* and run in foreground if so. Systemd v232 or later will set
* INVOCATION_ID.
*/
if (getenv("INVOCATION_ID")) {
journal_logging=1;
foreground_mode=1;
}

/*
* Open the syslog connection
*/
Expand Down
2 changes: 1 addition & 1 deletion misc/irqbalance.service
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ConditionCPUs=>1
[Service]
EnvironmentFile=-/usr/lib/irqbalance/defaults.env
EnvironmentFile=-/path/to/irqbalance.env
ExecStart=/usr/sbin/irqbalance --foreground $IRQBALANCE_ARGS
ExecStart=/usr/sbin/irqbalance $IRQBALANCE_ARGS
ReadOnlyPaths=/
ReadWritePaths=/proc/irq
RestrictAddressFamilies=AF_UNIX AF_NETLINK
Expand Down

0 comments on commit 75a15c5

Please sign in to comment.