File: init.d

package info (click to toggle)
sphinxsearch 2.8.2-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 23,028 kB
  • sloc: cpp: 129,264; xml: 78,187; ansic: 9,422; sh: 8,843; php: 3,710; yacc: 2,300; java: 1,334; ruby: 1,287; python: 1,253; pascal: 1,111; lex: 291; makefile: 186; perl: 150; sql: 77; cs: 38
file content (41 lines) | stat: -rw-r--r-- 1,302 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/sh /lib/init/init-d-script
### BEGIN INIT INFO
# Provides:          sphinxsearch
# Required-Start:    $local_fs $remote_fs $syslog $network $time
# Required-Stop:     $local_fs $remote_fs $syslog $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Fast standalone full-text SQL search engine
### END INIT INFO

DAEMON=/usr/bin/searchd
NAME=sphinxsearch
PIDFILE=/run/sphinxsearch/searchd.pid

START_ARGS="--chuid sphinxsearch"
STOP_ARGS="--user sphinxsearch"

do_start_prepare() {
        if [ "$START" != "yes" ]; then
          echo "To enable $NAME, edit /etc/default/sphinxsearch and set START=yes"
          exit 0
        fi

        # Check if we have the configuration file
        if [ ! -f /etc/sphinxsearch/sphinx.conf ]; then
            echo "\n"
            echo "Please create an /etc/sphinxsearch/sphinx.conf configuration file."
            echo "A template is provided as /etc/sphinxsearch/sphinx.conf.sample."
            exit 1
        fi

        # Make sure the pidfile directory exists with correct permissions
        piddir=$(dirname "$PIDFILE")
        if [ ! -d "$piddir" ]; then
            mkdir -p "$piddir"
            chown -R sphinxsearch "$piddir"
            chgrp -R sphinxsearch "$piddir"
        fi
}

# vim: set syntax=sh: