This commit is contained in:
Hadi 2024-05-16 17:59:50 +02:00
parent bc9101e542
commit 0b32914be2
2 changed files with 7 additions and 6 deletions

View File

@ -4,11 +4,12 @@ let
variable = import ../../../variables.nix; variable = import ../../../variables.nix;
nextcloud-watch = pkgs.writeShellScriptBin "nextcloud-watch" '' nextcloud-watch = pkgs.writeShellScriptBin "nextcloud-watch" ''
# Start nextcloud if I'm on my networks # Start nextcloud if I'm on my local network
while true;do while true;do
sleep 120
ssid=$(nmcli -t -f name connection show --active | head -n1) ssid=$(nmcli -t -f name connection show --active | head -n1)
status=$(pgrep -n nextcloud) nextcloud_status=$(ps -aux | grep -E "/bin/nextcloud --background$")
if [[ -z $status ]]; then if [[ $nextcloud_status == "" ]]; then
service_status="inactive" service_status="inactive"
else else
service_status="active" service_status="active"
@ -20,10 +21,10 @@ let
fi fi
else else
if [[ $service_status == "active" ]]; then if [[ $service_status == "active" ]]; then
pkill nextcloud nextcloud_pid=$(pgrep -n nextcloud)
kill $nextcloud_pid
fi fi
fi fi
sleep 120
done done
''; '';

View File

@ -1 +1 @@
{ ... }: { imports = [ ./wip.nix ./wallpapers ./config/load_colors.nix ]; } { ... }: { imports = [ ./nixy.nix ./wallpapers ./config/load_colors.nix ]; }