Hi Martin,

I'm using the following unit file:

[Unit]
Description=Mount s3ql file system
Requires=nss-lookup.target network.target time-sync.target
After=nss-lookup.target network.target network-online.target
remote-fs-pre.target time-sync.target
Conflicts=shutdown.target
ConditionPathIsDirectory=/media/container-test

[Service]
Type=notify
ExecStart=/usr/local/sbin/mount-media-container-test.sh
LimitNOFILE=66000
TimeoutStopSec=10min
TimeoutStartSec=10min

[Install]
WantedBy=multi-user.target

With /usr/local/sbin/mount-media-container-test.sh being:
#!/bin/bash

FSCK_OPTS="--batch --authfile /path/to/s3ql.txt
--backend-options=tcp-timeout=20"
MOUNT_OPTS="--fg --allow-other --authfile /path/to/s3ql.txt
--backend-options=tcp-timeout=20 --max-cache-entries 65536"
STORAGE_URL="swiftks://xxx"
MOUNTPOINT="/media/container-test"

echo executing fsck.s3ql $FSCK_OPTS "$STORAGE_URL"
/usr/bin/fsck.s3ql $FSCK_OPTS "$STORAGE_URL"
FSCK_RESULT=$?
if [[ $FSCK_RESULT != 0 && $FSCK_RESULT != 128 ]]; then
  echo "fsck.s3ql reported errors! exit code $FSCK_RESULT"
  exit $FSCK_RESULT
fi
echo executing mount.s3ql $MOUNT_OPTS "$STORAGE_URL" "$MOUNTPOINT"
exec /usr/bin/mount.s3ql $MOUNT_OPTS "$STORAGE_URL" "$MOUNTPOINT"


S3QL stops gracefully when getting a INT-Signal, so no need for the
ExecStop.
With "Conflicts=shutdown.target" the unit gets stoped before shutdown –
that isimportant because S3QL can take quite some time to shut down
properly (it needs to upload all dirty blocks) otherwise systemd would
forcefully kill S3QL after some time (and do not honor the
TimeoutStopSec option)
I use an extra bash script to make the mounting a little bit more robust
(if S3QL was not cleanly unmounted it needs a fsck before it can
re-mount the file system).

-- 
You received this message because you are subscribed to the Google Groups 
"s3ql" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to