<div class="post-text">
<p>Dear fellow Ubuntu users,</p>
<p>I have an automatation question I'd like to ask from you.
My server runs some servers which are, unfortunately, not daemons (like
Minecraft or Source Dedicated Server). I am planning on making them
automatically start at boot with the <em>@reboot</em> directive in crontab, but I wish their sessions to be usable from <em>byobu</em>.</p>
<p>Problem being, that byobu does not auto-start. I have written a shell script:</p>
<pre class="lang-bsh prettyprint"><code><span class="com">#!/bin/bash</span><span class="pln"><br>screen </span><span class="pun">-</span><span class="pln">dr byobu </span><span class="pun">-</span><span class="pln">X screen </span><span class="pun">-</span><span class="pln">t srcds<br>
screen </span><span class="pun">-</span><span class="pln">r byobu </span><span class="pun">-</span><span class="pln">p srcds </span><span class="pun">-</span><span class="pln">X stuff </span><span class="str">"./start_gmod.sh $(printf '\r')"</span><span class="pln"><br>
</span></code></pre>
<p>And I execute it as my <strong>nonprivileged</strong> user in <em>crontab</em>:</p>
<pre class="lang-bsh prettyprint"><code><span class="lit">@reboot</span><span class="pln"> sourcesrv cd </span><span class="pun">/</span><span class="pln">srv</span><span class="pun">/</span><span class="pln">srcds</span><span class="pun">/</span><span class="pln">orangebox </span><span class="pun">&&</span><span class="pln"> </span><span class="pun">./</span><span class="pln">hook</span><span class="pun">-</span><span class="pln">byobu</span><span class="pun">.</span><span class="pln">sh<br>
</span></code></pre>
<p>However, running this script requires <em>byobu</em> to be started
when it runs. If I test the script with starting byobu by hand and then
executing it from SSH, it does order byobu to make a new window and then
starts the server.</p>
<p>My question being: can I, somehow, automatize the start of byobu into the <em>hook-byobu.sh</em> file? I tried adding <em>byobu</em> (the command itself) after the shebang-line, but then it hangs until I, by hand, F6 (detach) from byobu.</p>
<p>Turning byobu's <em>Start automatically after log in</em> on does not work, because there is no login to happen, as the script is started from cron.<br></p>
</div>