Implement sytemctl actions

This commit is contained in:
Ray Miller 2025-06-23 10:09:14 +01:00
parent ce4de34d5a
commit bcf0b56911
Signed by: ray
GPG key ID: 043F786C4CD681B8

40
ordo/action/systemcl.scm Normal file
View file

@ -0,0 +1,40 @@
#|
This file is part of Ordo.
Copyright (C) 2025 Ray Miller
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, version 3.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program. If not, see <https://www.gnu.org/licenses/>.
|#
(define-module (ordo action systemctl)
#:use-module (ordo connection)
#:export (daemon-reload stop start restart reload))
(define (daemon-reload conn #:key user?)
(remote-cmd conn "systemctl" (when user? "--user") "daemon-reload" #:check? #t)
#t)
(define (stop conn #:key unit user?)
(remote-cmd conn "systemctl" (when user? "--user") "stop" unit #:check? #t)
#t)
(define (start conn #:key unit user?)
(remote-cmd conn "systemctl" (when user? "--user") "start" unit #:check? #t)
#t)
(define (reload conn #:key unit user?)
(remote-cmd conn "systemctl" (when user? "--user") "reload" unit #:check? #t)
#t)
(define (restart conn #:key unit user?)
(remote-cmd conn "systemctl" (when user? "--user") "restart" unit #:check? #t)
#t)