Compare commits
2 commits
80a7334f59
...
c2f56a9d3f
Author | SHA1 | Date | |
---|---|---|---|
c2f56a9d3f | |||
3bb298526b |
7 changed files with 59 additions and 4 deletions
|
@ -19,7 +19,7 @@ then
|
||||||
if [ "$ASCIINEMA_LOG" = "video" ]
|
if [ "$ASCIINEMA_LOG" = "video" ]
|
||||||
then
|
then
|
||||||
export ASCIINEMA_LOG_FILE="$ASCIINEMA_LOG_DIR/asciinema-$_file_name_date.cast"
|
export ASCIINEMA_LOG_FILE="$ASCIINEMA_LOG_DIR/asciinema-$_file_name_date.cast"
|
||||||
asciinema rec --quiet --idle-time-limit=3 "$ASCIINEMA_LOG_FILE"
|
asciinema rec --quiet --idle-time-limit=3 -t "Terminal log on $_file_name_date" "$ASCIINEMA_LOG_FILE"
|
||||||
exit 0 # Parent script should exit
|
exit 0 # Parent script should exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
30
.bin/host-backup
Executable file
30
.bin/host-backup
Executable file
|
@ -0,0 +1,30 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
_hostname="$(cat /proc/sys/kernel/hostname)"
|
||||||
|
_host_backup_file="host-backup-$_hostname"
|
||||||
|
if [ -x "$( which "$_host_backup_file")" ]
|
||||||
|
then
|
||||||
|
# shellcheck disable=SC1090
|
||||||
|
. "$_host_backup_file"
|
||||||
|
else
|
||||||
|
echo "No host-backup file found: $_host_backup_file"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$1" ]
|
||||||
|
then
|
||||||
|
host_backup_run
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
"_forget")
|
||||||
|
host-backup forget --prune --keep-last 7 --keep-daily 14 --keep-weekly 8 --keep-monthly 8 --keep-yearly 2
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
restic "$@"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
|
@ -1,8 +1,24 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
action=$(printf "shutdown\nreboot\nlogout\nautostart" | $DMENU)
|
actions="backup-shutwdown
|
||||||
|
shutdown
|
||||||
|
reboot
|
||||||
|
logout
|
||||||
|
autostart"
|
||||||
|
action=$(echo "$actions" | $DMENU)
|
||||||
|
|
||||||
|
_menu_shutdown_backup() {
|
||||||
|
alacritty -e "host-backup"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -z "$action" ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
notify-send "$(user-cleaner)"
|
||||||
|
|
||||||
case "$action" in
|
case "$action" in
|
||||||
|
backup-shutwdown) _menu_shutdown_backup && systemctl poweroff -i ;;
|
||||||
shutdown) systemctl poweroff -i ;;
|
shutdown) systemctl poweroff -i ;;
|
||||||
reboot) systemctl reboot ;;
|
reboot) systemctl reboot ;;
|
||||||
logout) systemctl --user exit ;;
|
logout) systemctl --user exit ;;
|
||||||
|
|
|
@ -1,6 +1,12 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
echo "Running user-cleaner..."
|
||||||
|
|
||||||
# clean old logs
|
# clean old logs
|
||||||
log_dir="$HOME/.cache/logs"
|
log_dir="$HOME/.cache/logs"
|
||||||
[ -d "$log_dir" ] \
|
if [ -d "$log_dir" ]
|
||||||
&& find "$log_dir" -type f -mtime +7 -delete
|
then
|
||||||
|
echo "Cleaning old logs..."
|
||||||
|
find "$log_dir" -type f -mtime +7 -delete
|
||||||
|
find "$log_dir" -type f -mtime +1 -size -25k -delete
|
||||||
|
fi
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
|
.bin/host-backup-portalo
|
||||||
.config/env.d/99-secrets
|
.config/env.d/99-secrets
|
||||||
.ssh/config
|
.ssh/config
|
||||||
|
|
|
@ -124,3 +124,5 @@ source source-remote-file \
|
||||||
[ -x "$(command -v starship)" ] && eval "$(starship init zsh)"
|
[ -x "$(command -v starship)" ] && eval "$(starship init zsh)"
|
||||||
|
|
||||||
asciinema-log && exit
|
asciinema-log && exit
|
||||||
|
|
||||||
|
true # Don't start with 1 as exit code
|
||||||
|
|
Binary file not shown.
Loading…
Reference in a new issue