just gonna use -delete

This commit is contained in:
Ryan 2025-02-24 21:55:13 -05:00
parent 51bdc7674c
commit bd9bdb7ba6
Signed by: ryan77627
GPG key ID: 81B0E222A3E2308E

View file

@ -38,22 +38,22 @@
(define downloads-garbage-collector-service
(match-record-lambda <downloads-garbage-collector-configuration>
(user)
(let ((cleanup-command #~(list "find" (string-append "/home/" #$user "/Downloads") "-mtime" "+7" "-exec" "rm" "-rf" "'{}'" ";")))
(let ((cleanup-command #~(list "find" (string-append "/home/" #$user "/Downloads") "-mtime" "+7" "-delete")))
(shepherd-service
(documentation "Garbage collect downloaded files more than 1 week old for USER.")
(provision '(downloads-garbage-collector))
;(requirement '(root))
(modules '((shepherd service timer)))
(start #~(make-timer-constructor
(calendar-event #:hours '(19) #:minutes '(50)
#:days-of-week '(monday))
(calendar-event #:hours '(08) #:minutes '(30)
#:days-of-week '(tuesday))
(command #$cleanup-command)))
(stop #~(make-timer-destructor))
(actions (list (shepherd-action
(name 'trigger)
(documentation "Trigger GC in Downloads folder for USER")
(procedure #~(lambda _
(system (string-join #$cleanup-command " ")))))))))))
(apply system* #$cleanup-command))))))))))
(define-public downloads-garbage-collector-service-type
(service-type