From 3488cadd2c7bc3fcde1bc7bb8c0143582e003d50 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Sat, 26 Nov 2022 15:10:26 +0100 Subject: [PATCH] package both systemd timers try to new plc-dump-db and previously available, but not packaged, renew-reminder --- bashrc | 50 ------------------------------------- myplc.spec | 6 ++--- systemd/plc-dump-db.service | 6 +++++ systemd/plc-dump-db.timer | 9 +++++++ 4 files changed, 18 insertions(+), 53 deletions(-) delete mode 100644 bashrc create mode 100644 systemd/plc-dump-db.service create mode 100644 systemd/plc-dump-db.timer diff --git a/bashrc b/bashrc deleted file mode 100644 index 3683fe4..0000000 --- a/bashrc +++ /dev/null @@ -1,50 +0,0 @@ -# -*-sh-*- -# this file defines a few convenience bash shorthands for managing myplc nodes -# it is installed in /usr/share/myplc/aliases -# you might wish to use it in your own bash startup files (.profile/.bashrc) - -ssh_options="-o BatchMode=yes -o StrictHostKeyChecking=no" - -function node_key () { - key="$1"; shift - hostname="$1"; shift - echo Running "$@" on root@"$hostname" - ssh $ssh_options -i "$key" "root@$hostname" "$@" -} - -function nodes_key () { - key="$1"; shift - filename="$1"; shift - for hostname in $(grep -v '#' $filename); do - node_boot "$hostname" "$key" "$@" - done -} - -function node_dbg () { - [[ -z "$@" ]] && { echo "Usage: $0 hostname [command]" ; return 1; } - node_key /etc/planetlab/debug_ssh_key.rsa "$@" -} -function nodes_dbg () { - [[ -z "$@" ]] && { echo "Usage: $0 hosts_file [command]" ; return 1; } - node_keys /etc/planetlab/debug_ssh_key.rsa "$@" -} -function clear_known_hosts () { - for hostname in "$@"; do - sed -i "/$hostname/d" ~/.ssh/known_hosts - done -} - -# convenience -alias mtail=mtail.py - -# navigators - alphabetical -alias gobmsource="cd /usr/share/bootmanager" -alias goboot="cd /var/www/html/boot" -alias godrupal="cd /var/www/html/planetlab" -alias gohttplog="cd /var/log/httpd" -alias goinit="cd /etc/plc.d" -alias golog="cd /var/log/" -alias goplcapi="cd /usr/share/plc_api" -alias gosqllog="cd /var/lib/pgsql/data/pg_log" -alias goyum="cd /var/www/html/install-rpms" - diff --git a/myplc.spec b/myplc.spec index ec6fcb9..aa03ab1 100644 --- a/myplc.spec +++ b/myplc.spec @@ -178,8 +178,8 @@ sed -e "s,@PLDISTRO@,%{pldistro},g" -e "s,@FCDISTRO@,%{distroname},g" -e "s,@ARC default_config.xml > ${RPM_BUILD_ROOT}/etc/planetlab/default_config.xml chmod 444 ${RPM_BUILD_ROOT}/etc/planetlab/default_config.xml -echo "* Installing bashrc convenience" -install -D -m 644 bashrc ${RPM_BUILD_ROOT}/usr/share/myplc/bashrc +echo "* Installing systemd utilities" +install -D -m 644 systemd/*.service systemd/*.timer ${RPM_BUILD_ROOT}/usr/lib/systemd/system/ # yumgroups.xml and yum repo : let noderepo handle that @@ -252,7 +252,7 @@ fi %files -/usr/share/myplc/bashrc +/usr/lib/systemd/system %files core %defattr(-,root,root,-) diff --git a/systemd/plc-dump-db.service b/systemd/plc-dump-db.service new file mode 100644 index 0000000..eaefa4e --- /dev/null +++ b/systemd/plc-dump-db.service @@ -0,0 +1,6 @@ +[Unit] +Description=designed to be run on a daily basis, this creates a dump of the planetlab5 and drupal databases, and cleans old ones + +# keep backups during two months +[Service] +ExecStart=/usr/bin/bash /etc/plc.d/db dump-and-clean 60 diff --git a/systemd/plc-dump-db.timer b/systemd/plc-dump-db.timer new file mode 100644 index 0000000..3a87d82 --- /dev/null +++ b/systemd/plc-dump-db.timer @@ -0,0 +1,9 @@ +[Unit] +Description=Runs plc-dump-db on a daily basis + +[Timer] +OnCalendar=*-*-* 03:30 +Unit=plc-dump-db.service + +[Install] +WantedBy=multi-user.target -- 2.43.0