forked from finn/tinyboard
attempt service fix
This commit is contained in:
@@ -6,7 +6,7 @@ After=network-online.target
|
|||||||
Wants=network-online.target
|
Wants=network-online.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=notify
|
Type=simple
|
||||||
ExecStartPre=/usr/bin/mkdir -p %h/mnt/%i
|
ExecStartPre=/usr/bin/mkdir -p %h/mnt/%i
|
||||||
ExecStart=/usr/bin/rclone mount %i: %h/mnt/%i \
|
ExecStart=/usr/bin/rclone mount %i: %h/mnt/%i \
|
||||||
--config=%h/.config/rclone/rclone.conf \
|
--config=%h/.config/rclone/rclone.conf \
|
||||||
@@ -14,10 +14,12 @@ ExecStart=/usr/bin/rclone mount %i: %h/mnt/%i \
|
|||||||
--vfs-cache-max-size 256M \
|
--vfs-cache-max-size 256M \
|
||||||
--allow-other \
|
--allow-other \
|
||||||
--log-level INFO \
|
--log-level INFO \
|
||||||
--log-file /tmp/rclone-%i.log
|
--log-file %h/.local/share/rclone-%i.log
|
||||||
ExecStop=/bin/fusermount -u %h/mnt/%i
|
ExecStop=/bin/fusermount -u %h/mnt/%i
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
RestartSec=5
|
RestartSec=10
|
||||||
|
StartLimitInterval=60
|
||||||
|
StartLimitBurst=3
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=default.target
|
WantedBy=default.target
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ set -euo pipefail
|
|||||||
TUNNEL_DIR="${TUNNEL_DIR:-$HOME/tinyboard/spoke}"
|
TUNNEL_DIR="${TUNNEL_DIR:-$HOME/tinyboard/spoke}"
|
||||||
COMPOSE_FILE="${COMPOSE_FILE:-$TUNNEL_DIR/compose.yaml}"
|
COMPOSE_FILE="${COMPOSE_FILE:-$TUNNEL_DIR/compose.yaml}"
|
||||||
RCLONE_REMOTE="${RCLONE_REMOTE:-brie-remote}"
|
RCLONE_REMOTE="${RCLONE_REMOTE:-brie-remote}"
|
||||||
MOUNT_POINT="${MOUNT_POINT:-$HOME/mnt/brie}"
|
MOUNT_POINT="${MOUNT_POINT:-$HOME/mnt/$RCLONE_REMOTE}"
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
# Usage
|
# Usage
|
||||||
@@ -99,10 +99,40 @@ EOF
|
|||||||
# Hub actions (rclone user service)
|
# Hub actions (rclone user service)
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
hub_install() {
|
hub_install() {
|
||||||
echo "Assuming you have placed rclone-mount@.service in ~/.config/systemd/user/"
|
local SERVICE_DIR="$HOME/.config/systemd/user"
|
||||||
echo "Also, 'sudo loginctl enable-linger armbian' and a reboot may be necessary."
|
local SERVICE_FILE="$SERVICE_DIR/rclone-mount@.service"
|
||||||
echo "If not, create it manually. Then run: systemctl --user daemon-reload"
|
local TEMPLATE_FILE="$(dirname "$0")/hub/rclone-mount@.service"
|
||||||
|
|
||||||
|
echo "Installing rclone mount systemd user service..."
|
||||||
|
|
||||||
|
# Create service directory if it doesn't exist
|
||||||
|
mkdir -p "$SERVICE_DIR"
|
||||||
|
|
||||||
|
# Check if template exists
|
||||||
|
if [ ! -f "$TEMPLATE_FILE" ]; then
|
||||||
|
die "Service template not found at $TEMPLATE_FILE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Copy service template
|
||||||
|
cp "$TEMPLATE_FILE" "$SERVICE_FILE"
|
||||||
|
echo "Copied service template to $SERVICE_FILE"
|
||||||
|
|
||||||
|
# Check if user linger is enabled
|
||||||
|
if ! systemctl --user is-enabled --quiet user@$(id -u).service 2>/dev/null; then
|
||||||
|
echo "WARNING: User linger may not be enabled. Run: sudo loginctl enable-linger $USER"
|
||||||
|
echo "You may need to reboot for user services to start automatically."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Reload systemd
|
||||||
systemctl --user daemon-reload
|
systemctl --user daemon-reload
|
||||||
|
echo "Systemd user daemon reloaded."
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "Next steps:"
|
||||||
|
echo "1. Ensure /etc/fuse.conf has 'user_allow_other' uncommented"
|
||||||
|
echo "2. Ensure you're in the 'fuse' group: sudo usermod -aG fuse $USER"
|
||||||
|
echo "3. Start the service: $0 hub start"
|
||||||
|
echo "4. Enable auto-start: systemctl --user enable rclone-mount@${RCLONE_REMOTE}.service"
|
||||||
}
|
}
|
||||||
|
|
||||||
hub_start() {
|
hub_start() {
|
||||||
|
|||||||
Reference in New Issue
Block a user