Update home scripts.

This commit is contained in:
Dmitry Voronin 2024-01-25 22:29:59 +03:00
parent 0b722b116b
commit 3abb50cfc2
10 changed files with 42 additions and 30 deletions

View file

@ -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 = {

View file

@ -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 = {

View file

@ -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 = {

View file

@ -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 = {

8
app/bin/home/Nextcloud Executable file
View file

@ -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.'

View file

@ -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

5
app/bin/home/YandexMusic Executable file
View file

@ -0,0 +1,5 @@
#!/usr/bin/env bash
music="/storage/hot/media/music/"
docker run --rm -v "${music}":/music voronind.com/yamusic:latest

View file

@ -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'

View file

@ -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