How to start a s3ql script automatically on boot?
- by ks78
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