<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div dir="ltr"></div><div dir="ltr"><br></div><div dir="ltr"><br><blockquote type="cite">On 18 Apr 2023, at 14:54, Bill Steinberg <bill@ponusridge.com> wrote:<br><br></blockquote></div><blockquote type="cite"><div dir="ltr"><meta http-equiv="content-type" content="text/html; charset=utf-8"><blockquote type="cite"><div dir="auto"><div dir="auto">"Directly" means *not using wrapper scripts.* You can put command line arguments in ExecStart.</div></div></blockquote><div><br></div>Is there a way to run a shell script in a systemd which runs this type of command: "eval $DCC_LIBEXEC/dccifd $DCCIFD_ARGS”. The Distributed Checksum Clearinghouses shell scripts end up running this command. I’d rather use their scripts directly instead of having to extract the necessary parts required for a systemd forking type.</div></blockquote><div><br></div>Yes. You do not need the eval.<div><br><div>You do need to read the file that sets the env var using EnvironmentFile=.</div><div>Then you can use ExecStart=${DDC_LIB}/ddcifd $DDCIFD_ARGS</div><div>Note the use of {} in only one place.</div><div><br></div><div>Barry</div><div><div><div><blockquote type="cite"><div dir="ltr"><div><div><div><br><blockquote type="cite"><div>On Apr 18, 2023, at 12:02 AM, Mantas Mikulėnas <grawity@gmail.com> wrote:</div><br class="Apple-interchange-newline"><div><meta charset="UTF-8"><div dir="auto" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Apr 18, 2023, 02:59 Bill Steinberg <<a href="mailto:bill@ponusridge.com">bill@ponusridge.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div style="line-break: after-white-space;"><br><div>Hi Barry,</div><div><br></div><div>Thanks for the response. Answers inline below.</div><div><br><blockquote type="cite"><div>On Apr 17, 2023, at 5:09 PM, Barry <<a href="mailto:barry@barrys-emacs.org" target="_blank" rel="noreferrer">barry@barrys-emacs.org</a>> wrote:</div><br><div><div dir="ltr" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none;"><br><br><blockquote type="cite">On 17 Apr 2023, at 19:05, Bill Steinberg <<a href="mailto:bill@ponusridge.com" target="_blank" rel="noreferrer">bill@ponusridge.com</a>> wrote:<br><br></blockquote></div><blockquote type="cite" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none;"><div dir="ltr"><span style="font-family: -webkit-standard; font-size: medium;">Hello systemd devel,</span><div><br></div><div>I have a systemd service that I’ve run on prior versions of fedora which fails to start via systemd on Fedora release 37. It is a oneshot service that starts the distributed checksum clearing house’s dccifd service via a shell script. Here is the definition of the service:</div><div><br></div><blockquote style="margin: 0px 0px 0px 40px; border: medium; padding: 0px;"><div><font face="Courier">[Unit]</font></div><div><font face="Courier">Description=Distributed Checksum Clearinghouses dccifd daemon</font></div><div><font face="Courier">After=syslog.target network.target</font></div><div><font face="Courier"><br></font></div><div><font face="Courier">[Service]</font></div><div><font face="Courier">Type=oneshot</font></div></blockquote></div></blockquote><div style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none;"><br></div><span style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none; float: none; display: inline !important;">Oneshot seems wrong.</span><div style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none;"><br><blockquote type="cite"><div dir="ltr"><blockquote style="margin: 0px 0px 0px 40px; border: medium; padding: 0px;"><div><font face="Courier">RemainAfterExit=yes</font></div><div><font face="Courier">ExecStart=/var/dcc/libexec/rcDCC -m dccifd start</font></div></blockquote></div></blockquote>Does this run a background daemon?</div></div></blockquote><div><br></div><div>Yes, the rcDCC shell script starts and runs a linux executable, a background daemon as you call it.</div></div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">A "background daemon" is just Type=forking.</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div style="line-break: after-white-space;"><div><br><blockquote type="cite"><div><div style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none;">Can you just run that daemon directly?</div></div></blockquote><div><br></div><div>I could run the shell script directly to start the dccifd executable however if the fedora linux server is rebooted I would need to remember to run the shell script manually. I’d like the dccifd daemon to start automatically when the fedora linux server is started. Isn’t systemd meant for this?</div></div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">"Directly" means *not using wrapper scripts.* You can put command line arguments in ExecStart.</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div style="line-break: after-white-space;"><div><br><blockquote type="cite"><div><div style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none;">Hopefully that program can be run without demonising.</div><div style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none;"><br></div><div style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none;"><br><blockquote type="cite"><div dir="ltr"><blockquote style="margin: 0px 0px 0px 40px; border: medium; padding: 0px;"><div><font face="Courier">ExecStop=/var/dcc/libexec/rcDCC -m dccifd stop</font></div></blockquote></div></blockquote>If it is oneshot it does not need a stop</div></div></blockquote><div><br></div><div>Is there another type that should be used besides oneshot? I may want to run systemctl stop dccifd.service, for example when dccifd is being upgraded to a new version.</div><div><br></div><div>The dccifd executable is started and stopped using a shell script. It is not run directly. One reason is that the shell script contains the arguments that are passed to the dccifd linux executable.</div></div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">That's still just Type=forking.</div><div dir="auto"><br></div><div dir="auto">Make sure the script `exec`s the main process rather than spawning it underneath as usual.</div><div dir="auto"><br></div><div dir="auto">But why put those arguments in a shell script? Isn't systemd meant for this?</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div style="line-break: after-white-space;"><div><br><blockquote type="cite"><div><div style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none;"><br><blockquote type="cite"><div dir="ltr"><blockquote style="margin: 0px 0px 0px 40px; border: medium; padding: 0px;"><div><font face="Courier">Restart=no</font></div><div><font face="Courier"><br></font></div><div><font face="Courier">[Install]</font></div><div><font face="Courier">WantedBy=multi-user.target</font></div></blockquote><div><br></div><div><br></div><div>The error in the journalctl log is:</div><div><br></div><blockquote style="margin: 0px 0px 0px 40px; border: medium; padding: 0px;"><div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-feature-settings: normal;"><span style="background-color: rgb(255, 255, 255);"><span style="font-variant-ligatures: no-common-ligatures;">systemd[1]: Starting </span><span style="font-variant-ligatures: no-common-ligatures;">dccifd</span><span style="font-variant-ligatures: no-common-ligatures;">.service - Distributed Checksum Clearinghouses </span><span style="font-variant-ligatures: no-common-ligatures;">dccifd</span><span style="font-variant-ligatures: no-common-ligatures;">daemon…</span></span></div></div><div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-feature-settings: normal;"><span style="background-color: rgb(255, 255, 255);"><span style="font-variant-ligatures: no-common-ligatures;">systemd[1]: </span><span style="font-variant-ligatures: no-common-ligatures;">dccifd</span><span style="font-variant-ligatures: no-common-ligatures;">.service: Main process exited, code=killed, status=11/SEGV</span></span></div></div><div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-feature-settings: normal;"><span style="background-color: rgb(255, 255, 255);"><span style="font-family: Menlo; font-variant-ligatures: no-common-ligatures;">systemd[1]: </span><span style="font-family: Menlo; font-variant-ligatures: no-common-ligatures;">dccifd</span><span style="font-variant-ligatures: no-common-ligatures;"><font face="Menlo">.service: Failed with result 'signal<span>’</span>.</font></span></span></div></div><div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-feature-settings: normal;"><span style="background-color: rgb(255, 255, 255);"><span style="font-variant-ligatures: no-common-ligatures;">systemd[1]: </span><span style="font-variant-ligatures: no-common-ligatures;">Failed to start </span><span style="font-variant-ligatures: no-common-ligatures;">dccifd</span><span style="font-variant-ligatures: no-common-ligatures;">.service - Distributed Checksum Clearinghouses </span><span style="font-variant-ligatures: no-common-ligatures;">dccifd</span><span style="font-variant-ligatures: no-common-ligatures;">daemon.</span></span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-feature-settings: normal;"><span style="background-color: rgb(255, 255, 255);"><span style="font-variant-ligatures: no-common-ligatures;"><br></span></span></div></div></blockquote><span style="font-family: -webkit-standard; font-size: medium;">The two scripts in ExecStart and ExecStop run successfully outside of systemd. Any info as to why systemd fails when executing these scripts would be appreciated.</span><div><br></div><div>Best,</div><div><span style="background-color: rgb(255, 255, 255);">Bill Steinberg</span></div></div></blockquote></div></div></blockquote></div></div></blockquote></div></div></div></div></blockquote></div><br></div></div></div></blockquote></div></div></div></div></body></html>