diff options
author | dale_mellor <dale_mellor> | 2003-07-20 15:52:35 +0000 |
---|---|---|
committer | dale_mellor <dale_mellor> | 2003-07-20 15:52:35 +0000 |
commit | 2c6cfc753d5c4a6116bcf24307371c33f49bcfd1 (patch) | |
tree | 6d186a00c887d2061ac0d430bdf4b76bb41af83b /crontab.scm | |
parent | 3a55e7e4684d33241d3e3162f3405d6d7cf37723 (diff) | |
download | mcron-2c6cfc753d5c4a6116bcf24307371c33f49bcfd1.tar.gz mcron-2c6cfc753d5c4a6116bcf24307371c33f49bcfd1.tar.bz2 mcron-2c6cfc753d5c4a6116bcf24307371c33f49bcfd1.zip |
All changes from 0.99.1 to 0.99.2 pre-release.0.99.2
Diffstat (limited to 'crontab.scm')
-rw-r--r-- | crontab.scm | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/crontab.scm b/crontab.scm index f7bcf2a..2c5152d 100644 --- a/crontab.scm +++ b/crontab.scm @@ -30,15 +30,10 @@ (define (hit-server user-name) (catch #t (lambda () - (let ((server-pid (with-input-from-file "/var/run/cron.pid" - (lambda () (string->number (read-line)))))) - (catch #t (lambda () - (with-output-to-file "/var/cron/update" (lambda () - (display user-name)(newline)))) - (lambda (key . args) - (display "Cannot write to /var/cron/update.\n") - (primitive-exit 14))) - (kill server-pid SIGHUP))) + (let* ((socket (socket AF_UNIX SOCK_STREAM 0))) + (connect socket AF_UNIX "/var/cron/socket") + (display user-name socket) + (close socket))) (lambda (key . args) (display "Warning: a cron daemon is not running.\n")))) @@ -145,14 +140,13 @@ ;; crontab, wake the cron daemon up, and remove the temporary file. ((option-ref options 'edit #f) - (let ((temp-file (string-append "/tmp/crontab." (number->string (getpid)))) - (editor (cond ((getenv "VISUAL") (getenv "VISUAL")) - ((getenv "EDITOR") (getenv "EDITOR")) - (else "vi")))) + (let ((temp-file (string-append "/tmp/crontab." (number->string (getpid))))) (catch #t (lambda () (copy-file crontab-file temp-file)) (lambda (key . args) (with-output-to-file temp-file noop))) (chown temp-file (getuid) (getgid)) - (system (string-append editor " " temp-file)) + (system (string-append (or (getenv "VISUAL") (getenv "EDITOR") "vi") + " " + temp-file)) (read-vixie-file temp-file) (copy-file temp-file crontab-file) (delete-file temp-file) |