<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<atom:link href="https://dev1galaxy.org/extern.php?action=feed&amp;tid=4698&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[Dev1 Galaxy Forum / [SOLVED] Problem with shutdown script]]></title>
		<link>https://dev1galaxy.org/viewtopic.php?id=4698</link>
		<description><![CDATA[The most recent posts in [SOLVED] Problem with shutdown script.]]></description>
		<lastBuildDate>Mon, 29 Nov 2021 20:58:01 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[Re: [SOLVED] Problem with shutdown script]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=33071#p33071</link>
			<description><![CDATA[<p>Hello:</p><div class="quotebox"><cite>Altoid wrote:</cite><blockquote><div><p>Yes!!!<br />It lives!&#160; 8^D<br />.. look at the logs and see if anything is amiss ...</p></div></blockquote></div><p>No problems detected in the guest machine logs, <span class="bbc">Pihole</span> or <span class="bbc">Unbound</span>.</p><p><span class="bbu">For completeness&#039; sake:</span></p><p>I run an autostarted VBbox Devuan Beowulf guest running Pihole/Unbound.<br />Although it starts up properly, for some reason it does <em>not</em> shutdown gracefully.</p><p>The result is that I get error messages when I shut down the host:</p><div class="codebox"><pre><code>groucho@devuan:/var/log$ cat messages | grep -i error
--- snip ---
Nov 19 22:38:23 localhost kernel: [21254.843754] traps: VBoxSVC[2451] trap int3 ip:7fa545efcddc sp:7ffe92195e50 error:0 in VBoxXPCOMIPCC.so[7fa545ef8000+f000]
--- snip ---
groucho@devuan:/var/log$</code></pre></div><p>See <a href="https://dev1galaxy.org/viewtopic.php?id=4684" rel="nofollow">https://dev1galaxy.org/viewtopic.php?id=4684</a></p><p>Fixing this script (VBox) issue made everything right.<br />Now the host shuts down <em>after</em> the guest shuts down properly, it&#039;s health is preserved and there are no more localhost kernel errors.</p><p>Thanks to all that pitched in.&#160; 8^)</p><p>Best,</p><p>A.</p>]]></description>
			<author><![CDATA[dummy@example.com (Altoid)]]></author>
			<pubDate>Mon, 29 Nov 2021 20:58:01 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=33071#p33071</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] Problem with shutdown script]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=33069#p33069</link>
			<description><![CDATA[<p>Hello:</p><div class="quotebox"><cite>Head_on_a_Stick wrote:</cite><blockquote><div><p>... won&#039;t comment on VirtualBox ...</p></div></blockquote></div><p> =^ ) </p><div class="quotebox"><cite>Head_on_a_Stick wrote:</cite><blockquote><div><p>... an entire terminal emulator to run a script ...</p></div></blockquote></div><p>The only way I found to run this set of commands and see the printout roll out &#039;live&#039; without much hassle.<br />Maybe could have sent the output to a file.</p><div class="quotebox"><cite>Head_on_a_Stick wrote:</cite><blockquote><div><p>Perhaps just run a shell instead ....</p></div></blockquote></div><p>Yes!!!<br />It lives!&#160; 8^D</p><p><span class="bbc">sh -c &#039;vboxmanage controlvm &quot;madmax ascii&quot; poweroff &amp;&amp; wait &amp;&amp; sudo /usr/bin/shutdown.sh&#039;</span> as the command in the launcher works great.</p><p>Quite fast, maybe because the terminal is not involved now (?).</p><p>I have to look at the logs and see if anything is amiss VBox wise, but at first sight it seems to work as intended.</p><div class="quotebox"><cite>Head_on_a_Stick wrote:</cite><blockquote><div><p>... recommend using /etc/rc6.d/ to execute scripts on shutdown.</p></div></blockquote></div><p>I&#039;ll have a look at that further on.</p><p>Thank you very much for your input.<br />Much appreciated.</p><p>Best,</p><p>A.</p>]]></description>
			<author><![CDATA[dummy@example.com (Altoid)]]></author>
			<pubDate>Mon, 29 Nov 2021 20:15:45 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=33069#p33069</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] Problem with shutdown script]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=33060#p33060</link>
			<description><![CDATA[<p>I won&#039;t comment on VirtualBox (that sound you can hear is me biting my tongue) but using an entire terminal emulator to run a script seems... excessive.</p><p>Perhaps just run a shell instead, for example:</p><div class="codebox"><pre><code>sh -c &#039;command1 &amp;&amp; command2&#039;</code></pre></div><p>But I would recommend using /etc/rc6.d/ to execute scripts on shutdown. Ask the interweb for details &#039;cos I really don&#039;t know what I&#039;m doing with sysvinit.</p>]]></description>
			<author><![CDATA[dummy@example.com (Head_on_a_Stick)]]></author>
			<pubDate>Mon, 29 Nov 2021 16:02:52 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=33060#p33060</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] Problem with shutdown script]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=33059#p33059</link>
			<description><![CDATA[<p>Hello:</p><div class="quotebox"><cite>rolfie wrote:</cite><blockquote><div><p>... working directly and not in a script, my first guess would be path ...</p></div></blockquote></div><p>I thought of that at first so I checked the script and the launcher command line.<br />On one hand both <span class="bbc">xfce4-terminal</span> and <span class="bbc">vboxmanage</span> are located in <span class="bbc">/usr/bin/</span>.<br />Also, as the vm <em>does</em> get shut down, I concluded that it was not related.</p><p>Nevertheelss, I just checked to see:</p><p><span class="bbc">xfce4-terminal -x /usr/bin/vboxmanage controlvm &quot;madmax ascii&quot; poweroff &amp;&amp; wait &amp;&amp; sudo /usr/bin/shutdown.sh</span></p><p>... does not work either.</p><p>Thanks for your input.</p><p>Best,</p><p>A.</p>]]></description>
			<author><![CDATA[dummy@example.com (Altoid)]]></author>
			<pubDate>Mon, 29 Nov 2021 15:46:36 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=33059#p33059</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] Problem with shutdown script]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=33057#p33057</link>
			<description><![CDATA[<p>Hello:</p><div class="quotebox"><cite>Altoid wrote:</cite><blockquote><div><p>... try it out and report ...</p></div></blockquote></div><p>No, no change in how running the command from the launcher behaves.</p><p>But thanks a lot for the heads up on <span class="bbc">wait</span>. 8^D</p><p>Using it instead of <span class="bbc">sleep</span>, which has to be used with an arbitrary time lapse (which may or may not be always right) makes for a faster resolution of the command.</p><p>Thanks for your input.</p><p>Best,</p><p>A.</p>]]></description>
			<author><![CDATA[dummy@example.com (Altoid)]]></author>
			<pubDate>Mon, 29 Nov 2021 15:00:52 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=33057#p33057</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] Problem with shutdown script]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=33056#p33056</link>
			<description><![CDATA[<p>If its working directly and not in a script, my first guess would be path issues.</p><p>rolfie</p>]]></description>
			<author><![CDATA[dummy@example.com (rolfie)]]></author>
			<pubDate>Mon, 29 Nov 2021 14:55:30 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=33056#p33056</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] Problem with shutdown script]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=33055#p33055</link>
			<description><![CDATA[<p>Hello:</p><div class="quotebox"><cite>hevidevi wrote:</cite><blockquote><div><p>... instead of using sleep use the wait command.</p></div></blockquote></div><p>Hmm ...</p><div class="quotebox"><blockquote><div><p>&quot;... wait is a command that waits for the given jobs to complete ...&quot;</p></div></blockquote></div><p>Think that may be it?</p><p>I&#039;ll try it out and report back here.</p><p>But if it the command works from an open terminal ...</p><p><span class="bbc">vboxmanage controlvm &quot;madmax ascii&quot; poweroff &amp;&amp; sleep 5s &amp;&amp; sudo /usr/bin/shutdown.sh</span></p><p>... shouldn&#039;t it <em>also</em> work in the launcher command line?</p><p><span class="bbc">xfce4-terminal -x vboxmanage controlvm &quot;madmax ascii&quot; poweroff &amp;&amp; sleep 5s &amp;&amp; sudo /usr/bin/shutdown.sh</span></p><p>My guess is that there&#039;s something in the syntax I&#039;m using, just cannot find out what it is.</p><p>Thanks for your input.</p><p>Best,</p><p>A.</p>]]></description>
			<author><![CDATA[dummy@example.com (Altoid)]]></author>
			<pubDate>Mon, 29 Nov 2021 14:48:22 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=33055#p33055</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] Problem with shutdown script]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=33052#p33052</link>
			<description><![CDATA[<p>Maybe instead of using sleep use the wait command.</p><p><a href="https://linuxize.com/post/bash-wait/" rel="nofollow">https://linuxize.com/post/bash-wait/</a></p>]]></description>
			<author><![CDATA[dummy@example.com (hevidevi)]]></author>
			<pubDate>Mon, 29 Nov 2021 12:43:39 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=33052#p33052</guid>
		</item>
		<item>
			<title><![CDATA[[SOLVED] Problem with shutdown script]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=33038#p33038</link>
			<description><![CDATA[<p>Hello:</p><p>I shut down my Devuan Beowulf system with a script called from a launcher which I set up within the panel of my Xfce desktop:</p><p>This is the script:</p><div class="codebox"><pre><code>#!/bin/sh
# added to shutdown directly - no shutdown helper 
PATH=/sbin:/bin:/usr/sbin:/usr/bin:
#
sync &amp;&amp; sudo ethtool -s eth0 wol d &amp;&amp; sudo rmmod -s -v e1000e &amp;&amp; sudo shutdown -h now</code></pre></div><p>This is the launcher command line:</p><div class="codebox"><pre><code>xfce4-terminal -x sudo /usr/bin/shutdown.sh</code></pre></div><p>This has been working perfectly well for the longest time.<br />Some time ago I set up Pihole in an autostarted Vbox virtual machine but although it seems to start up properly it does <em>not</em> shutdown gracefully.</p><p>ie: <span class="bbc">sudo shutdown -h now</span> takes effect <em>before</em> the virtual machine has completely shut down.</p><p>The idea is to send the virtual machine the shutdown command, wait 5s and then execute the shutdown script. <br />Simple if not elegant.</p><p>As VBox gives members of the <span class="bbc">vboxusers</span> group permission to start and shutdown a virtual machine, I cannot add the shutdown command to the shutdown script called from the launcher because this script needs <span class="bbc">sudo</span>. ie: root privileges and the vms belong to <span class="bbc">vmusers</span> and not to <span class="bbc">root</span>.</p><p>So I add the virtual machine shutdown script + a 5s sleep to the launcher command line.<br />But it does not work with the launcher.</p><p><span class="bbc">vboxmanage controlvm &quot;madmax ascii&quot; poweroff &amp;&amp; sleep 5s &amp;&amp; sudo /usr/bin/shutdown.sh</span> works properly if I execute it from a terminal.</p><p>But not when I run it from the launcher:</p><p><span class="bbc">xfce4-terminal -x vboxmanage controlvm &quot;madmax ascii&quot; poweroff &amp;&amp; sleep 5s &amp;&amp; /usr/bin/shutdown.sh </span></p><p>It only shuts down the virtual machine, the rest of the command does not have effect.</p><p>Cannot figure out what I&#039;m doing wrong.</p><p>Any ideas?</p><p>Thanks in advance.</p><p>A.</p>]]></description>
			<author><![CDATA[dummy@example.com (Altoid)]]></author>
			<pubDate>Sun, 28 Nov 2021 21:46:08 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=33038#p33038</guid>
		</item>
	</channel>
</rss>
