• Home (current)
  • वर्तमान निदेशक => /usr/sbin/
  • सूचना एवं अपलोड
    Info Server
Indian Cyber Force
Folders रचयन्तु सञ्चिकां रचयन्तु RansomWeb लॉगआउट
Current File : //usr/sbin/mk-runscript
#!/bin/sh
# runscript --- manage runscripts that are not part of debian package

# Copyright (C) 2016 Dmitry Bogatov <KAction@gnu.org>

# Author: Dmitry Bogatov <KAction@gnu.org>

# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
set -eu
COLOR_RED=$(tput setaf 1)
COLOR_YELLOW=$(tput setaf 3)
COLOR_BLUE=$(tput setaf 4)
COLOR_BOLD=$(tput bold)
COLOR_RESET=$(tput sgr0)

check_svdir () {
	if [ -z "${SVDIR:-}" ] ; then
		if [ $(id -u) -eq 0 ] ; then
			SVDIR=/etc/service
		else
			SVDIR=$HOME/.service
		fi
		info "SVDIR is not set. Using default value $SVDIR".
	fi
	[ -d "$SVDIR" ] || error "SVDIR=$SVDIR: no such directory"
	[ -w "$SVDIR" ] || error "SVDIR=$SVDIR: permission denied"
}

info () { echo "${COLOR_BOLD}${COLOR_BLUE}info:${COLOR_RESET}" "$@"; }
error() { echo "${COLOR_BOLD}${COLOR_RED}error:${COLOR_RESET}" "$@"; exit 1; }

help () {
	cat <<'EOF'
Usage: runscript [--add|--remove] TYPE [ARGS]

Add or remove runscript of specified type into SVDIR. Currently
supported types are:

 * unprivileged: create runscript, that creates runit instance,
   that supervise services in non-root user's private ~/.service
   directory. The only argument is username.
EOF
}

case "${1:--invalid}" in
	--add)
		action=add
		;;
	--remove)
		action=remove
		;;
	--help)
		help
		exit 0
		;;
	*)
		help
		exit 1
		;;
esac
shift

check_svdir

[ -n "${1:-}" ] || error "runscript type is not specified. Try --help."
case "$1" in
	unprivileged)
		DOTS=$(seq 40|paste -s|sed 's/././g')
		CFG_USER=${2:-}
		[ -n "$CFG_USER" ] || error "missing argument USERNAME"
		if ! getent passwd "$CFG_USER" >/dev/null ; then
			error "unknown user \`$CFG_USER'"
		fi
		CFG_HOME=$(getent passwd "$CFG_USER"|cut -d: -f6)
		SV_NAME="unprivileged.$CFG_USER"
		case "$action" in
			add)
				mkdir -p "$SVDIR/$SV_NAME/control"
				cat <<EOF > "$SVDIR/$SV_NAME/run"
#!/bin/sh
exec 2>&1
export USER='$CFG_USER'
export HOME='$CFG_HOME'
exec chpst -u '$CFG_USER' runsvdir -P '$CFG_HOME/.service' '$DOTS'
EOF
                                cat << EOF > "$SVDIR/$SV_NAME/control/t"
#!/bin/sh
exec sv -v hup .
EOF
				chmod +x "$SVDIR/$SV_NAME/run"
				chmod +x "$SVDIR/$SV_NAME/control/t"
				;;
			remove)
				rm -r "${SVDIR:?}/$SV_NAME"
				;;
		esac
		;;
esac
gorilla – Verilere bak
Menu
  • Top 10

Verilere bak

Follow us
  • facebook
  • twitter
Search
Login
Create
Menu

Verilere bak

Login

You are here:

  1. Home
  2. Tag Archives: gorilla

gorilla

Latest stories

Can You Get Through These 12 Sexy Photos Without Saying WOW? (Open list)

  • facebook
  • twitter

Arşivler

Kategoriler

Disclaimer

This demo site is only for demonstration purposes. All images are copyrighted to their respective owners. All content cited is derived from their respective sources.

© 2017 bring the pixel. Remember to change this

  • Home
  • Contact us
Back to Top
Close
  • Top 10
  • Home
  • Animals
  • Funny
  • WOW
  • WTF
  • Features
  • facebook
  • twitter
Create

Log In

Sign In

Forgot password?

Forgot password?

Enter your account data and we will send you a link to reset your password.

Back to Login

Your password reset link appears to be invalid or expired.

Log in

Privacy Policy

Accept

Add to Collection

  • Public collection title

  • Private collection title

No Collections

Here you'll find all collections you've created before.

Hey Friend!
Before You Go…

Get the best viral stories straight into your inbox before everyone else!

Don't worry, we don't spam

Close

Newsletter

Don’t miss out on new posts!

Don't worry, we don't spam

Close