Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- ### BEGIN INIT INFO
- # Provides: chiliproject
- # Required-Start: $local_fs $remote_fs $network $syslog
- # Required-Stop: $local_fs $remote_fs $network $syslog
- # Should-Start: $network
- # Should-Stop: $network
- # Default-Start: 2 3 4 5
- # Default-Stop: 0 1 6
- # Short-Description: Daemonized version of chiliproject
- # Description: Starts the chiliproject daemon
- # /etc/default/chiliproject.
- ### END INIT INFO
- # Get lsb functions
- . /lib/lsb/init-functions
- RAILS_ENV=production
- CHILIPROJECT_DIR=/srv/chiliproject/chiliproject
- CHILIPROJECT_ADDRESS=localhost
- CHILIPROJECT_PORT=3000
- CHILIPROJECT_USER=chiliproject
- CHILIPROJECT_GROUP=chiliproject
- CHILIPROJECT_PIDFILE=${CHILIPROJECT_DIR}/tmp/pids/server.pid
- case "$1" in
- start)
- log_begin_msg "Starting Chili Project"
- cd "${CHILIPROJECT_DIR}"
- start-stop-daemon --make-pidfile \
- --background \
- --start --quiet \
- --pidfile "${CHILIPROJECT_PIDFILE}" \
- --user "${CHILIPROJECT_USER}" \
- --exec /usr/bin/ruby "${CHILIPROJECT_DIR}"/script/server -- \
- --daemon --environment=${RAILS_ENV} \
- --binding=${CHILIPROJECT_ADDRESS} --port=${CHILIPROJECT_PORT} \
- ${CHILIPROJECT_OPTS}
- log_end_msg $?
- ;;
- restart)
- $0 stop
- sleep 1
- $0 start
- ;;
- stop)
- log_begin_msg "Stopping Chili Project"
- cd "${CHILIPROJECT_DIR}"
- start-stop-daemon --stop --signal INT --quiet --pidfile "${CHILIPROJECT_PIDFILE}"
- log_end_msg $?
- ;;
- *)
- log_success_msg "Usage: /etc/init.d/chiliproject {start|stop|restart}"
- exit 1
- esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement