GDBUS_BASE_CMD= "systemd-run -quiet -pipe -wait -user -machine - gdbus call -session -dest= -object-path /com/nextcloudgmbh/Nextcloud/Folder/0 " # Query current pause status if $GDBUS_BASE_CMD -method pause | grep -qF ' ' > /dev/null thenįi # Toggle pause if necessary if then $GDBUS_BASE_CMD -method. If then # If we did not pause nextcloud, also do not unpause it exit 0įi # This uses device list instead of (active) connection listing, # since the latter does not seem to want to print metered # status (only when printing a single connection) if nmcli -t -f GENERAL.METERED dev show | grep '^GENERAL.METERED:yes ' > /dev/null then # Another metered connection still active, do not unpause exit 0Įsac # This uses systemd-run to run a command inside the user's session, to get access to the user's dbus Based on what you described, you want to use Lightroom Classic. The only photos uploaded are the collections or individual photos youve marked to be synced to the cloud. & ! nmcli -t -f GENERAL.METERED dev show | grep '^GENERAL.METERED:yes ' > /dev/null then # New connection is not metered, nothing to do exit 0 fi Lightroom Classic is designed the way you want: It uses your own local drives as the master storage, and nothing gets uploaded to the cloud by default. if ! nmcli -t -f tered connection show " $CONNECTION_UUID " | grep '^tered:yes ' > /dev/null \ for bluetooth connections it seems it is # unknown for the connection by default, but then is yes for # the device after connecting. It seems that the connection status is manually set, # but can be unknown, while the device status can also be # guessed (i.e. # This checks the metered status of the connection *and* the # device. PAUSED_BY_US= " $RUNDIR/nextcloud-paused-by-nm-script " if then exit 0 For a more generic solution that works # with all logged in users, `loginctl list-users -o json` could be used Download the Jump Desktop app to your iPhone, iPad, Android, Mac or Windows device. # Figuring out the metered status using nmcli was inspired by # Queries and toggling nextcloud sync using dbus was inspired by # Running commands inside the user's dbus was inspired by ĪCTION= " $2 " # The user whose nextcloud to pause. # /etc/NetworkManager/dispatcher.d/99-nextcloud-pause and make it executable. Multiple/different users could be # supported by iterating over `loginctl list-users -o json` maybe. # This currently only works for a single, hardcoded user, which works for the # typical single-user computer case. # - Unpause nextcloud sync when any connection was brought down and no # other connections are metered, but only if this script actually paused # nextcloud before (to prevent unpausing when you manually paused). #!/bin/sh -e # This script will: # - Pause nextcloud sync when a metered connection was brought up (even when # it is not the default connection - better safe and simple than sorry).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |