aboutsummaryrefslogtreecommitdiff
path: root/local/bin
diff options
context:
space:
mode:
Diffstat (limited to 'local/bin')
-rwxr-xr-xlocal/bin/allsync32
-rwxr-xr-xlocal/bin/sshvnc2
-rwxr-xr-xlocal/bin/startsway9
3 files changed, 32 insertions, 11 deletions
diff --git a/local/bin/allsync b/local/bin/allsync
index c268b97..e5bb633 100755
--- a/local/bin/allsync
+++ b/local/bin/allsync
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -eu
cronline="* * * * * /bin/sh -c 'AUTORUN=y /home/cynerd/.local/bin/allsync'"
@@ -16,20 +16,32 @@ i3_astroid() {
cron_enable() {
pass mail/cynerd@email.cz >/dev/null # Cache keys
- {
- crontab -l
- echo "$cronline"
- } | crontab -
+ if command -v crontab >/dev/null; then
+ {
+ crontab -l
+ echo "$cronline"
+ } | crontab -
+ else
+ systemctl --user start allsync.timer
+ fi
notify_i3block
}
cron_disable() {
- crontab -l | grep -Fv "$cronline" | crontab -
+ if command -v crontab >/dev/null; then
+ crontab -l | grep -Fv "$cronline" | crontab -
+ else
+ systemctl --user stop allsync.timer
+ fi
notify_i3block
}
cron_enabled() {
- crontab -l | grep -Fq "$cronline"
+ if command -v crontab >/dev/null; then
+ crontab -l | grep -Fq "$cronline"
+ else
+ systemctl --user is-active allsync.timer >/dev/null
+ fi
}
if [ "$#" -gt 0 ]; then
@@ -67,6 +79,7 @@ fi
##################################################################################
+flock_nonblock=""
if [ "${AUTORUN:-n}" = "y" ]; then
exec &> >(logger -t "${0##*/}")
@@ -75,10 +88,13 @@ if [ "${AUTORUN:-n}" = "y" ]; then
cron_disable
exit 1
fi
+ flock_nonblock="--nonblock"
fi
if [ "${ALLSYNC_FLOCK:-n}" != "y" ]; then
- ALLSYNC_FLOCK=y exec flock --exclusive "$HOME/.mail" "$0" "$@"
+ ALLSYNC_FLOCK=y exec flock $flock_nonblock --exclusive "$HOME/.mail" "$0" "$@"
+ echo "Another instance is alredy running" >&2
+ exit 1
fi
diff --git a/local/bin/sshvnc b/local/bin/sshvnc
index af133b4..fcee459 100755
--- a/local/bin/sshvnc
+++ b/local/bin/sshvnc
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -eu
target="$1"
diff --git a/local/bin/startsway b/local/bin/startsway
index 63163ee..1639277 100755
--- a/local/bin/startsway
+++ b/local/bin/startsway
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -eu
exec 1> >(logger -s -t "${0##*/}") 2>&1
@@ -17,4 +17,9 @@ export MOZ_ENABLE_WAYLAND=1
# Java application do not display properly
export _JAVA_AWT_WM_NONREPARENTING=1
-exec dbus-run-session sway
+dbus="dbus-run-session"
+if command -v systemctl >/dev/null; then
+ dbus=""
+fi
+
+exec $dbus sway