rclone setup for ftp server
This commit is contained in:
16
rclone/.config/systemd/user/rclone_ftp_mount.service
Normal file
16
rclone/.config/systemd/user/rclone_ftp_mount.service
Normal file
@@ -0,0 +1,16 @@
|
||||
[Unit]
|
||||
Description=Mount Rclone FTP
|
||||
After=network-online.target network.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
# Use Environment to explicitly set $HOME
|
||||
Environment=HOME=%h
|
||||
ExecStartPre=%h/.local/bin/rclone_mount_check.sh
|
||||
ExecStart=/usr/bin/rclone mount tdnde_ftp: %h/mnt/tdnde_server --vfs-cache-mode full --vfs-cache-max-size 1G --ftp-concurrency 20 --timeout 60s --contimeout 30s --dir-cache-time 1h
|
||||
ExecStop=/bin/fusermount -u %h/mnt/tdnde_server
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
18
rclone/.local/bin/rclone_mount_check.sh
Executable file
18
rclone/.local/bin/rclone_mount_check.sh
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Define the network name (SSID) of your work network
|
||||
WORK_SSID="BELL577" # Replace with your actual work network name
|
||||
|
||||
# Get the current SSID (Wi-Fi network name)
|
||||
# CURRENT_SSID=$(iwgetid -r) # If using iwgetid for Wi-Fi; you can also use nmcli for more flexibility
|
||||
|
||||
# Alternatively, use nmcli to get the SSID
|
||||
CURRENT_SSID=$(nmcli -t -f active,ssid dev wifi | grep '^yes' | cut -d: -f2)
|
||||
|
||||
# Check if the current SSID matches the work network
|
||||
if [ "$CURRENT_SSID" == "$WORK_SSID" ]; then
|
||||
exit 0
|
||||
else
|
||||
echo "Not on the correct network (SSID: $CURRENT_SSID), skipping mount."
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user