public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] cronie setup questions
@ 2024-10-03 23:47 Walter Dnes
  2024-10-04  1:58 ` Dale
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Walter Dnes @ 2024-10-03 23:47 UTC (permalink / raw
  To: Gentoo Users List

  The Gentoo install suggested using "cronie".  I want to run a script
daily as local user.  The config I want is...

35 7 * * * waltdnes /home/waltdnes/pm/check4update/check4update

  I did some RTFM...

* There is no "man cronie" but there is a /etc/init.d/cronie
* There is a "man cron"
* There is a "crond" and an "anacron"
* There is "/etc/crontab" and "/etc/anacrontab"

  My head hurts.  Which config file do I enter the config into, and are
there any initialization steps?  Is there a simpler cron program, if
that would help?

-- 
There are 2 types of people
1) Those who can extrapolate from incomplete data


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-user] cronie setup questions
  2024-10-03 23:47 [gentoo-user] cronie setup questions Walter Dnes
@ 2024-10-04  1:58 ` Dale
  2024-10-04  4:58 ` Arve Barsnes
  2024-10-09 15:31 ` Walter Dnes
  2 siblings, 0 replies; 6+ messages in thread
From: Dale @ 2024-10-04  1:58 UTC (permalink / raw
  To: gentoo-user

Walter Dnes wrote:
>   The Gentoo install suggested using "cronie".  I want to run a script
> daily as local user.  The config I want is...
>
> 35 7 * * * waltdnes /home/waltdnes/pm/check4update/check4update
>
>   I did some RTFM...
>
> * There is no "man cronie" but there is a /etc/init.d/cronie
> * There is a "man cron"
> * There is a "crond" and an "anacron"
> * There is "/etc/crontab" and "/etc/anacrontab"
>
>   My head hurts.  Which config file do I enter the config into, and are
> there any initialization steps?  Is there a simpler cron program, if
> that would help?
>


I set up a cron job ages ago on my old machine.  Just so happens I made
a note of a hard to find but needed step.  Look for crontab command. 
According to my note, -e to add and -l to list.  You can use the command
run-parts /etc/cron.<directory only> to see if your file works.  Replace
directory only part with daily, weekly etc etc.  Tab completion comes in
handy. 

Yea, I sometimes take notes.  My little notes file is getting large now. 

That help?

Dale

:-)  :-) 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-user] cronie setup questions
  2024-10-03 23:47 [gentoo-user] cronie setup questions Walter Dnes
  2024-10-04  1:58 ` Dale
@ 2024-10-04  4:58 ` Arve Barsnes
  2024-10-09 15:31 ` Walter Dnes
  2 siblings, 0 replies; 6+ messages in thread
From: Arve Barsnes @ 2024-10-04  4:58 UTC (permalink / raw
  To: gentoo-user

On Fri, 4 Oct 2024 at 01:47, Walter Dnes <waltdnes@waltdnes.org> wrote:
>   My head hurts.  Which config file do I enter the config into, and are
> there any initialization steps?  Is there a simpler cron program, if
> that would help?

As Dale said,
'crontab -e'
to edit the current user's crontab is the easiest solution, which I
also use with cronie. There you can paste in your config line without
the user name.

You can also edit /etc/crontab if you want, in this file the syntax
includes a field to specify what user a command should run as, so here
you could paste in your config line as is.

Make sure to add the cronie service to a runlevel so it starts automatically:
'sudo rc-service add cronie default'

Regards,
Arve


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-user] cronie setup questions
  2024-10-03 23:47 [gentoo-user] cronie setup questions Walter Dnes
  2024-10-04  1:58 ` Dale
  2024-10-04  4:58 ` Arve Barsnes
@ 2024-10-09 15:31 ` Walter Dnes
  2024-10-09 16:43   ` Arve Barsnes
  2024-10-09 16:45   ` Michael
  2 siblings, 2 replies; 6+ messages in thread
From: Walter Dnes @ 2024-10-09 15:31 UTC (permalink / raw
  To: gentoo-user

On Thu, Oct 03, 2024 at 07:47:34PM -0400, Walter Dnes wrote
>   The Gentoo install suggested using "cronie".  I want to run a script
> daily as local user.  The config I want is...
> 
> 35 7 * * * waltdnes /home/waltdnes/pm/check4update/check4update

  My email shows that the job is launching, but tripping over
permissions.  Here's what it's supposed to do...

* Because I'm running a custom build of Pale Moon web browser, I can't
  use the built-in updater from the standard version
* I want to check the palemoon.org Atom feed for new releases
* A text file "previous.txt" has the date stamp of the most recent entry
* bash script "check4update"...
*** wget's the webpage
*** greps the "<published>" lines
*** the top line has the most recent posting
*** compare the the most recent <published> date with "previous.txt"
*** if the same, exit
*** if not the same...
*** 1) update "previous.txt" with the newest date
*** 2) use "geeqie" to display a garish messege about the update

  That last step is the problem.  I get the following error...

(geeqie:14531): Gtk-WARNING **: 07:35:01.797: cannot open display:

  What do I need to do to allow "geeqie" to open up in an X window as
user "waltdnes".

-- 
There are 2 types of people in this world
1) Those who can extrapolate from incomplete data


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-user] cronie setup questions
  2024-10-09 15:31 ` Walter Dnes
@ 2024-10-09 16:43   ` Arve Barsnes
  2024-10-09 16:45   ` Michael
  1 sibling, 0 replies; 6+ messages in thread
From: Arve Barsnes @ 2024-10-09 16:43 UTC (permalink / raw
  To: gentoo-user

On Wed, 9 Oct 2024 at 17:31, Walter Dnes <waltdnes@waltdnes.org> wrote:
>   What do I need to do to allow "geeqie" to open up in an X window as
> user "waltdnes".

Prepend the cron command with the display variable. Most likely this
would look like:
DISPLAY=:0.0 /home/waltdnes/pm/check4update/check4update

Regards,
Arve


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-user] cronie setup questions
  2024-10-09 15:31 ` Walter Dnes
  2024-10-09 16:43   ` Arve Barsnes
@ 2024-10-09 16:45   ` Michael
  1 sibling, 0 replies; 6+ messages in thread
From: Michael @ 2024-10-09 16:45 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1790 bytes --]

On Wednesday 9 October 2024 16:31:16 BST Walter Dnes wrote:
> On Thu, Oct 03, 2024 at 07:47:34PM -0400, Walter Dnes wrote
> 
> >   The Gentoo install suggested using "cronie".  I want to run a script
> > 
> > daily as local user.  The config I want is...
> > 
> > 35 7 * * * waltdnes /home/waltdnes/pm/check4update/check4update
> 
>   My email shows that the job is launching, but tripping over
> permissions.  Here's what it's supposed to do...
> 
> * Because I'm running a custom build of Pale Moon web browser, I can't
>   use the built-in updater from the standard version
> * I want to check the palemoon.org Atom feed for new releases
> * A text file "previous.txt" has the date stamp of the most recent entry
> * bash script "check4update"...
> *** wget's the webpage
> *** greps the "<published>" lines
> *** the top line has the most recent posting
> *** compare the the most recent <published> date with "previous.txt"
> *** if the same, exit
> *** if not the same...
> *** 1) update "previous.txt" with the newest date
> *** 2) use "geeqie" to display a garish messege about the update
> 
>   That last step is the problem.  I get the following error...
> 
> (geeqie:14531): Gtk-WARNING **: 07:35:01.797: cannot open display:
> 
>   What do I need to do to allow "geeqie" to open up in an X window as
> user "waltdnes".

You could let it know which display to use in your script, something like:

export DISPLAY=:0

However, it gets more complicated if a user is not logged in whenever the 
script happens to run and if the display is on :1 or some other value.  You 
would probably need to fish for $DISPLAY using awk or something similar and 
feed this into your script before your '/usr/bin/geeqie %u'.  Someone more 
knowledgable on scripting languages will hopefully advise.

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-10-09 16:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-03 23:47 [gentoo-user] cronie setup questions Walter Dnes
2024-10-04  1:58 ` Dale
2024-10-04  4:58 ` Arve Barsnes
2024-10-09 15:31 ` Walter Dnes
2024-10-09 16:43   ` Arve Barsnes
2024-10-09 16:45   ` Michael

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox