utilisation variable $LOG_FILE

This commit is contained in:
Michel Le Cocq 2025-03-09 16:10:49 +01:00
parent a100a4d3ce
commit 6f2fa5ab86

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# Time-stamp: <2025-03-09 10:34:38 nomad> # Time-stamp: <2025-03-09 16:10:47 nomad>
# Michel Le Cocq <lecocq@ipgp.fr> # Michel Le Cocq <lecocq@ipgp.fr>
# <nomad@neuronfarm.net> # <nomad@neuronfarm.net>
@ -19,7 +19,11 @@
# check zfs boot menu release # check zfs boot menu release
# check zfs pool status # check zfs pool status
# Depend : # tunable variable
LOG_FILE=~/upsnapz.log
# Dependencies :
# - gh # - gh
# - full sudo permission # - full sudo permission
@ -34,6 +38,7 @@
# #
# +------------------------------------------------------------------------------------------------+ # +------------------------------------------------------------------------------------------------+
function showsnap function showsnap
{ {
zfs list -o name,used,usedbysnapshots -r zroot/ROOT -s creation | grep -v '^zroot/ROOT .*' > /tmp/upsnap.tmp zfs list -o name,used,usedbysnapshots -r zroot/ROOT -s creation | grep -v '^zroot/ROOT .*' > /tmp/upsnap.tmp
@ -261,8 +266,8 @@ function asksnap()
then then
snapname=$(date +%Y-%m-%d-%H%M%S) snapname=$(date +%Y-%m-%d-%H%M%S)
sudo zfs snapshot $bootfs@$snapname sudo zfs snapshot $bootfs@$snapname
date +%Y_%m_%d-%H:%M > ./upsnapz.log date +%Y_%m_%d-%H:%M > $LOG_FILE
zfs list -H -o name $bootfs@$snapname | tee -a ./upsnapz.log zfs list -H -o name $bootfs@$snapname | tee -a $LOG_FILE
askpromote $snapname $bootfs askpromote $snapname $bootfs
else else
echo no echo no
@ -316,7 +321,7 @@ function askupgrade()
printf '%s\n' 'apt -y upgrade' printf '%s\n' 'apt -y upgrade'
sudo apt -y upgrade | tee -a /tmp/upsnapz-upgradable sudo apt -y upgrade | tee -a /tmp/upsnapz-upgradable
fi fi
cat /tmp/upsnapz-upgradable >> ./upsnapz.log cat /tmp/upsnapz-upgradable >> $LOG_FILE
else else
echo no echo no
fi fi