aboutsummaryrefslogtreecommitdiff
path: root/src/property
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-12-07 12:57:08 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-12-07 12:57:08 -0700
commit7dc6f842809416134ef2131b394b559d9a41b4d2 (patch)
tree47f0c6a3ef3b7bd462eef7ce1384c2e74fb30629 /src/property
parent32f790acbae4417070d67a53cfe3518447bc32e4 (diff)
downloadconsfigurator-7dc6f842809416134ef2131b394b559d9a41b4d2.tar.gz
CRON:SYSTEM-JOB: make unapplicable & use FILE:EXISTS-WITH-CONTENT
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/property')
-rw-r--r--src/property/cron.lisp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/property/cron.lisp b/src/property/cron.lisp
index b045d76..011a7b6 100644
--- a/src/property/cron.lisp
+++ b/src/property/cron.lisp
@@ -42,10 +42,10 @@ The output of the cronjob will be mailed only if the job exits nonzero."
(script (merge-pathnames (strcat (string->filename desc) "_cronjob")
#P"/usr/local/bin/"))
(script* (escape-sh-token (unix-namestring script))))
- `(eseqprops
+ `(with-unapply
(apt:service-installed-running "cron")
(apt:installed "moreutils")
- (file:has-content ,job
+ (file:exists-with-content ,job
,`(,@(and (not times) '("#!/bin/sh" "" "set -e" ""))
"SHELL=/bin/sh"
"PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
@@ -59,7 +59,7 @@ The output of the cronjob will be mailed only if the job exits nonzero."
,@(and (not times) '(:mode #o755)))
;; Using a separate script makes for more readable e-mail subject lines,
;; and also makes it easy to do a manual run of the job.
- (file:has-content ,script
+ (file:exists-with-content ,script
,`("#!/bin/sh"
""
"set -e"
@@ -69,7 +69,8 @@ The output of the cronjob will be mailed only if the job exits nonzero."
,(format nil "flock -n ~A sh -c ~A"
(escape-sh-token (unix-namestring job))
(escape-sh-token shell-command)))
- :mode #o755))))
+ :mode #o755)
+ :unapply (file:does-not-exist ,job ,script))))
(defproplist nice-system-job :posix (desc when user shell-command)
"Like CRON:SYSTEM-JOB, but run the command niced and ioniced."