PHP 8.5.2
Preview: S01uwsgi Size: 4.46 KB
//etc/rc2.d/S01uwsgi

#!/bin/bash
# NB! cannot use POSIX shell: bash snippets are sourced

### BEGIN INIT INFO
# Provides:          uwsgi
# Required-Start:    $local_fs $remote_fs $network
# Required-Stop:     $local_fs $remote_fs $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start/stop uWSGI server instance(s)
# Description:       This script manages uWSGI server instance(s).
#                    You could control specific instance(s) by issuing:
#                    
#                        service uwsgi <command> <confname> <confname> ...
#                    
#                    You can issue to init.d script following commands:
#                      * start        | starts daemon
#                      * stop         | stops daemon
#                      * reload       | sends to daemon SIGHUP signal
#                      * force-reload | sends to daemon SIGTERM signal
#                      * restart      | issues 'stop', then 'start' commands
#                      * status       | shows status of daemon instance
#                    
#                    'status' command must be issued with exactly one
#                    argument: '<confname>'.
#                    
#                    In init.d script output:
#                      * . -- command was executed without problems or instance
#                             is already in needed state
#                      * ! -- command failed (or executed with some problems)
#                      * ? -- configuration file for this instance isn't found
#                             and this instance is ignored
#                    
#                    For more details see /usr/share/doc/uwsgi/README.Debian.
### END INIT INFO

# Author: Leonid Borisenko <leo.borisenko@gmail.com>

# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="app server(s)"
NAME="uwsgi"
DAEMON="/usr/bin/uwsgi"
SCRIPTNAME="/etc/init.d/${NAME}"

UWSGI_CONFDIR="/etc/uwsgi"
UWSGI_APPS_CONFDIR_SUFFIX="s-enabled"
UWSGI_APPS_CONFDIR_GLOB="${UWSGI_CONFDIR}/app${UWSGI_APPS_CONFDIR_SUFFIX}"

UWSGI_RUNDIR="/run/uwsgi"

# Configuration namespace is used as name of runtime and log subdirectory.
# uWSGI instances sharing the same app configuration directory also shares
# the same runtime and log subdirectory.
#
# When init.d script cannot detect namespace for configuration file, default
# namespace will be used.
UWSGI_DEFAULT_CONFNAMESPACE=app

# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0

# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh

# Read configuration variable file if it is present
[ -r "/etc/default/${NAME}" ] && . "/etc/default/${NAME}"

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions

# Define supplementary functions
. /usr/share/uwsgi/init/snippets
. /usr/share/uwsgi/init/do_command

WHAT=$1
shift
case "$WHAT" in
  start)
    [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
    do_command "$WHAT" "$@"
    RETVAL="$?"
    [ "$VERBOSE" != no ] && log_end_msg "$RETVAL"
  ;;

  stop)
    [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
    do_command "$WHAT" "$@"
    RETVAL="$?"
    [ "$VERBOSE" != no ] && log_end_msg "$RETVAL"
  ;;

  status)
    if [ -z "$1" ]; then
      [ "$VERBOSE" != no ] && log_failure_msg "which one?"
    else
      PIDFILE="$(
        find_specific_pidfile "$(relative_path_to_conffile_with_spec "$1")"
      )"
      status_of_proc -p "$PIDFILE" "$DAEMON" "$NAME" \
        && exit 0 \
        || exit $?
    fi
  ;;

  reload)
    [ "$VERBOSE" != no ] && log_daemon_msg "Reloading $DESC" "$NAME"
    do_command "$WHAT" "$@"
    RETVAL="$?"
    [ "$VERBOSE" != no ] && log_end_msg "$RETVAL"
  ;;

  force-reload)
    [ "$VERBOSE" != no ] && log_daemon_msg "Forced reloading $DESC" "$NAME"
    do_command "$WHAT" "$@"
    RETVAL="$?"
    [ "$VERBOSE" != no ] && log_end_msg "$RETVAL"
  ;;

  restart)
    [ "$VERBOSE" != no ] && log_daemon_msg "Restarting $DESC" "$NAME"
    CURRENT_VERBOSE=$VERBOSE
    VERBOSE=no
    do_command stop "$@"
    VERBOSE=$CURRENT_VERBOSE
    case "$?" in
      0)
        do_command start "$@"
        RETVAL="$?"
        [ "$VERBOSE" != no ] && log_end_msg "$RETVAL"
      ;;
      *)
        # Failed to stop
        [ "$VERBOSE" != no ] && log_end_msg 1
      ;;
    esac
  ;;

  *)
    echo "Usage: $SCRIPTNAME {start|stop|status|restart|reload|force-reload}" >&2
    exit 3
  ;;
