Hi Alexandre,

you should not use the |--lazy| switch for the unmount. Also using |stop
on runlevel [016]| is problematic.

This leaves the file system in a wrong state and so the mounting on
start does not work automatically.

Add |kill timeout 300| and use |stop on starting rc RUNLEVEL=[016]|

Here is the upstart-script I am using:

|#
# This file can be placed in /etc/init. It defines an upstart job that
# takes care of mounting and unmounting an S3QL file system.
#
description     "S3QL File System"
author          "Nikolaus Rath <[email protected]>"

# We can't use "stop on runlevel [016]" because from that point on we
# have only 10 seconds until the system shuts down completely.
stop on starting rc RUNLEVEL=[016]

# Time to wait before sending SIGKILL to the daemon and
# pre-stop script
kill timeout 300

instance ${STORAGE_URL}

expect stop

console log
# respawn - if the file system crashes, we want to know!
limit nofile 66000 66000

script
  FSCK_OPTS="--batch --authfile /root/.s3ql/authinfo2 
--backend-options=tcp-timeout=60"
  MOUNT_OPTS="--upstart --allow-other --authfile /root/.s3ql/authinfo2 
--backend-options=tcp-timeout=60"
  . "/root/.s3ql/config-$(echo -n $STORAGE_URL | /usr/bin/md5sum | awk '{print 
$1}')"
  if [ -n "$CACHEDIR" ]; then
    FSCK_OPTS="$FSCK_OPTS --cachedir $CACHEDIR"
    MOUNT_OPTS="$MOUNT_OPTS --cachedir $CACHEDIR"
  fi
  if [ -n "$CACHESIZE" ]; then
    MOUNT_OPTS="$MOUNT_OPTS --cachesize $CACHESIZE"
  fi
  if [ -n "$FSSIZE" ]; then
    MOUNT_OPTS="$MOUNT_OPTS --fssize $FSSIZE"
  fi
  if [ -n "$COMPRESS" ]; then
    MOUNT_OPTS="$MOUNT_OPTS --compress $COMPRESS"
  else
    MOUNT_OPTS="$MOUNT_OPTS --compress zlib-6"
  fi
  if [ -n "$MAX_CACHE_ENTRIES" ]; then
    MOUNT_OPTS="$MOUNT_OPTS --max-cache-entries $MAX_CACHE_ENTRIES"
  else
    MOUNT_OPTS="$MOUNT_OPTS --max-cache-entries 65536"
  fi
  # Check and mount file system
  echo executing fsck.s3ql $FSCK_OPTS "$STORAGE_URL"
  ( fsck.s3ql $FSCK_OPTS "$STORAGE_URL"; FSCK_RESULT=$? )
  if [[ $FSCK_RESULT != 0 && $FSCK_RESULT != 128 ]]; then
    echo fsck.s3ql reported errors!
    exit $FSCK_RESULT
  fi
  echo executing mount.s3ql $MOUNT_OPTS "$STORAGE_URL" "$MOUNTPOINT"
  exec mount.s3ql $MOUNT_OPTS "$STORAGE_URL" "$MOUNTPOINT"

end script

pre-stop script
  . "/root/.s3ql/config-$(echo -n $STORAGE_URL | /usr/bin/md5sum | awk '{print 
$1}')"
  exec umount.s3ql "$MOUNTPOINT"
end script
|

It gets started by this init script

|#
# This file can be placed in /etc/init. It defines an upstart job that
# takes care of mounting and unmounting an S3QL file system.
#
description     "S3QL File Systems"
author          "Daniel Jagszent <[email protected]>"

start on (local-filesystems and net-device-up IFACE!=lo)

# We can't use "stop on runlevel [016]" because from that point on we
# have only 10 seconds until the system shuts down completely.
stop on starting rc RUNLEVEL=[016]

kill timeout 500

pre-start script
    for inst in https://storage/url.1 https://storage/url.2
    do
        start cloud-mount STORAGE_URL=$inst || :
    done
end script

post-stop script
    for inst in `initctl list|grep "^cloud-mount "|awk '{print $2}'|tr -d 
')'|tr -d '('`
    do
        stop cloud-mount STORAGE_URL=$inst || :
    done
end script
|

> Alexandre Gonçalves <mailto:[email protected]>
> 29. März 2016 um 17:24
> Hello,
>
> I'm in trouble to make s3ql start automatically on Ubuntu 14.04. I've
> created this upstart script:
>
> start on (filesystem and net-device-up IFACE=p119p1)
>
> stop on runlevel [016]
>
> env BUCKET="gs://ideiao"
> env MOUNTPOINT="/mnt/gstore"
> env AUTHFILE="/myetc/s3ql/auth/s3ql_authinfo"
> env CACHEDIR="/myetc/s3ql/cache/"
>
>
>
> expect stop
>
> script
>     # Check and mount file system
>     fsck.s3ql           --authfile "$AUTHFILE" \
>                         --cachedir "$CACHEDIR" \
>                         --log "syslog" \
>                         "$BUCKET"
>
>     exec mount.s3ql     --authfile "$AUTHFILE" \
>                         --cachedir "$CACHEDIR" \
>                         --log "syslog"  \
>                         --metadata-upload-interval 3600 \
>                         --upstart  \
>                         --allow-other \
>                         "$BUCKET" \
>                         "$MOUNTPOINT"
>
> end script
>
> pre-stop script
>     umount.s3ql --lazy  "$MOUNTPOINT"
> end script
>
>
>
> It runs correctly when started manually, but never starts on reboot,
>
> Can anyone help?
>
> Thanks.
>
> Alexandre
> -- 
> 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]
> <mailto:[email protected]>.
> For more options, visit https://groups.google.com/d/optout.

​

-- 
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