How to start a s3ql script automatically on boot?

Posted by ks78 on Server Fault See other posts from Server Fault or by ks78
Published on 2011-01-08T15:34:47Z Indexed on 2011/01/08 15:55 UTC
Read the original article Hit count: 449

I've been experimenting with s3ql on Ubuntu 10.04, using it to mount Amazon S3 buckets. However, I'd really like it to mount them automatically. Does anyone know how to do that?

I've been working on a script, which works when its run from from the commandline, but for some reason I can't get it to run automatically on boot. Does anyone have any ideas?

Here's my script:

#! /bin/sh
# /etc/init.d/s3ql
#

### BEGIN INIT INFO
# Provides:          s3ql
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start daemon at boot time
# Description:       Enable service provided by daemon.
### END INIT INFO


case "$1" in
  start)

    # Redirect stdout and stderr into the system log
    DIR=$(mktemp -d)
    mkfifo "$DIR/LOG_FIFO"
    logger -t s3ql -p local0.info < "$DIR/LOG_FIFO" &
    exec > "$DIR/LOG_FIFO"
    exec 2>&1
    rm -rf "$DIR"

    modprobe fuse
    fsck.s3ql --batch s3://mybucket
    exec mount.s3ql --allow-other s3://mybucket /mnt/s3fs

    ;;
  stop)
    umount.s3ql /mnt/s3fs
    ;;
  *)
    echo "Usage: /etc/init.d/s3ql{start|stop}"
    exit 1
    ;;
esac

exit 0

© Server Fault or respective owner

How to start a s3ql script automatically on boot?

Posted by ks78 on Ask Ubuntu See other posts from Ask Ubuntu or by ks78
Published on 2011-01-08T08:00:09Z Indexed on 2011/01/08 9:00 UTC
Read the original article Hit count: 450

I've been experimenting with s3ql on Ubuntu 10.04, using it to mount Amazon S3 buckets. However, I'd really like it to mount them automatically. Does anyone know how to do that?

I've been working on a script, which works when its run from from the commandline, but for some reason I can't get it to run automatically on boot. Does anyone have any ideas?

Here's my script:

#! /bin/sh
# /etc/init.d/s3ql
#

### BEGIN INIT INFO
# Provides:          s3ql
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start daemon at boot time
# Description:       Enable service provided by daemon.
### END INIT INFO


case "$1" in
  start)

    # Redirect stdout and stderr into the system log
    DIR=$(mktemp -d)
    mkfifo "$DIR/LOG_FIFO"
    logger -t s3ql -p local0.info < "$DIR/LOG_FIFO" &
    exec > "$DIR/LOG_FIFO"
    exec 2>&1
    rm -rf "$DIR"

    modprobe fuse
    fsck.s3ql --batch s3://mybucket
    exec mount.s3ql --allow-other s3://mybucket /mnt/s3fs

    ;;
  stop)
    umount.s3ql /mnt/s3fs
    ;;
  *)
    echo "Usage: /etc/init.d/s3ql{start|stop}"
    exit 1
    ;;
esac

exit 0

© Ask Ubuntu or respective owner

Related posts about ubuntu-server

Related posts about boot