33 lines
878 B
Bash
Executable File
33 lines
878 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Default error state
|
|
ICON=""
|
|
TEXT="Unknown"
|
|
|
|
# Check for DBUS session
|
|
if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then
|
|
TEXT="No D-Bus"
|
|
else
|
|
# Check if the service is active (syncing)
|
|
if systemctl --user is-active --quiet rclone-sync.service; then
|
|
ICON=""
|
|
TEXT="Sync..."
|
|
else
|
|
# Check if the service file exists/is loaded
|
|
if ! systemctl --user list-units --all | grep -q "rclone-sync.service"; then
|
|
TEXT="No Service"
|
|
else
|
|
LAST_STATUS=$(systemctl --user show rclone-sync.service -p ExecMainStatus --value)
|
|
if [ "$LAST_STATUS" == "0" ]; then
|
|
ICON=""
|
|
TEXT="OK"
|
|
else
|
|
ICON=""
|
|
TEXT="Fehler"
|
|
fi
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
# Output a single line of plain text
|
|
printf "%s %s\n" "$ICON" "$TEXT" |