Sample Header Ad - 728x90

Run two scripts with init.d

1 vote
1 answer
567 views
I have a start script for TeamSpeak3 server in /etc/init.d that is run at the boot time.
#! /bin/sh
### BEGIN INIT INFO
# Provides:          ts3
# Required-Start:    $network mysql
# Required-Stop:     $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: TeamSpeak3 Server Daemon
# Description:       Starts/Stops/Restarts the TeamSpeak Server Daemon
### END INIT INFO

set -e

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="TeamSpeak3 Server"
NAME=teamspeak3-server
USER=teamspeak3
DIR=/opt/teamspeak3-server
OPTIONS=inifile=ts3server.ini
DAEMON=$DIR/ts3server_startscript.sh
#PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0

sleep 2
sudo -u $USER $DAEMON $1 $OPTIONS
And I need this to happen: 1. Run a script ./MyScript that exits immediately and is located in TS3 directory 2. Wait some time 3. Run the actual daemon that will stay running I am not really good with Unix scripting, I just need to run a server with this. I might also mention that I am running latest Ubuntu. Thanks for help, krejcar25
Asked by Amélie KrejĨí (113 rep)
Nov 29, 2016, 09:59 PM
Last activity: Nov 30, 2016, 07:01 AM