создал юзера и группу.
mkdir /home/aceproxy/user
nano /home/aceuser.sh
Код: Выделить всё
#! /bin/sh
set -e
USER='aceproxy'
GROUP='aceproxy'
addgroup --quiet --system $GROUP || true
adduser --system --home /home/aceproxy/user --shell /bin/false \
--gecos "ACE Proxy user" --no-create-home \
--disabled-login --disabled-password \
--ingroup $GROUP $USER > /dev/null 2>&1 || true
chown -R $USER:$GROUP /home/aceproxy/user
chmod +x /home/aceuser.sh
/home/aceuser.sh
Шаг2
установил vlc-nox (это пакет собранный без Х-ов)
apt-get install vlc-nox
Шаг3
Запуск
sudo -u aceproxy cvlc --ttl 12 -d -I telnet --clock-jitter 0 --network-caching 5000 --sout-mux-caching 5000 --telnet-password admin
Для запуска в режиме автостарт)))
*-caching ставьте по вкусу.
Шаг4
nano /etc/init.d/vlcd
Код: Выделить всё
#! /bin/sh
### BEGIN INIT INFO
# Provides: vlcd
# Required-Start: $syslog $network
# Required-Stop: $syslog $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: VLC daemon
# Description: vlc-nox daemon
### END INIT INFO
# Author: asavah
# Do NOT "set -e"
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="VLC daemon"
NAME=vlcd
DAEMON=/usr/bin/vlc
SCRIPTNAME=/etc/init.d/$NAME
LOGFILE=/var/log/$NAME.log
PIDFILE=/var/run/$NAME.pid
# Daemon options
DAEMON_ARGS="-d --pidfile $PIDFILE --intf=telnet --telnet-password=admin --clock-jitter=0 --network-caching=1000 --sout-mux-caching=1000"
# + Logging options
DAEMON_ARGS="$DAEMON_ARGS --file-logging --logmode=text --logfile=$LOGFILE"
USER=aceproxy
GROUP=aceproxy
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
# and status_of_proc is working.
. /lib/lsb/init-functions
do_start()
{
start-stop-daemon --start --quiet --oknodo --exec $DAEMON --group $GROUP --chuid $USER --startas /usr/bin/cvlc --pidfile $PIDFILE --test > /dev/null 2>&1 \
|| return 1
start-stop-daemon --start --quiet --oknodo --exec $DAEMON --group $GROUP --chuid $USER --startas /usr/bin/cvlc --pidfile $PIDFILE -- \
$DAEMON_ARGS > /dev/null 2>&1 \
|| return 2
}
do_stop()
{
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
start-stop-daemon --stop --quiet --exec $DAEMON -R 2 --oknodo --pidfile $PIDFILE
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
return "$RETVAL"
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
status)
status_of_proc -p "$PIDFILE" "$DAEMON" "$NAME" && exit 0 || exit $?
;;
# reload|force-reload)
# log_daemon_msg "Reloading $DESC" "$NAME"
# do_reload
# log_end_msg $?
# ;;
restart|force-reload)
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0|1)
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac
:
chmod +x /etc/init.d/vlcd
/etc/init.d/vlcd