07-06-2021, 08:43 AM
The userscripts can do anything you want from the command line.
Here's mine that just provides a way to run my backup script from the userscripts menu.
/home/user/.config/sxmo/userscripts/backup:
My backup script calls rsync to copy /home/user to my linux PC over ssh. It also saves a list of installed packages.
/home/user/ph_backup/backup:
Here is backup.exclude:
Here's mine that just provides a way to run my backup script from the userscripts menu.
/home/user/.config/sxmo/userscripts/backup:
Code:
#!/usr/bin/env sh
exec /home/user/ph_backup/backup
My backup script calls rsync to copy /home/user to my linux PC over ssh. It also saves a list of installed packages.
/home/user/ph_backup/backup:
Code:
#!/usr/bin/env sh
set -e
SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
EXCLUDE_FILE="$SCRIPT_DIR/backup.exclude"
BACKUP_DIR=/home/user
STATE_DIR=/home/user/backup_state
DEST=myuser@myhost.domain.com:/home/myuser/backup/ph/data
mkdir -p $STATE_DIR
rm -f $STATE_DIR/*.prev
if [ -f "$STATE_DIR/start_time" ]; then
mv -f $STATE_DIR/start_time $STATE_DIR/start_time.prev
fi
if [ -f "$STATE_DIR/finish_time" ]; then
mv -f $STATE_DIR/finish_time $STATE_DIR/finish_time.prev
fi
date --iso-8601=seconds >$STATE_DIR/start_time
nice time rsync -av --stats --log-format="%o %b %f %l" -H --delete --delete-excluded --exclude="$STATE_DIR/**" --exclude-from=$EXCLUDE_FILE $BACKUP_DIR $DEST >$STATE_DIR/backup.log 2>&1
apk list >$STATE_DIR/packages.txt
date --iso-8601=seconds >$STATE_DIR/finish_time
nice time rsync -av --stats --log-format="%o %b %f %l" -H --delete --delete-excluded --exclude=$STATE_DIR/backup_state.log $STATE_DIR $DEST >$STATE_DIR/backup_state.log 2>&1
Here is backup.exclude:
Code:
.cache/**
.surf/cache/**