Hi,
I've got a special user which owns the tdps "setup". Here's the /etc/init.d/tdps startscript I'm using to autostart the server:
- Code: Select all
#! /bin/sh
### BEGIN INIT INFO
# Provides: TeamDrive Personal Server
# Required-Start: networking
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: S 0 1 6
# Short-Description: TeamDrive Personal Server Daemon
# Description: Starts/Stops/Restarts the TeamDrive Personal Server Daemon
### END INIT INFO
#
#
###############################################################################
# Version History / Change Log:
###############################################################################
#
# 2011-02-16 St. Fu. CREATE: Create new script to support
# TD service autorun under Ubuntu/Debian
# Tested with i386 and AMD64 Linux
# Script is under GPLv2
# 2013-07-30 St. Fu. UPDATE: Support for new Version
#
#
################################################################################
set -e
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="TeamDrive 1.1.058 Server Linux"
NAME=tdpsd
USER=setup
DIR=/home/setup/tdps
DAEMON=$DIR/tdpsd
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
# Export necessary for starting...
export LD_LIBRARY_PATH="$DIR:$LD_LIBRARY_PATH"
# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0
d_start() {
start-stop-daemon --start --quiet \
--background \
--chuid $USER \
--chdir $DIR \
--exec $DAEMON \
> /dev/null \
|| echo -n " already running"
}
d_stop() {
start-stop-daemon --stop --quiet \
--chuid $USER \
--chdir $DIR \
--exec $DAEMON \
|| echo -n " not running"
}
case "$1" in
start)
echo -n "Starting $DESC: $NAME"
d_start
echo "."
;;
stop)
echo -n "Stopping $DESC: $NAME"
d_stop
echo "."
;;
restart|force-reload)
echo -n "Restarting $DESC: $NAME"
d_stop
sleep 15
d_start
echo "."
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 3
;;
esac
exit 0
Please edit the variables to fit your needs and put it into the wanted runlevels.
Regards, Spacey