esac

Directory Contents

Dirs: 0 × Files: 33

Name Size Perms Modified Actions
2.22 KB lrwxr-xr-x 2025-07-08 14:50:50
Edit Download
1.85 KB lrwxr-xr-x 2023-11-14 20:02:33
Edit Download
1.21 KB lrwxr-xr-x 2024-02-26 12:58:31
Edit Download
3.03 KB lrwxr-xr-x 2024-02-27 02:22:50
Edit Download
3.08 KB lrwxr-xr-x 2023-12-05 15:36:45
Edit Download
2.15 KB lrwxr-xr-x 2016-10-23 23:10:58
Edit Download
6.85 KB lrwxr-xr-x 2024-06-10 21:27:45
Edit Download
985 B lrwxr-xr-x 2025-03-17 11:36:12
Edit Download
3.40 KB lrwxr-xr-x 2024-04-01 06:55:32
Edit Download
6.27 KB lrwxr-xr-x 2025-12-04 10:46:13
Edit Download
4.47 KB lrwxr-xr-x 2025-04-28 07:08:08
Edit Download
1.80 KB lrwxr-xr-x 2025-09-05 13:01:22
Edit Download
4.19 KB lrwxr-xr-x 2025-07-22 07:08:08
Edit Download
4.19 KB lrwxr-xr-x 2025-07-22 07:08:08
Edit Download
4.19 KB lrwxr-xr-x 2025-07-22 07:08:08
Edit Download
4.19 KB lrwxr-xr-x 2025-07-22 07:08:08
Edit Download
4.19 KB lrwxr-xr-x 2025-07-22 07:08:08
Edit Download
4.19 KB lrwxr-xr-x 2025-12-30 07:08:08
Edit Download
4.19 KB lrwxr-xr-x 2025-12-30 07:08:08
Edit Download
4.19 KB lrwxr-xr-x 2026-01-22 07:08:08
Edit Download
4.19 KB lrwxr-xr-x 2026-01-22 07:08:08
Edit Download
4.19 KB lrwxr-xr-x 2026-01-22 07:08:08
Edit Download
1.35 KB lrwxr-xr-x 2024-03-21 13:42:02
Edit Download
3.02 KB lrwxr-xr-x 2024-03-05 15:20:59
Edit Download
5.20 KB lrwxr-xr-x 2024-05-09 07:08:08
Edit Download
3.04 KB lrwxr-xr-x 2025-07-30 19:03:47
Edit Download
1.57 KB lrwxr-xr-x 2024-01-09 13:42:30
Edit Download
4.31 KB lrwxr-xr-x 2024-04-12 17:09:41
Edit Download
3.96 KB lrwxr-xr-x 2025-07-21 15:58:50
Edit Download
1.54 KB lrwxr-xr-x 2024-01-09 20:31:44
Edit Download
1.36 KB lrwxr-xr-x 2024-02-12 17:50:35
Edit Download
1.28 KB lrwxr-xr-x 2024-04-09 14:02:37
Edit Download
4.46 KB lrwxr-xr-x 2023-11-25 12:25:37
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).