<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix">Interesting question. The short answer
is no.<br>
<br>
A systemd unit installed by distro installed packages can only be
controlled by the package owner, 99.8% of which will be root. But
it *is* possible to install a systemd unit as a normal user and
control it by that user. I have done this when I need to install
stuff on Centoses that have stupidly old versions of perl. These
necessitate running a more recent perl installed (using perlbrew)
running as the sysop user. In that case I installed the
dxspider.system unit, slightly modified, from within elsewhere in
the /spider tree, rather than the usual place in
/etc/systemd/system.<br>
<br>
The only place you can do what you want is with the system crond.
And the easiest way to that: is to 'sudo -s'; then do a 'crontab
-e' put in your requirements in the normal crontab way and then
exit the editor. This will then install that crontab (that you
have just created) in the right place and execute it as 'root'.
Note: this is a completely separate crontab to any that are
already controlled by any distro installed crontab controled jobs,
so you can do what you need/like in it.<br>
<br>
Does this help?<br>
<br>
Dirk<br>
<br>
On 30/01/2023 08:34, Keith Maton via Dxspider-support wrote:<br>
</div>
<blockquote type="cite"
cite="mid:39080B26-4EDE-4C52-8699-BC5552975B7E@me.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
Thanks Dirk.
<div><br>
</div>
<div>It’s not the cluster I’m trying to shut down from within
crontab, it’s another service.</div>
<div><br>
</div>
<div>I also tried writing a small perl script in /spider/local_cmd
to stop the script, load that using load/cmd and call that
script to stop the service. It didn’t work either.</div>
<div><br>
</div>
<div>Is this something to do with it running under sysop and not
under a root account?</div>
<div><br>
</div>
<div>Is there any way you can think of to stop and start a service
using the spider crontab please?</div>
<div><br>
</div>
<div>Thanks,</div>
<div><br>
</div>
<div>73 Keith</div>
<div><br>
</div>
<div>
<div><br>
<blockquote type="cite">
<div>On 30 Jan 2023, at 00:21, Dirk Koopman via
Dxspider-support <a class="moz-txt-link-rfc2396E" href="mailto:dxspider-support@tobit.co.uk"><dxspider-support@tobit.co.uk></a>
wrote:</div>
<br class="Apple-interchange-newline">
<div>
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8">
<div>
<div class="moz-cite-prefix">Try this:<br>
<br>
<div><span style="font-family: Menlo; font-size:
11px;">50 00 * * * run_cmd("shutdown")</span></div>
<div><font face="Menlo"><span style="font-size: 11px;"><br>
The system unit will restart the node
immediately after it has shut itself down.<br>
<br>
Dirk<br>
</span></font></div>
<br>
On 29/01/2023 21:14, Keith Maton via Dxspider-support
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:4F915AE2-63AC-45F7-98C0-E0EF987E6835@me.com">
<meta http-equiv="content-type" content="text/html;
charset=UTF-8">
Yes, yes I have. I’ve been trying that today as it
would be the perfect solution.
<div><br>
</div>
<div>One of the commands I’m running through the
system crontab is to stop a service. I tried the
same thing through the spider crontab.</div>
<div><br>
</div>
<div>I did some testing and this didn’t stop the
service. </div>
<div><br>
</div>
<div><span style="font-family: Menlo; font-size:
11px;">50 00 * * * spawn("sudo service xxx stop")</span></div>
<div><font face="Menlo"><span style="font-size: 11px;"><br>
</span></font></div>
<div>I tried using sudo systemctl stop xxx as well, no
joy. It shows in the debug log but the service
doesn’t stop.</div>
<div><br>
</div>
<div>
<div style="margin: 0px; font-stretch: normal;
font-size: 11px; line-height: normal; font-family:
Menlo;"><span style="font-variant-ligatures:
no-common-ligatures;">1675025460^(cron) cron: 51
20 29 1 0 -> doing 'spawn("sudo systemctl
stop xxx")'</span></div>
<div style="margin: 0px; font-stretch: normal;
font-size: 11px; line-height: normal; font-family:
Menlo;"><span style="font-variant-ligatures:
no-common-ligatures;">1675025460^(cron)
DXCron::spawn: sudo systemctl stop xxx</span></div>
<div style="margin: 0px; font-stretch: normal;
font-size: 11px; line-height: normal; font-family:
Menlo;">1675025460^(progress) subprocess stats
cmd: 'sudo systemctl stop xxx' by DXCron::spawn
82mS</div>
<div style="margin: 0px; font-stretch: normal;
font-size: 11px; line-height: normal; font-family:
Menlo;"><br>
</div>
</div>
<div>I’ve also tested using ‘ instead of “ because I
have some spawn commands in my spider crontab with ‘
and some with “, neither work to stop the service.</div>
<div><br>
</div>
<div>Also tried this in case it needed the path.</div>
<div><br>
</div>
<div>
<div style="margin: 0px; font-stretch: normal;
font-size: 11px; line-height: normal; font-family:
Menlo;"><span style="font-variant-ligatures:
no-common-ligatures;">02 21 * * * spawn('sudo
/usr/bin/systemctl stop xxx')</span></div>
</div>
<div><span style="font-variant-ligatures:
no-common-ligatures;"><br>
</span></div>
<div>That also didn’t stop the service.</div>
<div><br>
</div>
<div>
<div style="margin: 0px; font-stretch: normal;
font-size: 11px; line-height: normal; font-family:
Menlo;"><span style="font-variant-ligatures:
no-common-ligatures;">1675026120^(cron) cron: 2
21 29 1 0 -> doing 'spawn('sudo
/usr/bin/systemctl stop xxx')'</span></div>
</div>
<div><span style="font-family: Menlo; font-size:
11px;">1675026120^(cron) DXCron::spawn: sudo
/usr/bin/systemctl stop xxx</span></div>
<div><span style="font-variant-ligatures:
no-common-ligatures;">
<div style="margin: 0px; font-stretch: normal;
font-size: 11px; line-height: normal;
font-family: Menlo;"><span
style="font-variant-ligatures:
no-common-ligatures;">1675026120^(progress)
subprocess stats cmd: 'sudo /usr/bin/systemctl
stop xxx' by DXCron::spawn 90mS</span></div>
<div><span style="font-variant-ligatures:
no-common-ligatures;"><br>
</span></div>
</span></div>
<div>73 Keith</div>
<div><br>
<blockquote type="cite">
<div>On 29 Jan 2023, at 20:25, Kin EA3CV <a
class="moz-txt-link-rfc2396E"
href="mailto:ea3cv@cronux.net"
moz-do-not-send="true"><ea3cv@cronux.net></a>
wrote:</div>
<br class="Apple-interchange-newline">
<div>
<div>
<div><span style="color: rgb(77, 81, 86);
font-family: Roboto, "Helvetica
Neue", Arial, sans-serif; font-size:
12pt; background-color: rgb(255, 255,
255); display: inline !important;">And you
haven't thought about centralizing
everything in the spider crontab, it would
be easier, I think.</span><br>
<div dir="auto"><span style="color:rgb(77,
81, 86);font-family:Roboto,
"Helvetica Neue", Arial,
sans-serif;font-size:small;background-color:rgb(255,
255, 255);display:inline !important"><br>
</span></div>
<div dir="auto"><span style="color: rgb(77,
81, 86); font-family: Roboto,
"Helvetica Neue", Arial,
sans-serif; font-size: 12pt;
background-color: rgb(255, 255, 255);
display: inline !important;">Kin </span></div>
<div dir="auto"><span style="color: rgb(77,
81, 86); font-family: Roboto,
"Helvetica Neue", Arial,
sans-serif; font-size: 12pt;
background-color: rgb(255, 255, 255);
display: inline !important;"><br>
</span></div>
</div>
<div><br>
</div>
<div id="ms-outlook-mobile-signature"
dir="auto">Obtener <a
href="https://aka.ms/AAb9ysg"
moz-do-not-send="true">Outlook para
Android</a></div>
</div>
</div>
</blockquote>
</div>
<br>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
Dxspider-support mailing list
<a class="moz-txt-link-abbreviated moz-txt-link-freetext" href="mailto:Dxspider-support@tobit.co.uk" moz-do-not-send="true">Dxspider-support@tobit.co.uk</a>
<a class="moz-txt-link-freetext" href="https://mailman.tobit.co.uk/mailman/listinfo/dxspider-support" moz-do-not-send="true">https://mailman.tobit.co.uk/mailman/listinfo/dxspider-support</a>
</pre>
</blockquote>
<br>
</div>
_______________________________________________<br>
Dxspider-support mailing list<br>
<a class="moz-txt-link-abbreviated" href="mailto:Dxspider-support@tobit.co.uk">Dxspider-support@tobit.co.uk</a><br>
<a class="moz-txt-link-freetext" href="https://mailman.tobit.co.uk/mailman/listinfo/dxspider-support">https://mailman.tobit.co.uk/mailman/listinfo/dxspider-support</a><br>
</div>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
Dxspider-support mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Dxspider-support@tobit.co.uk">Dxspider-support@tobit.co.uk</a>
<a class="moz-txt-link-freetext" href="https://mailman.tobit.co.uk/mailman/listinfo/dxspider-support">https://mailman.tobit.co.uk/mailman/listinfo/dxspider-support</a>
</pre>
</blockquote>
<br>
</body>
</html>