diff --git a/.config/linux/system/home/Backup.nix b/.config/linux/system/home/Backup.nix index 9089896..d12bddd 100644 --- a/.config/linux/system/home/Backup.nix +++ b/.config/linux/system/home/Backup.nix @@ -6,9 +6,17 @@ description = "Home system backup."; serviceConfig = { Type = "oneshot"; - ExecStart = "/root/app/bin/home/backup"; + ExecStart = "/root/app/bin/home/Backup"; }; - wantedBy = [ "multi-user.target" ]; + path = with pkgs; [ + bashInteractive + curl + gnutar + gzip + gawk + pv + ]; + # wantedBy = [ "multi-user.target" ]; }; systemd.timers.backup = { diff --git a/.config/linux/system/home/Nextcloud.nix b/.config/linux/system/home/Nextcloud.nix index 9204244..95a1fbd 100644 --- a/.config/linux/system/home/Nextcloud.nix +++ b/.config/linux/system/home/Nextcloud.nix @@ -6,9 +6,13 @@ description = "Nextcloud worker."; serviceConfig = { Type = "oneshot"; - ExecStart = "/root/app/bin/home/nextcloud"; + ExecStart = "/root/app/bin/home/Nextcloud"; }; - wantedBy = [ "multi-user.target" ]; + path = with pkgs; [ + bashInteractive + docker + ]; + # wantedBy = [ "multi-user.target" ]; }; systemd.timers.nextcloud = { diff --git a/.config/linux/system/home/PhotosProcess.nix b/.config/linux/system/home/PhotosProcess.nix index 4f9c4a0..6ed6ac7 100644 --- a/.config/linux/system/home/PhotosProcess.nix +++ b/.config/linux/system/home/PhotosProcess.nix @@ -6,9 +6,13 @@ description = "Process uploaded photos."; serviceConfig = { Type = "oneshot"; - ExecStart = "/root/app/bin/home/photos_process"; + ExecStart = "/root/app/bin/home/PhotosProcess"; }; - wantedBy = [ "multi-user.target" ]; + path = with pkgs; [ + bashInteractive + docker + ]; + # wantedBy = [ "multi-user.target" ]; }; systemd.timers.photos_process = { diff --git a/.config/linux/system/home/YandexMusic.nix b/.config/linux/system/home/YandexMusic.nix index 09e5e50..425ff19 100644 --- a/.config/linux/system/home/YandexMusic.nix +++ b/.config/linux/system/home/YandexMusic.nix @@ -6,9 +6,13 @@ description = "Sync music from Yandex.Music."; serviceConfig = { Type = "oneshot"; - ExecStart = "/root/app/bin/home/yandex_music"; + ExecStart = "/root/app/bin/home/YandexMusic"; }; - wantedBy = [ "multi-user.target" ]; + path = with pkgs; [ + bashInteractive + docker + ]; + # wantedBy = [ "multi-user.target" ]; }; systemd.timers.yandex_music = { diff --git a/app/bin/home/backup b/app/bin/home/Backup similarity index 100% rename from app/bin/home/backup rename to app/bin/home/Backup diff --git a/app/bin/home/Nextcloud b/app/bin/home/Nextcloud new file mode 100755 index 0000000..60fda98 --- /dev/null +++ b/app/bin/home/Nextcloud @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +# Source modules. +for file in /root/.config/bash/module/*.sh; do + source "${file}" +done + +docker exec -u 33 cloud php -f /var/www/html/cron.php || notify 'Nextcloud : Failed to run cron.' diff --git a/app/bin/home/photos_process b/app/bin/home/PhotosProcess similarity index 58% rename from app/bin/home/photos_process rename to app/bin/home/PhotosProcess index 122e0e8..d70a676 100755 --- a/app/bin/home/photos_process +++ b/app/bin/home/PhotosProcess @@ -3,4 +3,4 @@ in="/storage/hot/docker/cloud/data/data/cakee/files/media/photo/" out="/storage/cold_1/backup/tmp/photo/" -/usr/bin/docker run --rm -v "${in}":/in -v "${out}":/out voronind.com/photoprocess:latest +docker run --rm -v "${in}":/in -v "${out}":/out voronind.com/photoprocess:latest diff --git a/app/bin/home/YandexMusic b/app/bin/home/YandexMusic new file mode 100755 index 0000000..5c0e01e --- /dev/null +++ b/app/bin/home/YandexMusic @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +music="/storage/hot/media/music/" + +docker run --rm -v "${music}":/music voronind.com/yamusic:latest diff --git a/app/bin/home/nextcloud b/app/bin/home/nextcloud deleted file mode 100755 index d9adafe..0000000 --- a/app/bin/home/nextcloud +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash - -shopt -s globstar -shopt -s dotglob - -notify() -{ - curl -X POST -H 'Content-Type: Application/json' -d "{\"chat_id\":\"155897358\",\"text\":\"$1\"}" https://api.telegram.org/bot2046849441:AAHQpjRK4xpL8tEUyN4JTSDUUze4J0wSIy4/sendMessage &> /dev/null -} - -notify_silent() -{ - curl -X POST -H 'Content-Type: Application/json' -d "{\"chat_id\":\"155897358\",\"text\":\"$1\",\"disable_notification\":\"true\"}" https://api.telegram.org/bot2046849441:AAHQpjRK4xpL8tEUyN4JTSDUUze4J0wSIy4/sendMessage &> /dev/null -} - -docker exec -u 33 cloud php -f /var/www/html/cron.php || notify 'nextcloud : failed to run cron' diff --git a/app/bin/home/yandex_music b/app/bin/home/yandex_music deleted file mode 100755 index 14005f7..0000000 --- a/app/bin/home/yandex_music +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -music="/storage/hot/media/music/" - -/usr/bin/docker run --rm -v "${music}":/music voronind.com/yamusic:latest