<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<atom:link href="http://dev1galaxy.org/extern.php?action=feed&amp;tid=3996&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[Dev1 Galaxy Forum / at program]]></title>
		<link>http://dev1galaxy.org/viewtopic.php?id=3996</link>
		<description><![CDATA[The most recent posts in at program.]]></description>
		<lastBuildDate>Tue, 15 Dec 2020 16:53:04 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[Re: at program]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=26276#p26276</link>
			<description><![CDATA[<div class="quotebox"><cite>Head_on_a_Stick wrote:</cite><blockquote><div><p>I don&#039;t think an init script would be appropriate for a per-user script running something in an X session. It is possible to run services just for one user and with the various permissions required for X with systemd but I don&#039;t know how to do that with other service managers.</p></div></blockquote></div><p>It is possible, i just need to figure it out.</p><p><a href="https://unix.stackexchange.com/questions/236084/how-do-i-create-a-service-for-a-shell-script-so-i-can-start-and-stop-it-like-a-d" rel="nofollow">https://unix.stackexchange.com/question … t-like-a-d</a></p>]]></description>
			<author><![CDATA[dummy@example.com (dice)]]></author>
			<pubDate>Tue, 15 Dec 2020 16:53:04 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=26276#p26276</guid>
		</item>
		<item>
			<title><![CDATA[Re: at program]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=26275#p26275</link>
			<description><![CDATA[<p>I don&#039;t think an init script would be appropriate for a per-user script running something in an X session. It is possible to run services just for one user and with the various permissions required for X with systemd but I don&#039;t know how to do that with other service managers.</p>]]></description>
			<author><![CDATA[dummy@example.com (Head_on_a_Stick)]]></author>
			<pubDate>Tue, 15 Dec 2020 16:44:56 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=26275#p26275</guid>
		</item>
		<item>
			<title><![CDATA[Re: at program]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=26274#p26274</link>
			<description><![CDATA[<div class="quotebox"><cite>Head_on_a_Stick wrote:</cite><blockquote><div><div class="quotebox"><cite>dice wrote:</cite><blockquote><div><p>I could try and daemonize it but that would be similar to a while loop script i think?</p></div></blockquote></div><p>Not sure what you mean by &quot;daemonize it&quot; but as written the script only runs through once so it can&#039;t change the wallpaper unless it is run again at some point.</p><p>Why don&#039;t you like the <span class="bbc">while</span> loop? It only runs three very simple shell commands &amp; <span class="bbc">feh</span> every ten minutes so it&#039;s not exactly resource heavy.</p></div></blockquote></div><p>I was just trying to think outside the box, explore other ways if there are any.</p><p>By daemonize i mean create an init script. Start stop daemon if possible ?</p>]]></description>
			<author><![CDATA[dummy@example.com (dice)]]></author>
			<pubDate>Tue, 15 Dec 2020 16:42:35 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=26274#p26274</guid>
		</item>
		<item>
			<title><![CDATA[Re: at program]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=26273#p26273</link>
			<description><![CDATA[<div class="quotebox"><cite>dice wrote:</cite><blockquote><div><p>I could try and daemonize it but that would be similar to a while loop script i think?</p></div></blockquote></div><p>Not sure what you mean by &quot;daemonize it&quot; but as written the script only runs through once so it can&#039;t change the wallpaper unless it is run again at some point.</p><p>Why don&#039;t you like the <span class="bbc">while</span> loop? It only runs three very simple shell commands &amp; <span class="bbc">feh</span> every ten minutes so it&#039;s not exactly resource heavy.</p>]]></description>
			<author><![CDATA[dummy@example.com (Head_on_a_Stick)]]></author>
			<pubDate>Tue, 15 Dec 2020 16:34:48 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=26273#p26273</guid>
		</item>
		<item>
			<title><![CDATA[Re: at program]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=26268#p26268</link>
			<description><![CDATA[<p>Think i have figured it out without a while loop. This script should just set the background between the hours specified.</p><p>EDIT: oops no it wont. I could try and daemonize it but that would be similar to a while loop script i think?</p><div class="codebox"><pre><code>#!/usr/bin/env bash
H=$(date +%H)
if (( 7 &lt;= 10#$H &amp;&amp; 10#$H &lt; 13 )); then 
	feh --bg-scale /usr/share/backgrounds/gnome/adwaita-morning.jpg
    echo between 8AM and 1PM
elif (( 13 &lt;= 10#$H &amp;&amp; 10#$H &lt; 19 )); then 
	feh --bg-scale /usr/share/backgrounds/gnome/adwaita-day.jpg
    echo between 1PM and 7PM
else
	feh --bg-scale /usr/share/backgrounds/gnome/adwaita-night.jpg
    echo night
fi</code></pre></div><p>I give in, looks like a while loop is the way to go, below is a variant. Hoping this works...</p><div class="codebox"><pre><code>#!/usr/bin/env bash

get_wall () {

H=$(date +%H)
if (( 7 &lt;= 10#$H &amp;&amp; 10#$H &lt; 13 )); then 
	feh --bg-scale /usr/share/backgrounds/gnome/adwaita-morning.jpg
    echo between 8AM and 1PM
elif (( 13 &lt;= 10#$H &amp;&amp; 10#$H &lt; 19 )); then 
	feh --bg-scale /usr/share/backgrounds/gnome/adwaita-day.jpg
    echo between 1PM and 7PM
else
	feh --bg-scale /usr/share/backgrounds/gnome/adwaita-night.jpg
    echo night
fi

}

while true; do
  get_wall;
  sleep 600;
done</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (dice)]]></author>
			<pubDate>Tue, 15 Dec 2020 13:56:44 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=26268#p26268</guid>
		</item>
		<item>
			<title><![CDATA[Re: at program]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=26267#p26267</link>
			<description><![CDATA[<p>Thats a good one head on a stick, no need for &quot;at&quot; at all indeed.</p><p>I tried to make something that wasnt in a while loop and have come up with the below, i would like to add in a 3rd command so it is 3 times of day (morn, day, night) but cant figure that out.</p><div class="codebox"><pre><code>#!/usr/bin/env bash

DATE=$(date +%p)
DATE2=$(date +%p)
MORNING=&quot;AM&quot;
NIGHT=&quot;PM&quot;

if [[ &quot;$DATE&quot; == &quot;$MORNING&quot; ]] ; then
	feh --bg-scale /usr/share/backgrounds/gnome/adwaita-morning.jpg
elif [[ &quot;$DATE2&quot; == &quot;$NIGHT&quot; ]] ; then
        feh --bg-scale /usr/share/backgrounds/gnome/adwaita-night.jpg
fi</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (dice)]]></author>
			<pubDate>Tue, 15 Dec 2020 12:43:53 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=26267#p26267</guid>
		</item>
		<item>
			<title><![CDATA[Re: at program]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=26262#p26262</link>
			<description><![CDATA[<div class="quotebox"><cite>dice wrote:</cite><blockquote><div><p>what do you think of below script?</p></div></blockquote></div><p>I don&#039;t think that will work because all three jobs will be run at the same time.</p><p>You could use a <span class="bbc">case</span> statement to set the wallpaper according to the time and check every 10 minutes with a <span class="bbc">while</span> loop:</p><div class="codebox"><pre><code>#!/bin/sh

while true
do
   case $(date +%H) in
      [0-9]|1[0-1]) time=morning;;
      1[2-8]) time=day;;
      19|2[0-3]) time=night;;
   esac
   feh --bg-scale /usr/share/backgrounds/gnome/adwaita-$time.jpg
   sleep 600
done</code></pre></div><p>No need for <span class="bbc">at</span> at all <img src="http://dev1galaxy.org/img/smilies/big_smile.png" width="15" height="15" alt="big_smile" /></p><p>And to keep this post on topic I would recommend checking the POSIX specification for more details on the command:</p><p><a href="https://pubs.opengroup.org/onlinepubs/9699919799/utilities/at.html" rel="nofollow">https://pubs.opengroup.org/onlinepubs/9 … es/at.html</a></p><p>The &quot;APPLICATION USAGE&quot; section at the end is particularly useful.</p><p>EDIT: moved <span class="bbc">sleep</span> inside the <span class="bbc">while</span> loop so that the wallpaper is set immediately.</p>]]></description>
			<author><![CDATA[dummy@example.com (Head_on_a_Stick)]]></author>
			<pubDate>Mon, 14 Dec 2020 19:16:11 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=26262#p26262</guid>
		</item>
		<item>
			<title><![CDATA[Re: at program]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=26254#p26254</link>
			<description><![CDATA[<p>Thanks for your help head on a stick, what do you think of below script? It works for me, sets the background in 1 minute increments x 3 using command functions in parallel. Im thinking if i put this in my autostart file (.xinitrc) with the correct time/date (today) it should suffice to emulate how the gnome backgrounds function for these wallpapers. The only issue i see is that the wallpapers wont load up if the &quot;at&quot; command is used in the past, it will fail and ill have a blank background. Ill have to figure out the time specifications better maybe.</p><div class="codebox"><pre><code>#!/usr/bin/env bash

morning () {
        at now + 1 minute &lt;&lt;&lt; &#039;DISPLAY=:0 feh --bg-scale /usr/share/backgrounds/gnome/adwaita-morning.jpg&#039;
}

day () {
        at now + 2 minute &lt;&lt;&lt; &#039;DISPLAY=:0 feh --bg-scale /usr/share/backgrounds/gnome/adwaita-day.jpg&#039;
}

night () {
        at now + 3 minute &lt;&lt;&lt; &#039;DISPLAY=:0 feh --bg-scale /usr/share/backgrounds/gnome/adwaita-night.jpg&#039;
}

morning &amp;&amp; day &amp;&amp; night</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (dice)]]></author>
			<pubDate>Sun, 13 Dec 2020 12:45:19 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=26254#p26254</guid>
		</item>
		<item>
			<title><![CDATA[Re: at program]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=26242#p26242</link>
			<description><![CDATA[<div class="quotebox"><cite>fsmithred wrote:</cite><blockquote><div><p>I was referring to this part of the man page</p></div></blockquote></div><p>Yes, it does seem to be somewhat contradictory, not sure why <img src="http://dev1galaxy.org/img/smilies/hmm.png" width="15" height="15" alt="hmm" /></p><div class="quotebox"><cite>fsmithred wrote:</cite><blockquote><div><p>Isn&#039;t there a way to run the command from the command line?</p></div></blockquote></div><p>If you run it without <span class="bbc">-f</span> then it accepts input from STDIN:</p><div class="codebox"><pre><code>$ at now + 1 minute        
warning: commands will be executed using /bin/sh
at&gt; DISPLAY=:0 /usr/bin/x-terminal-emulator
at&gt; &lt;EOT&gt;
job 11 at Sat Dec 12 19:52:00 2020
$</code></pre></div><p>(<span class="bbc">&lt;ctrl&gt;</span>+<span class="bbc">d</span> exits the prompt.)</p><p>EDIT: or with a here string:</p><div class="codebox"><pre><code>$ at now + 1 minute &lt;&lt;&lt;&#039;DISPLAY=:0 /usr/bin/x-terminal-emulator&#039;
warning: commands will be executed using /bin/sh
job 13 at Sat Dec 12 19:58:00 2020
~$</code></pre></div><p>A here document also works.</p>]]></description>
			<author><![CDATA[dummy@example.com (Head_on_a_Stick)]]></author>
			<pubDate>Sat, 12 Dec 2020 19:53:58 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=26242#p26242</guid>
		</item>
		<item>
			<title><![CDATA[Re: at program]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=26240#p26240</link>
			<description><![CDATA[<p>HoaS: I was referring to this part of the man page:</p><div class="quotebox"><blockquote><div><p>At allows fairly complex time specifications, extending the POSIX.2 standard.&#160; It accepts times<br />&#160; &#160; &#160; &#160;of the form HH:MM to run a job at a specific time of day.</p></div></blockquote></div><p>Your example worked. I was not putting the command inside a file. Isn&#039;t there a way to run the command from the command line?<br />This works:</p><div class="codebox"><pre><code>at now + 1 minute -f testfile</code></pre></div><p>This does not work:</p><div class="codebox"><pre><code>at now + 1 minute echo &quot;hello&quot;</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (fsmithred)]]></author>
			<pubDate>Sat, 12 Dec 2020 18:34:01 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=26240#p26240</guid>
		</item>
		<item>
			<title><![CDATA[Re: at program]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=26238#p26238</link>
			<description><![CDATA[<div class="quotebox"><cite>Head_on_a_Stick wrote:</cite><blockquote><div><div class="quotebox"><cite>dice wrote:</cite><blockquote><div><p>but this below would not work as a line not broken.</p><div class="codebox"><pre><code>echo &#039;DISPLAY=:0 $HOME/bin/fehrand&#039; &gt; ~/test
at now + 1 minute -f ~/test</code></pre></div></div></blockquote></div><p>I don&#039;t think $HOME will be understood unless you specify it (replace <span class="bbc">$user</span> with the actual username):</p><div class="codebox"><pre><code>echo &#039;DISPLAY=:0 HOME=/home/$user $HOME/bin/fehrand&#039; &gt; ~/test
at now + 1 minute -f ~/test</code></pre></div><p>Or just call the full path to the script, which would be simpler.</p></div></blockquote></div><p>im just not using full paths publicly on the forum.</p>]]></description>
			<author><![CDATA[dummy@example.com (dice)]]></author>
			<pubDate>Sat, 12 Dec 2020 16:30:39 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=26238#p26238</guid>
		</item>
		<item>
			<title><![CDATA[Re: at program]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=26237#p26237</link>
			<description><![CDATA[<div class="quotebox"><cite>dice wrote:</cite><blockquote><div><p>but this below would not work as a line not broken.</p><div class="codebox"><pre><code>echo &#039;DISPLAY=:0 $HOME/bin/fehrand&#039; &gt; ~/test
at now + 1 minute -f ~/test</code></pre></div></div></blockquote></div><p>I don&#039;t think $HOME will be understood unless you specify it (replace <span class="bbc">$user</span> with the actual username):</p><div class="codebox"><pre><code>echo &#039;DISPLAY=:0 HOME=/home/$user $HOME/bin/fehrand&#039; &gt; ~/test
at now + 1 minute -f ~/test</code></pre></div><p>Or just call the full path to the script, which would be simpler.</p>]]></description>
			<author><![CDATA[dummy@example.com (Head_on_a_Stick)]]></author>
			<pubDate>Sat, 12 Dec 2020 16:25:35 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=26237#p26237</guid>
		</item>
		<item>
			<title><![CDATA[Re: at program]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=26236#p26236</link>
			<description><![CDATA[<p>Think i have it, thanks head on a stick. Need to adjust times and add into a startup script, but this is what im after...</p><div class="codebox"><pre><code>echo &#039;DISPLAY=:0 feh --bg-scale /usr/share/backgrounds/gnome/adwaita-morning.jpg&#039; &gt; ~/test
at now + 1 minute -f ~/test</code></pre></div><div class="codebox"><pre><code>echo &#039;DISPLAY=:0 feh --bg-scale /usr/share/backgrounds/gnome/adwaita-day.jpg&#039; &gt; ~/test
at now + 1 minute -f ~/test</code></pre></div><div class="codebox"><pre><code>echo &#039;DISPLAY=:0 feh --bg-scale /usr/share/backgrounds/gnome/adwaita-night.jpg&#039; &gt; ~/test
at now + 1 minute -f ~/test</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (dice)]]></author>
			<pubDate>Sat, 12 Dec 2020 16:25:02 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=26236#p26236</guid>
		</item>
		<item>
			<title><![CDATA[Re: at program]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=26235#p26235</link>
			<description><![CDATA[<p>Thanks head on a stick.</p><p>I cant understand how the command is laid out though. very strange if you ask me.</p><p>This below worked for a feh command.</p><div class="codebox"><pre><code>echo &#039;DISPLAY=:0 $HOME/bin/fehrand&#039; &gt; ~/test
at now + 1 minute -f ~/test</code></pre></div><p>but this below would not work as a line not broken.</p><div class="codebox"><pre><code>echo &#039;DISPLAY=:0 $HOME/bin/fehrand&#039; &gt; ~/test at now + 1 minute -f ~/test</code></pre></div><p>home env variable added to the code quotes.</p><p>contents of fehrand</p><div class="codebox"><pre><code>#!/bin/bash

feh --randomize --bg-scale /usr/share/backgrounds/*</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (dice)]]></author>
			<pubDate>Sat, 12 Dec 2020 16:09:31 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=26235#p26235</guid>
		</item>
		<item>
			<title><![CDATA[Re: at program]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=26233#p26233</link>
			<description><![CDATA[<div class="quotebox"><cite>dice wrote:</cite><blockquote><div><div class="codebox"><pre><code>~ $ &gt; at now + 1 minute -f /usr/local/bin/st</code></pre></div></div></blockquote></div><p>The <span class="bbc">-f</span> switch causes the command to be read from a <em>file</em>, which you have specified as <span class="bbc">/usr/local/bin/st</span>.</p><p>Try this instead:</p><div class="codebox"><pre><code>echo &#039;DISPLAY=:0 /usr/local/bin/st&#039; &gt; ~/test
at now + 1 minute -f ~/test</code></pre></div><p>^ That works for me. Note that any environmental variables are not passed to the command so they must be specified explicitly.</p><div class="quotebox"><cite>fsmithred wrote:</cite><blockquote><div><p>The man page states that HH:MM is the correct format for time, but apparently 09:21 or similar is not the correct time format. So I no longer know how to do HH:MM.</p></div></blockquote></div><p>Actually the man page says:</p><div class="quotebox"><cite>at(1) wrote:</cite><blockquote><div><p>-t time<br />&#160; &#160; run the job at time, given in the format [[CC]YY]MMDDhhmm[.ss]</p></div></blockquote></div><p>So try</p><div class="codebox"><pre><code>at -t 12121600 -f ~/test</code></pre></div><p>HTH</p><p>EDIT: that example runs the command on 2020-12-12 at 16:00.</p>]]></description>
			<author><![CDATA[dummy@example.com (Head_on_a_Stick)]]></author>
			<pubDate>Sat, 12 Dec 2020 15:41:16 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=26233#p26233</guid>
		</item>
	</channel>
</rss>
