mirror of
https://github.com/rileyrg/linux-init.git
synced 2024-09-29 05:37:29 +02:00
tidy rclone_gdrive_sync
This commit is contained in:
parent
c2e82ddc6a
commit
6922156298
3 changed files with 58 additions and 25 deletions
33
README.md
33
README.md
|
@ -2221,7 +2221,7 @@ notify-send -t 3000 "${@}" || true
|
|||
```
|
||||
|
||||
|
||||
<a id="org7d38579"></a>
|
||||
<a id="org2c40277"></a>
|
||||
|
||||
### ~/bin/sway/sway-screen
|
||||
|
||||
|
@ -2271,7 +2271,7 @@ swaymsg "
|
|||
|
||||
### ~/bin/sway/sway-screen-menu
|
||||
|
||||
Gui to select a display and enable/disable it. Calls down to [~/bin/sway/sway-screen](#org7d38579).
|
||||
Gui to select a display and enable/disable it. Calls down to [~/bin/sway/sway-screen](#org2c40277).
|
||||
|
||||
:ID: 82455cae-1c48-48b2-a8b3-cb5d44eeaee9
|
||||
|
||||
|
@ -3711,7 +3711,7 @@ pw-cli s "$default_sink_id" Props "{ mute: false, channelVolumes: [ $new_volume_
|
|||
|
||||
## ~/bin/pulse-volume
|
||||
|
||||
pulse/pipeline volume control. Pass in a volume string to change the volume (man pactl) or on/off/toggle. It wont allow larger than 100% volume. Always returns the current volume volume/status. See [examples](#org458f901).
|
||||
pulse/pipeline volume control. Pass in a volume string to change the volume (man pactl) or on/off/toggle. It wont allow larger than 100% volume. Always returns the current volume volume/status. See [examples](#org8120de7).
|
||||
|
||||
```bash
|
||||
#!/usr/bin/env bash
|
||||
|
@ -3747,7 +3747,7 @@ echo "$(getVolume)"
|
|||
```
|
||||
|
||||
|
||||
<a id="org458f901"></a>
|
||||
<a id="org8120de7"></a>
|
||||
|
||||
### Examples:
|
||||
|
||||
|
@ -4042,11 +4042,11 @@ xmg-neo-rgb-kbd-lights set-color red
|
|||
```bash
|
||||
#!/usr/bin/env bash
|
||||
# Maintained in linux-config.org
|
||||
ls -1tr "${HOME}"/tmp/rclone-bisync* | head -n -12 | xargs -d '\n' rm -f --
|
||||
LOGFILE="${HOME}/tmp/rclone-bisync-$(date +"%Y_%m_%d_%I_%M_%p").log"
|
||||
ln -sf "${LOGFILE}" "${HOME}/rclone_gdrive_sync.log"
|
||||
|
||||
LOGFILE="$HOME/tmp/rclone-bisync-$(date +"%Y_%m_%d_%I_%M_%p").log"
|
||||
|
||||
OPTS=(
|
||||
--log-file="${LOGFILE}"
|
||||
--log-file="$LOGFILE"
|
||||
--log-level INFO
|
||||
--checkers=16
|
||||
--drive-pacer-min-sleep=10ms
|
||||
|
@ -4056,20 +4056,31 @@ OPTS=(
|
|||
--tpslimit=10
|
||||
--drive-chunk-size=256M
|
||||
--drive-use-trash=false
|
||||
--fast-list "${HOME}/cloud" cloud:
|
||||
--fast-list "$HOME/cloud" cloud:
|
||||
)
|
||||
|
||||
#quit if already running.
|
||||
if pgrep -x "rclone" > /dev/null
|
||||
then
|
||||
echo "rclone already running. Bye." >> "${LOGFILE}"
|
||||
echo "rclone already running. Bye." >> "$LOGFILE"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# prune logs
|
||||
find "$HOME/tmp" -name "rclone-bisync*" | head -n -12 | xargs -d '\n' rm -f --
|
||||
|
||||
# symlink latest logfile to ~/rclone_gdrive_sync.log
|
||||
ln -sf "$LOGFILE" "$HOME/rclone_gdrive_sync.log"
|
||||
|
||||
rclone bisync "${OPTS[@]}"
|
||||
retVal=$?
|
||||
# if bisyncs failed then generally resync is requiered
|
||||
if [ $retVal -ne 0 ]; then
|
||||
echo "Error (${retVal}) last bisync. Doing a resync." >> "$LOGFILE"
|
||||
rclone bisync --resync "${OPTS[@]}"
|
||||
echo "rclone bisync resync finished" >> "$LOGFILE"
|
||||
else
|
||||
echo "rclone bisync finished without error." >> "$LOGFILE"
|
||||
echo "rclone bisync finished." >> "$LOGFILE"
|
||||
fi
|
||||
```
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#!/usr/bin/env bash
|
||||
# Maintained in linux-config.org
|
||||
ls -1tr "${HOME}"/tmp/rclone-bisync* | head -n -12 | xargs -d '\n' rm -f --
|
||||
LOGFILE="${HOME}/tmp/rclone-bisync-$(date +"%Y_%m_%d_%I_%M_%p").log"
|
||||
ln -sf "${LOGFILE}" "${HOME}/rclone_gdrive_sync.log"
|
||||
|
||||
LOGFILE="$HOME/tmp/rclone-bisync-$(date +"%Y_%m_%d_%I_%M_%p").log"
|
||||
|
||||
OPTS=(
|
||||
--log-file="${LOGFILE}"
|
||||
--log-file="$LOGFILE"
|
||||
--log-level INFO
|
||||
--checkers=16
|
||||
--drive-pacer-min-sleep=10ms
|
||||
|
@ -14,18 +14,29 @@ OPTS=(
|
|||
--tpslimit=10
|
||||
--drive-chunk-size=256M
|
||||
--drive-use-trash=false
|
||||
--fast-list "${HOME}/cloud" cloud:
|
||||
--fast-list "$HOME/cloud" cloud:
|
||||
)
|
||||
|
||||
#quit if already running.
|
||||
if pgrep -x "rclone" > /dev/null
|
||||
then
|
||||
echo "rclone already running. Bye." >> "${LOGFILE}"
|
||||
echo "rclone already running. Bye." >> "$LOGFILE"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# prune logs
|
||||
find "$HOME/tmp" -name "rclone-bisync*" | head -n -12 | xargs -d '\n' rm -f --
|
||||
|
||||
# symlink latest logfile to ~/rclone_gdrive_sync.log
|
||||
ln -sf "$LOGFILE" "$HOME/rclone_gdrive_sync.log"
|
||||
|
||||
rclone bisync "${OPTS[@]}"
|
||||
retVal=$?
|
||||
# if bisyncs failed then generally resync is requiered
|
||||
if [ $retVal -ne 0 ]; then
|
||||
echo "Error (${retVal}) last bisync. Doing a resync." >> "$LOGFILE"
|
||||
rclone bisync --resync "${OPTS[@]}"
|
||||
echo "rclone bisync resync finished" >> "$LOGFILE"
|
||||
else
|
||||
echo "rclone bisync finished without error." >> "$LOGFILE"
|
||||
echo "rclone bisync finished." >> "$LOGFILE"
|
||||
fi
|
||||
|
|
|
@ -4378,11 +4378,11 @@ See [[https://github.com/pobrn/ite8291r3-ctl][XMGNeo 15 keyboard backlight contr
|
|||
#+begin_src bash :tangle "~/bin/rclone_gdrive_sync"
|
||||
#!/usr/bin/env bash
|
||||
# Maintained in linux-config.org
|
||||
ls -1tr "${HOME}"/tmp/rclone-bisync* | head -n -12 | xargs -d '\n' rm -f --
|
||||
LOGFILE="${HOME}/tmp/rclone-bisync-$(date +"%Y_%m_%d_%I_%M_%p").log"
|
||||
ln -sf "${LOGFILE}" "${HOME}/rclone_gdrive_sync.log"
|
||||
|
||||
LOGFILE="$HOME/tmp/rclone-bisync-$(date +"%Y_%m_%d_%I_%M_%p").log"
|
||||
|
||||
OPTS=(
|
||||
--log-file="${LOGFILE}"
|
||||
--log-file="$LOGFILE"
|
||||
--log-level INFO
|
||||
--checkers=16
|
||||
--drive-pacer-min-sleep=10ms
|
||||
|
@ -4392,20 +4392,31 @@ See [[https://github.com/pobrn/ite8291r3-ctl][XMGNeo 15 keyboard backlight contr
|
|||
--tpslimit=10
|
||||
--drive-chunk-size=256M
|
||||
--drive-use-trash=false
|
||||
--fast-list "${HOME}/cloud" cloud:
|
||||
--fast-list "$HOME/cloud" cloud:
|
||||
)
|
||||
|
||||
#quit if already running.
|
||||
if pgrep -x "rclone" > /dev/null
|
||||
then
|
||||
echo "rclone already running. Bye." >> "${LOGFILE}"
|
||||
echo "rclone already running. Bye." >> "$LOGFILE"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# prune logs
|
||||
find "$HOME/tmp" -name "rclone-bisync*" | head -n -12 | xargs -d '\n' rm -f --
|
||||
|
||||
# symlink latest logfile to ~/rclone_gdrive_sync.log
|
||||
ln -sf "$LOGFILE" "$HOME/rclone_gdrive_sync.log"
|
||||
|
||||
rclone bisync "${OPTS[@]}"
|
||||
retVal=$?
|
||||
# if bisyncs failed then generally resync is requiered
|
||||
if [ $retVal -ne 0 ]; then
|
||||
echo "Error (${retVal}) last bisync. Doing a resync." >> "$LOGFILE"
|
||||
rclone bisync --resync "${OPTS[@]}"
|
||||
echo "rclone bisync resync finished" >> "$LOGFILE"
|
||||
else
|
||||
echo "rclone bisync finished without error." >> "$LOGFILE"
|
||||
echo "rclone bisync finished." >> "$LOGFILE"
|
||||
fi
|
||||
#+end_src
|
||||
** Power Monitoring
|
||||
|
|
Loading…
Reference in a new issue