Drop recursive media chown and migration backup script
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
50ec04534e
commit
554eec97b0
3 changed files with 1 additions and 49 deletions
|
|
@ -1,41 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
BACKUP_DIR="/mnt/disk4/server-backup-$(date +%Y%m%d)"
|
|
||||||
echo "Backing up to: $BACKUP_DIR"
|
|
||||||
mkdir -p "$BACKUP_DIR"
|
|
||||||
|
|
||||||
# Stop services first to get clean copies
|
|
||||||
echo "Stopping services..."
|
|
||||||
sudo systemctl stop jellyfin sonarr radarr prowlarr bazarr qbittorrent-nox authelia-main 2>/dev/null || true
|
|
||||||
sleep 3
|
|
||||||
|
|
||||||
# Service databases and config
|
|
||||||
for dir in jellyfin sonarr radarr prowlarr bazarr qbittorrent authelia-main; do
|
|
||||||
if [ -d "/var/lib/$dir" ]; then
|
|
||||||
echo "Backing up /var/lib/$dir ..."
|
|
||||||
sudo mkdir -p "$BACKUP_DIR/var-lib/$dir"
|
|
||||||
sudo rsync -a "/var/lib/$dir/" "$BACKUP_DIR/var-lib/$dir/"
|
|
||||||
else
|
|
||||||
echo "Skipping /var/lib/$dir (not found)"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# Secrets
|
|
||||||
if [ -d "/var/secrets" ]; then
|
|
||||||
echo "Backing up /var/secrets ..."
|
|
||||||
sudo mkdir -p "$BACKUP_DIR/var-secrets"
|
|
||||||
sudo rsync -a "/var/secrets/" "$BACKUP_DIR/var-secrets/"
|
|
||||||
else
|
|
||||||
echo "Skipping /var/secrets (not found)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "Backup complete: $BACKUP_DIR"
|
|
||||||
echo ""
|
|
||||||
echo "Size: $(sudo du -sh "$BACKUP_DIR" | cut -f1)"
|
|
||||||
echo ""
|
|
||||||
echo "NOTE: Media files on /mnt/storage are NOT included — move the data disks to the new server directly."
|
|
||||||
echo ""
|
|
||||||
echo "Restarting services..."
|
|
||||||
sudo systemctl start jellyfin sonarr radarr prowlarr bazarr qbittorrent-nox authelia-main 2>/dev/null || true
|
|
||||||
|
|
@ -66,7 +66,6 @@ Flake-based NixOS configuration for three machines, built and deployed directly
|
||||||
│ └── users.nix # User accounts, SSH keys
|
│ └── users.nix # User accounts, SSH keys
|
||||||
├── templates # CSS templates recoloured by stylix.nix
|
├── templates # CSS templates recoloured by stylix.nix
|
||||||
├── walls # Wallpapers
|
├── walls # Wallpapers
|
||||||
├── backup-server.sh # One-shot mediaserver state backup (run manually)
|
|
||||||
├── ports.toml # WAN → LAN port forwards consumed by router.nix
|
├── ports.toml # WAN → LAN port forwards consumed by router.nix
|
||||||
├── common.nix # Shared config imported by all hosts
|
├── common.nix # Shared config imported by all hosts
|
||||||
├── flake.lock # Auto-generated, updated daily by Forgejo Actions
|
├── flake.lock # Auto-generated, updated daily by Forgejo Actions
|
||||||
|
|
@ -236,7 +235,7 @@ sudo chown authelia-main:authelia-main /var/lib/authelia-main/users_database.yml
|
||||||
|
|
||||||
## Migrating to a new server
|
## Migrating to a new server
|
||||||
|
|
||||||
When moving FredOS-Mediaserver to new hardware, back up these state directories from the old server (`backup-server.sh` automates most of it):
|
When moving FredOS-Mediaserver to new hardware, back up these state directories from the old server:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Service databases and config (stop services first)
|
# Service databases and config (stop services first)
|
||||||
|
|
|
||||||
|
|
@ -12,17 +12,11 @@ let
|
||||||
];
|
];
|
||||||
directories = pkgs.writeText "media-directories.conf" ''
|
directories = pkgs.writeText "media-directories.conf" ''
|
||||||
d /mnt/storage/torrents/downloads 2775 qbittorrent media -
|
d /mnt/storage/torrents/downloads 2775 qbittorrent media -
|
||||||
Z /mnt/storage/torrents/downloads 2775 qbittorrent media -
|
|
||||||
d /mnt/storage/torrents/shows 2775 sonarr media -
|
d /mnt/storage/torrents/shows 2775 sonarr media -
|
||||||
Z /mnt/storage/torrents/shows 2775 sonarr media -
|
|
||||||
d /mnt/storage/torrents/movies 2775 radarr media -
|
d /mnt/storage/torrents/movies 2775 radarr media -
|
||||||
Z /mnt/storage/torrents/movies 2775 radarr media -
|
|
||||||
d /mnt/storage/torrents/audiobooks 2775 fred media -
|
d /mnt/storage/torrents/audiobooks 2775 fred media -
|
||||||
Z /mnt/storage/torrents/audiobooks 2775 fred media -
|
|
||||||
d /mnt/storage/usenet/downloads 2775 sabnzbd media -
|
d /mnt/storage/usenet/downloads 2775 sabnzbd media -
|
||||||
Z /mnt/storage/usenet/downloads 2775 sabnzbd media -
|
|
||||||
d /mnt/storage/usenet/incomplete 2775 sabnzbd media -
|
d /mnt/storage/usenet/incomplete 2775 sabnzbd media -
|
||||||
Z /mnt/storage/usenet/incomplete 2775 sabnzbd media -
|
|
||||||
'';
|
'';
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue