Advertising
- Unnamed
- Sunday, December 30th, 2012 at 8:23:01pm UTC
- #!/bin/bash
- #
- ### BEGIN INIT INFO
- # Provides: 4store
- # Required-Start: $remote_fs
- # Required-Stop: $remote_fs
- # Should-Start: $network $syslog avahi
- # Should-Stop: $network $syslog avahi
- # Default-Start: 2 3 4 5
- # Default-Stop: 0 1 6
- # Short-Description: Start and stop the 4store database server daemon
- # Description: Controls the 4store database server daemon "4s-httpd"
- ### END INIT INFO
- #
- set -e
- set -u
- ${DEBIAN_SCRIPT_DEBUG:+ set -v -x}
- DAEMON1=/usr/bin/4s-backend
- DAEMON2=/usr/bin/4s-httpd
- test -x $DAEMON1 || exit 5
- test -x $DAEMON2 || exit 5
- # Knowledge base
- KB="$2"
- # Default user
- USER=fourstore
- if [ -r /etc/default/4store ]; then
- . /etc/default/4store
- fi
- . /lib/lsb/init-functions
- # Safeguard (relative paths, core dumps..)
- cd /
- umask 077
- case "$1" in
- start)
- mkdir -p -m 0755 /var/lib/4store /var/log/4store
- # Refresh ownership, avoiding "chown -R" hardlink attacks
- find /var/lib/4store /var/log/4store \( -type d -links 2 \) -or \( -type f -links 1 \) -execdir chown "$USER": {} +
- log_daemon_msg "Starting 4s-backend" "4s-backend" "$KB"
- start-stop-daemon --start --chuid $USER --quiet --oknodo --name 4s-backend --startas $DAEMON1 -- $KB
- status=$?
- log_end_msg $status
- log_daemon_msg "Starting 4s-httpd" "4s-httpd" "$KB"
- start-stop-daemon --start --chuid $USER --quiet --oknodo --name 4s-httpd --startas $DAEMON2 -- $KB
- status=$?
- log_end_msg $status
- ;;
- stop)
- log_daemon_msg "Stopping 4s-httpd" "4s-httpd"
- start-stop-daemon --stop --quiet --oknodo --name 4s-backend -- $KB
- log_end_msg $?
- log_daemon_msg "Stopping 4s-backend" "4s-backend"
- start-stop-daemon --stop --quiet --oknodo --name 4s-httpd -- $KB
- log_end_msg $?
- ;;
- restart|force-reload)
- $0 stop && sleep 2 && $0 start
- ;;
- try-restart)
- if $0 status >/dev/null; then
- $0 restart
- else
- exit 0
- fi
- ;;
- reload)
- exit 3
- ;;
- status)
- status_of_proc $DAEMON1 "4s-backend server" "$KB"
- ;;
- *)
- echo "Usage: $0 {start|stop|restart|try-restart|force-reload|status}"
- exit 2
- ;;
- esac
- exit 0
advertising
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will not expire by default. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.