all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* mcron
@ 2018-08-04  5:33 Benjamin Slade
  2018-08-04  8:44 ` mcron Pierre Neidhardt
  0 siblings, 1 reply; 6+ messages in thread
From: Benjamin Slade @ 2018-08-04  5:33 UTC (permalink / raw)
  To: help-guix

nnI'm having trouble getting mcron to work. I have configured it in
/etc/config.scm similarly to the example given in the manual, but it the
mcron service seems to immediately stop. I've tried `sudo herd enable
mcron` and `sudo herd start mcron`, which work, but then when I check
its status, I find mcron is disabled and not running.

My /etc/config.scm looks like this:

`````
;; This is an operating system configuration template
;; for a "desktop" setup with GNOME and Xfce where the
;; root partition is encrypted with LUKS.

(use-modules (gnu) (gnu services ssh) (gnu services mcron) (gnu system nss) (gnu packages lisp) (gnu packages wm) (gnu packages linux)
	(gnu packages guile) (gnu packages backup))
(use-service-modules desktop networking)
(use-package-modules certs gnome wm base idutils xorg)

(define updatedb-job
  ;; Run 'updatedb' at 3AM every day.  Here we write the
  ;; job's action as a Scheme procedure.
  #~(job '(next-hour '(3))
         (lambda ()
           (execl (string-append #$findutils "/bin/updatedb")
                  "updatedb"
                  "--prunepaths=/tmp /var/tmp /gnu/store"))))

(define garbage-collector-job
  ;; Collect garbage 5 minutes after midnight every day.
  ;; The job's action is a shell command.
  #~(job "5 0 * * *"            ;Vixie cron syntax
         "guix gc -F 1G"))

(define idutils-job
  ;; Update the index database as user "charlie" at 12:15PM
  ;; and 19:15PM.  This runs from the user's home directory.
  #~(job '(next-minute-from (next-hour '(12 19)) '(15))
         (string-append #$idutils "/bin/mkid src")
         #:user "emacsomancer"))

(define mbsync-mail-fetch-emacsomancer
  ;; fetch mail via isync/mbsync for mu/mu4e every 10 minutes
  #~(job "5/* * * * *"          ;Vixie cron syntax
	 "/home/emacsomancer/.guix-profile/bin/mbsync -a"
	 #:user "emacsomancer"))

(define test-emacsomancer
  ;; fetch mail via isync/mbsync for mu/mu4e every 10 minutes
  #~(job "1/* * * * *"          ;Vixie cron syntax
	 "/home/emacsomancer/.guix-profile/bin/touch /home/emacsomancer/hello"
	 #:user "emacsomancer"))


(operating-system
  (host-name "guixy")
  (timezone "US/Mountain")
  (locale "en_GB.utf8")

  ;; Use the UEFI variant of GRUB with the EFI System
  ;; Partition mounted on /boot/efi.
  ;; -> actually using BIOS because guixsd 0.15 live usb didn't probe efi 
;  (bootloader (grub-configuration (device "/dev/sda")))
  (bootloader (bootloader-configuration
                (bootloader grub-bootloader)
                (target "/dev/sda")))

  ;; Specify a mapped device for the encrypted root partition.
  ;; The UUID is that returned by 'cryptsetup luksUUID'.
  (mapped-devices
   (list (mapped-device
          (source (uuid "e33cc543-9aa9-467a-a9e8-96e1f092b866"))
          (target "guiksdelux")
          (type luks-device-mapping))
	 ;; (mapped-device
         ;;  (source (uuid "7c97b263-4adc-b4e9-a1d7-9d3de8eb9694"))
         ;;  (target "guix-home")
         ;;  (type luks-device-mapping))
	  ))

  (file-systems (cons* (file-system
		       (device (uuid "18c93271-4fcd-484b-ac1a-f4670b6d2b7c" 'ext4))
		       (mount-point "/")
		       (type "ext4"))
		      (file-system
                        (device "/dev/mapper/guiksdelux")
                        (mount-point "/home")
                        (type "ext4")
                        (dependencies mapped-devices))
;		      (file-system
;                        (device "/dev/mapper/guix-home")
;                        (mount-point "/home")
;                        (type "ext4")
;                        (dependencies mapped-devices))
;                      (file-system
;                         (device (uuid "35ee1733-b91f-4bbc-3bdc-86b5bd25489f" 'ext2))
;                         (mount-point "/boot")
;                         (type "ext2"))
;                       (file-system
;                         (device (uuid "F1D1-FC28" 'fat))
;                         (mount-point "/boot/efi")
;                         (type "vfat"))
                       %base-file-systems))

  (users (cons (user-account
                (name "emacsomancer")
;                (comment "")
                (group "users")
                (supplementary-groups '("wheel" "netdev"
                                        "audio" "video"))
                (home-directory "/home/emacsomancer"))
               %base-user-accounts))

  ;; Add GNOME and/or Xfce---we can choose at the log-in
  ;; screen with F1.  Use the "desktop" services, which
  ;; include the X11 log-in service, networking with
  ;; NetworkManager, and more.
  (packages (cons* sbcl-stumpwm  ;common lisp window manager
		   ; awesome     ;lua window manager
		   nss-certs          ;for HTTPS access
                   gvfs              ;for user mounts
		   xset             ; no beeps &c.
		   tlp                ; NEED TO SET UP
		   acpi                  ; battery (still not accessible?)
		   thinkfan             ; controlling ThinkPad fans
		   borg			; python-based backup
;		   libchop            ; guile-based backup (chop-backup)   ---- NOT WORKING
		   network-manager         ; probably change to something else
		   network-manager-applet  ; probably change to something else
;		   mcron           ; guile-based cron
                   %base-packages))


  ;; Use the "desktop" services, which include the X11
  ;; log-in service, networking with NetworkManager, and more.
  (services (cons* (mcron-service (list garbage-collector-job
                                       updatedb-job
                                       idutils-job
				       mbsync-mail-fetch-emacsomancer
;				       test-emacsomancer
				       ))
	           (service openssh-service-type)
		   %desktop-services))
  
  ;; Allow resolution of '.local' host names with mDNS.
  (name-service-switch %mdns-host-lookup-nss))
````

I'm not sure why I can't get mcron to start.

-- 
Benjamin Slade - https://babbagefiles.xyz
  `(pgp_fp: ,(21BA 2AE1 28F6 DF36 110A 0E9C A320 BBE8 2B52 EE19))
    '(sent by mu4e on Emacs running under GNU/Linux . https://gnu.org )
       `(Choose Linux ,(Choose Freedom) . https://linux.com )

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

* Re: mcron
  2018-08-04  5:33 mcron Benjamin Slade
@ 2018-08-04  8:44 ` Pierre Neidhardt
  2018-08-04 21:16   ` mcron Benjamin Slade
  0 siblings, 1 reply; 6+ messages in thread
From: Pierre Neidhardt @ 2018-08-04  8:44 UTC (permalink / raw)
  To: Benjamin Slade; +Cc: help-guix

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

Not sure I can help much here because I personally run help cron from my user
session, i.e. with "mcron &" in my ".profile".  I declare the jobs in
"~/.config/cron/job.guile".

Maybe you could try that for the user-level jobs and see if it works in that condition?

-- 
Pierre Neidhardt

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

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

* Re: mcron
  2018-08-04  8:44 ` mcron Pierre Neidhardt
@ 2018-08-04 21:16   ` Benjamin Slade
  2018-08-04 22:02     ` mcron Pierre Neidhardt
  0 siblings, 1 reply; 6+ messages in thread
From: Benjamin Slade @ 2018-08-04 21:16 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: help-guix

On 2018-08-04T02:44:24-0600, Pierre Neidhardt <ambrevar@gmail.com> wrote:

 > Not sure I can help much here because I personally run help cron from my user
 > session, i.e. with "mcron &" in my ".profile".  I declare the jobs in
 > "~/.config/cron/job.guile".

 > Maybe you could try that for the user-level jobs and see if it works in that condition?

Thanks, Pierre. What is the procedure for declaring jobs in
`~/.config/cron/job.guile` ? For the `/etc/config.scm` method, as far as
I understand it, the jobs need defining and then enabling/calling. Does
it work for the same for the user session cron in `~/.config/cron/job.guile` ?

thanks,
  ---Ben
-- 
Benjamin Slade - https://babbagefiles.xyz
  `(pgp_fp: ,(21BA 2AE1 28F6 DF36 110A 0E9C A320 BBE8 2B52 EE19))
    '(sent by mu4e on Emacs running under GNU/Linux . https://gnu.org )
       `(Choose Linux ,(Choose Freedom) . https://linux.com )

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

* Re: mcron
  2018-08-04 21:16   ` mcron Benjamin Slade
@ 2018-08-04 22:02     ` Pierre Neidhardt
  2018-08-05  0:42       ` mcron Benjamin Slade
  0 siblings, 1 reply; 6+ messages in thread
From: Pierre Neidhardt @ 2018-08-04 22:02 UTC (permalink / raw)
  To: Benjamin Slade; +Cc: help-guix

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

No, mcron at the user-level is even simpler, simply tweak your configuration
file and start `mcron`.

Example job in ~/.config/cron/job.guile:
--8<---------------cut here---------------start------------->8---
(job '(next-hour (range 0 24 3)) "updatedb")
--8<---------------cut here---------------end--------------->8---

Once mcron is running, you can test the schedule by calling `mcron --schedule=5`
to list the 5 next scheduled jobs.

Have a look at "(mcron) Top", it's a very short read ;)

-- 
Pierre Neidhardt

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

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

* Re: mcron
  2018-08-04 22:02     ` mcron Pierre Neidhardt
@ 2018-08-05  0:42       ` Benjamin Slade
  2018-08-05  8:45         ` mcron Pierre Neidhardt
  0 siblings, 1 reply; 6+ messages in thread
From: Benjamin Slade @ 2018-08-05  0:42 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: help-guix

Many thanks, Pierre.

Can one also mix Vixie-style things in `~/.config/cron/` ?

It probably doesn't matter since I think I've figured out mcron native
syntax.  I was looking everywhere in "(mcron) Top" for an example of "do
X every N minutes", but finally figured out that this works (at least I
hope so):

--8<---------------cut here---------------start------------->8---
(job '(next-minute (range 0 60 5)) "dosomethingevery5minutes")
(job '(next-minute (range 0 60 10)) "dosomethingevery10minutes")
--8<---------------cut here---------------start------------->8---

--
Benjamin Slade - https://babbagefiles.xyz
  `(pgp_fp: ,(21BA 2AE1 28F6 DF36 110A 0E9C A320 BBE8 2B52 EE19))
    '(sent by mu4e on Emacs running under GNU/Linux . https://gnu.org )
       `(Choose Linux ,(Choose Freedom) . https://linux.com )

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

* Re: mcron
  2018-08-05  0:42       ` mcron Benjamin Slade
@ 2018-08-05  8:45         ` Pierre Neidhardt
  0 siblings, 0 replies; 6+ messages in thread
From: Pierre Neidhardt @ 2018-08-05  8:45 UTC (permalink / raw)
  To: Benjamin Slade; +Cc: help-guix

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

Yes, Vixie syntax is supported there too!
See "(mcron) Vixie Syntax".

But if you can grasp the Lisp syntax instead, I'd recommend you for it, it's
much more flexible.  After all, it's the sole raison-d'être of mcron with regard
to cron :)

I think your solution to "every N minute" is correct.

Cheers!
-- 
Pierre Neidhardt

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

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

end of thread, other threads:[~2018-08-05  8:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-04  5:33 mcron Benjamin Slade
2018-08-04  8:44 ` mcron Pierre Neidhardt
2018-08-04 21:16   ` mcron Benjamin Slade
2018-08-04 22:02     ` mcron Pierre Neidhardt
2018-08-05  0:42       ` mcron Benjamin Slade
2018-08-05  8:45         ` mcron Pierre Neidhardt

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.