挂载移动硬盘fstab配置文件,nofail当移动硬盘没插入时不提示错误,要不然提示错误进不去系统,noatime提升硬盘文件系统性能。
/dev/sda1 /mnt ext4 defaults,nofail,noatime,errors=remount-ro 0 2
配置transmission当移动硬盘挂载后才开始启动,且启动前检查下载目录是否存在,否则启动失败。
查看system生成的移动硬盘挂载服务,然后配置transmission在其挂载之后启动。
systemctl list-unit-files |grep -i mount|grep mnt
mnt.mount generated
transmission service配置:
[Unit]
Description=Transmission BitTorrent Daemon
After=network.target mnt.mount
[Service]
LimitNOFILE=65535
User=debian-transmission
#Type=notify
Type=simple
ExecStartPre=/usr/bin/test -d /mnt/downloads
#RequiresMountsFor=/mnt
ExecStart=/usr/bin/transmission-daemon -f --log-error -g /var/lib/transmission-daemon/.config/transmission-daemon/
ExecStop=/bin/kill -s STOP $MAINPID
ExecReload=/bin/kill -s HUP $MAINPID
[Install]
WantedBy=multi-user.target
参考:
https://unix.stackexchange.com/questions/246935/set-systemd-service-to-execute-after-fstab-mount
标签:none