Service starting failed - Failed to start SYSV - linux

My objective is to start a personal daemon called gobatch. gobatch is stored into /usr/sbin/gobatch (during gobatch is just an infinite loop).
When I use /etc/init.d/gobatch start I got this error:
janv. 08 14:39:03 ubuntu systemd[1]: Failed to start SYSV: ChilliSpot is an open source captive portal.
/usr/sbin/gobatch
#! /bin/bash
while true;
do
done
/etc/init.d/gobatch:
#!/bin/sh
#### BEGIN INIT INFO
# Provides: chillispot et freeradius dans le chroot
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $remote_fs _
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Wireless & LAN Access Point Controller
# Description: ChilliSpot is an open source captive portal
# or wireless LAN access point controller.
### END INIT INFO
PATH=/bin:/usr/bin:/sbin:/usr/sbin
DESC="Deamon that allows you to run cyclicaly at a date or a specific time a program"
NAME=gobatch
DEAMON=/usr/sbin/gobatch
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/"$NAME"
. /lib/lsb/init-functions
case "$1" in
start) log_daemon_msg "Starting gobatch"
start_daemon -p $PIDFILE $DAEMON
log_end_msg $?
;;
stop) log_daemon_msg "Stopping gobatch"
killproc -p $PIDFILE $DAEMON
RETVAL=$?
[ $RETVAL -eq 0 ] && [ -e "$PIDFILE" ] && rm -f $PIDFILE
log_end_msg $RETVAL
;;
restart) log_daemon_msg "Restarting gobatch"
$0 stop
$0 start
;;
esac
exit 0
Can you help me to fix this problem?
Thank's a lot!

Related

Varnish won't start as a daemon

Varnish fails to start using:
service varnish start
without any errors, but runs fine when I do:
varnishd -f /etc/varnish/user.vcl -s malloc,1G -T localhost:6082 -a 0.0.0.0:6081 -d
This is /etc/default/varnish:
START=yes
NFILES=131072
MEMLOCK=82000
DAEMON_OPTS="-a 0.0.0.0:6081 \
-T localhost:6082 \
-f /etc/varnish/user.vcl \
-S /etc/varnish/secret \
-s malloc,1024m"
I'm on Ubuntu 16.04. Any thoughts?
Update (version, syslog and systemd):
Version:
# varnishd -V
varnishd (varnish-4.1.1 revision 66bb824)
Copyright (c) 2006 Verdens Gang AS
Copyright (c) 2006-2015 Varnish Software AS
This is syslog:
Nov 30 14:16:46 **** systemd[1]: Started Varnish HTTP accelerator.
Nov 30 14:16:46 **** varnishd[28089]: Error: Cannot open socket: :6081: Address family not supported by protocol
Nov 30 14:16:46 **** systemd[1]: varnish.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Nov 30 14:16:46 **** systemd[1]: varnish.service: Unit entered failed state.
Nov 30 14:16:46 **** systemd[1]: varnish.service: Failed with result 'exit-code'.
/etc/init.d/varnish:
#! /bin/sh
### BEGIN INIT INFO
# Provides: varnish
# 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 HTTP accelerator
# Description: This script provides a server-side cache
# to be run in front of a httpd and should
# listen on port 80 on a properly configured
# system
### END INIT INFO
# Source function library
. /lib/lsb/init-functions
NAME=varnishd
DESC="HTTP accelerator"
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/varnishd
PIDFILE=/run/$NAME.pid
test -x $DAEMON || exit 0
# Include varnish defaults if available
if [ -f /etc/default/varnish ] ; then
. /etc/default/varnish
fi
# Open files (usually 1024, which is way too small for varnish)
ulimit -n ${NFILES:-131072}
# Maxiumum locked memory size for shared memory log
ulimit -l ${MEMLOCK:-82000}
# If $DAEMON_OPTS is not set at all in /etc/default/varnish, use minimal useful
# defaults (Backend at localhost:8080, a common place to put a locally
# installed application server.)
DAEMON_OPTS=${DAEMON_OPTS:--b localhost}
# Ensure we have a PATH
export PATH="${PATH:+$PATH:}/usr/sbin:/usr/bin:/sbin:/bin"
start_varnishd() {
log_daemon_msg "Starting $DESC" "$NAME"
output=$(/bin/tempfile -s.varnish)
if start-stop-daemon \
--start --quiet --pidfile ${PIDFILE} --exec ${DAEMON} -- \
-P ${PIDFILE} ${DAEMON_OPTS} > ${output} 2>&1; then
log_end_msg 0
else
log_end_msg 1
cat $output
exit 1
fi
rm $output
}
disabled_varnishd() {
log_daemon_msg "Not starting $DESC" "$NAME"
log_progress_msg "disabled in /etc/default/varnish"
log_end_msg 0
}
stop_varnishd() {
log_daemon_msg "Stopping $DESC" "$NAME"
if start-stop-daemon \
--stop --quiet --pidfile $PIDFILE --retry 10 \
--exec $DAEMON; then
log_end_msg 0
else
log_end_msg 1
fi
if test -r $PIDFILE; then
read -r PID < $PIDFILE
if test ! -d /proc/$PID ; then
# stale pidfile
unset PID
rm -f $PIDFILE
fi
fi
}
reload_varnishd() {
log_daemon_msg "Reloading $DESC" "$NAME"
if /usr/share/varnish/reload-vcl -q; then
log_end_msg 0
else
log_end_msg 1
fi
}
status_varnishd() {
start-stop-daemon \
--status --quiet --pidfile $PIDFILE \
--exec $DAEMON
exit $?
}
configtest() {
$DAEMON ${DAEMON_OPTS} -C -n /tmp > /dev/null
}
case "$1" in
start)
case "${START:-}" in
[Yy]es|[Yy]|1|[Tt]|[Tt]rue)
start_varnishd
;;
*)
disabled_varnishd
;;
esac
;;
stop)
stop_varnishd
;;
reload)
reload_varnishd
;;
status)
status_varnishd
;;
restart|force-reload)
if status_of_proc -p "${PIDFILE}" "${DAEMON}" "${NAME}" 1>/dev/null; then
if ! configtest; then
log_failure_msg "Syntax check failed, not restarting"
exit 1
fi
fi
$0 stop
$0 start
;;
configtest)
configtest && log_success_msg "Syntax ok"
;;
*)
log_success_msg "Usage: $0 {start|stop|restart|reload|force-reload|configtest}"
exit 1
;;
esac
I ran into the exact same issue moving my production environment to a less... ancient Opsworks/Chef stack with Ubuntu.
It turned out that the docs on the Varnish site were not quite complete for Ubuntu 16+, you need a few other command line switches. This is what works for me:
[Service]
ExecStart=
ExecStart=/usr/sbin/varnishd -j unix,user=vcache -F -a :80 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m
The -F switch moves it into the foreground, which I've found helps with systemctl services.
The -j switch enables the Varnish privilege jail (more on that here: https://www.varnish-cache.org/docs/4.1/reference/varnishd.html?highlight=jail#jail).
You're mixing old configuration steps with the new. Ubuntu 16.04 uses Systemd, making /etc/default/varnish and /etc/init.d/varnish files obsolete.
After a lot of searching and running into this issue myself, I found that this tutorial works best and uses best practises:
https://www.cyberciti.biz/faq/how-to-install-and-configure-varnish-cache-on-ubuntu-linux-16-04-lts/
It seems to not like the 0.0.0.0:6081 address for the admin part.
Nov 30 14:16:46 **** varnishd[28089]: Error: Cannot open socket: :6081: Address family not supported by protocol
Change your daemon_opt part to -a :80 in /etc/default/varnish

run jar-file on startup linux

I've used a standard bash-startup script for autostarting my Teamspeak Server - which works perfectly. Now I've done the same for the JTS3 Server Mod, problem: It's a .jar-file and doesn't start. If I run the .jar/startscript manually it works just fine.
Here's the script in /etc/init.d/
#!/bin/bash
### BEGIN INIT INFO
# Provides: jts3servermod
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: JTS3 Server Mod
### END INIT INFO
# INIT Script by www.SysADMINsLife.com
######################################
# Customize values for your needs: "User"; "DIR"
USER="ts"
DIR="/home/ts/JTS3ServerMod"
###### Teamspeak 3 server start/stop script ######
case "$1" in
start)
su $USER -c "${DIR}/jts3servermod_startscript.sh start"
;;
stop)
su $USER -c "${DIR}/jts3servermod_startscript.sh stop"
;;
restart)
su $USER -c "${DIR}/jts3servermod_startscript.sh restart"
;;
status)
su $USER -c "${DIR}/jts3servermod_startscript.sh status"
;;
*)
echo "Usage: {start|stop|restart|status}" >&2
exit 1
;;
esac
exit 0
of course it is linked in the runlevel-folders with update-rc.d jts3servermod defaults.
the servermod startscript (jts3servermod_startscript.sh) is:
#!/bin/sh
# JTS3ServerMod Linux start script
# Created by Stefan "Stefan1200" Martens
# The author of this script is not responsible for any damage or data loss!
JAVA_COMMANDLINE_PARAMETERS="-mx30M" # You can add java arguments here, like the -mx30M argument!
JTS3SERVERMOD_COMMANDLINE_PARAMETERS="" # You can add JTS3ServerMod arguments here, like the -config and -log argument!
BINARYPATH="$(pwd)" # This have to point to the JTS3ServerMod directory!
# Don't change the lines below, if you are not a sh script expert!
cd "${BINARYPATH}"
BINARYNAME="JTS3ServerMod.jar"
ROOTUID="0"
case "$1" in
java)
if which java >/dev/null 2>&1 ; then
echo "Java is already installed:"
java -version
else
if [ "$(id -u)" -ne "$ROOTUID" ] ; then
echo "Start this script as root to start the automatic installation of the Java runtime environment."
echo "You can also read the system requirements of the JTS3ServerMod in the readme.txt file for a manual installation of the Java runtime environment."
exit 6
else
read -p "Do you wish to install the Java runtime environment? (y/n) " yn
case $yn in
[Yy]* ) installJava; break;;
* ) echo "Aborted!"; exit 6;;
esac
fi
fi
;;
start)
if ! which java >/dev/null 2>&1 ; then
echo "The JTS3ServerMod needs the Java runtime environment installed to run!"
echo "Start this script with the java argument as root to start the automatic installation of the Java runtime environment:"
echo "$0 java"
echo "You can also read the system requirements of the JTS3ServerMod in the readme.txt file for a manual installation of the Java runtime environment."
exit 6
fi
if [ "$(id -u)" -eq "$ROOTUID" ] ; then
echo "For security reasons it is prefered not to run the JTS3ServerMod as root!"
fi
if [ -e jts3servermod.pid ]; then
if ( kill -0 $(cat jts3servermod.pid) 2> /dev/null ); then
echo "The JTS3ServerMod is already running, try restart or stop!"
exit 1
else
echo "jts3servermod.pid found, but no JTS3ServerMod running. Possibly your previously started JTS3ServerMod crashed!"
echo "Please view the logfile for details."
rm -f jts3servermod.pid
fi
fi
echo "Starting the JTS3ServerMod..."
if [ -e "$BINARYNAME" ]; then
java ${JAVA_COMMANDLINE_PARAMETERS} -jar ${BINARYNAME} ${JTS3SERVERMOD_COMMANDLINE_PARAMETERS} > /dev/null &
PID=$!
ps -p ${PID} > /dev/null 2>&1
if [ "$?" -ne "0" ]; then
echo "JTS3ServerMod could not start!"
else
echo $PID > jts3servermod.pid
echo "JTS3ServerMod started, for details please view the log file!"
fi
else
echo "Could not find the file $BINARYNAME, aborting!"
exit 5
fi
;;
stop)
if [ -e jts3servermod.pid ]; then
echo -n "Stopping the JTS3ServerMod.."
if ( kill -TERM $(cat jts3servermod.pid) 2> /dev/null ); then
c=1
while [ "$c" -le 120 ]; do
if ( kill -0 $(cat jts3servermod.pid) 2> /dev/null ); then
echo -n "."
sleep 1
else
break
fi
c=$(($c+1))
done
fi
if ( kill -0 $(cat jts3servermod.pid) 2> /dev/null ); then
echo "JTS3ServerMod is not shutting down cleanly - killing!"
kill -KILL $(cat jts3servermod.pid)
else
echo "done"
fi
rm -f jts3servermod.pid
else
echo "No JTS3ServerMod running (jts3servermod.pid is missing)!"
exit 7
fi
;;
restart)
$0 stop && $0 start || exit 1
;;
status)
if [ -e jts3servermod.pid ]; then
if ( kill -0 $(cat jts3servermod.pid) 2> /dev/null ); then
echo "JTS3ServerMod is running!"
else
echo "JTS3ServerMod seems to have died!"
fi
else
echo "No JTS3ServerMod running (jts3servermod.pid is missing)!"
fi
;;
*)
echo "Usage: ${0} {start|stop|restart|status|java}"
exit 2
esac
exit 0
I also tried to write an own simple script for only starting the jar and catching the pid and writing it into a file.
None of these scripts wanted to start my .jar file during the startup.
As you can see, the first script is a template for starting Teamspeak Servers during boot. I only replaced some stuff with my Server Mod paths and scripts and put into /etc/init.d/ (chmod 755 was executed of course).
Maybe some of you have other approaches to solve that strange circumstances.
I don't know if the problem was solved in the meantime, but while experimenting with the same issue. I figured out that the script could not find the jar file. So I added:
#!/bin/sh
# JTS3ServerMod Linux start script
# Created by Stefan "Stefan1200" Martens
# The author of this script is not responsible for any damage or data loss!
cd "$(dirname "$0")"
...
At the beginning of the jts3servermod_startscript.sh to ensure that the "working directory" is correct.
BTW - My init script:
jts-bot
#!/bin/sh
### BEGIN INIT INFO
# Provides: jts-bot
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: JTS3-Bot for TeamSpeak
### END INIT INFO
USER="teamspeak"
DIR="/home/teamspeak/JTS3ServerMod"
###### JTS3ServerMod start/stop script ######
case "$1" in
start)
su $USER -c "${DIR}/jts3servermod_startscript.sh start"
;;
stop)
su $USER -c "${DIR}/jts3servermod_startscript.sh stop"
;;
restart)
su $USER -c "${DIR}/jts3servermod_startscript.sh restart"
;;
status)
su $USER -c "${DIR}/jts3servermod_startscript.sh status"
;;
*)
echo "Usage: -bash {start|stop|restart|status}" >&2
exit 1
;;
esac
exit 0

Can't resart liquidsoap without killing process manually

I am currently running Liquidsoap on Ubuntu 14.4, streaming to Icecast, hosted on the same box.
My setup is running correctly, however when running sudo service liquidsoap restart, I get the following error:
fatal error exception unix.unix_error(50, "bind", "" )
In order to restart liquid soap, I need to kill the process or reboot.
It then runs correctly. Until I need to restart for whatever reason.
As a side note, liquidsoap created a user and group called liquidsoap, however I am running sudo commands via another user I created.
Does anyone have any ideas?
Fixed by enabling pid file creation.
Copy of my init.d - https://gist.github.com/anonymous/d7e232fc280d2fe1df56
#!/bin/sh
### BEGIN INIT INFO
# Provides: liquidsoap
# Required-Start: $remote_fs $network $time
# Required-Stop: $remote_fs $network $time
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts the liquidsoap daemon
# Description:
### END INIT INFO
user=liquidsoap
group=liquidsoap
prefix=/usr
exec_prefix=${prefix}
confdir=/etc/liquidsoap
liquidsoap=${exec_prefix}/bin/liquidsoap
rundir=/var/run/liquidsoap
# Test if $rundir exists
if [ ! -d $rundir ]; then
mkdir -p $rundir;
chown $user:$group $rundir
fi
case "$1" in
stop)
echo -n "Stopping liquidsoap channels: "
cd $rundir
has_channels=
for liq in *.pid ; do
if test $liq != '*.pid' ; then
has_channels=1
echo -n "$liq "
start-stop-daemon --stop --quiet --pidfile $liq --retry 4
fi
done
if test -n "$has_channels"; then
echo "OK"
else
echo "no script found in $confdir"
fi
;;
start)
echo -n "Starting liquidsoap channels: "
cd $confdir
has_channels=
for liq in *.liq ; do
if test $liq != '*.liq' ; then
has_channels=1
echo -n "$liq "
start-stop-daemon --start --quiet --pidfile $rundir/${liq%.liq}.pid \
--chuid $user:$group --exec $liquidsoap -- -d $confdir/$liq
fi
done
if test -n "$has_channels"; then
echo "OK"
else
echo "no script found in $confdir"
fi
;;
restart|force-reload)
$0 stop
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart|force-reload}"
exit 1
;;
esac
None of mentioned solutions solved my issue. I had to fix it recently by setting proper ownership and permissions right after starting daemons. After killing the processes and restarting, further restarts work fine.
start-stop-daemon --start --quiet --pidfile $rundir/${liq%.liq}.pid \
--chuid $user:$group --exec $liquidsoap -- -d $confdir/$liq && sleep 1 && chmod 600 $rundir/${liq%.liq}.pid && chown root:root $rundir/${liq%.liq}.pid

script doesn't start on boot with init

I have the following script
#!/bin/sh
# chkconfig: 345 99 01
# description: some startup script
### BEGIN INIT INFO
# Provides: weblogic
# Required-Start: $local_fs $network $remote_fs
# Required-Stop: $local_fs $network $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start and stop OurDB
# Description: OurDB is a very fast and reliable database
# engine used for illustrating init scripts
### END INIT INFO
. /etc/rc.d/init.d/function
service=startWebLogic.sh
user=*******
password=******
dbschemaname=******
hostname=*******
port=********
weblogic_start()
{
pgrep -f startWebLogic.sh > /dev/null
if ! [ $? -eq 0 ]; then
echo "exit" | sqlplus -L "$user/$password#(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=$hostname)(Port=$port))(CONNECT_DATA=(SID=$dbschemaname)))" | grep "Connected to" > /dev/null
if [ $? -eq 0 ]; then
/home/usr/Oracle/Middleware/Oracle_Home/user_projects/domains/bin/startWebLogic.sh &
else
echo "WARNING! No connection to the Oracle Server" | mail -s OracleServerDown monitoring#accedia.com
fi
else
echo "WARNING! Running WebLogic service was found!" | mail -s "Service Already Running" monitoring#example.com
fi
}
weblogic_stop()
{
pgrep -f startWebLogic.sh > /dev/null
if [ $? -eq 0 ]; then
/home/usr/Oracle/Middleware/Oracle_Home/user_projects/domains/Econt/bin/stopWebLogic.sh & pid=$! ; sleep 5m; pkill -TERM -P $pid
ps -ef| grep $pid
if [ $? -ne 0 ];then
pkill -TERM -P $pid
fi
pid=`ps -ejH|grep "startWebLogic" | grep -iv "grep" | awk '{print $1}'`
pkill -TERM -P $pid
else
echo "WARNING! No running WebLogic service was found" | mail -s "WebLogic Not Found" monitoring#example.com
fi
}
case $1 in
start)
weblogic_start
;;
stop)
weblogic_stop
;;
*) echo "Invalid input"
;;
esac
I've put it properly in init.d and stuff, chmod-ed it properly , put it in rc.local and yet again it doesn't want to start on boot, though if i run it manually , passing an argument to it ,e.g. "service weblogic start" it works fine , both as root and not. Anyone has any suggestions why is it acting like this and is there any solution to it ?
You don't need to put it in init.d and rc.local both places. One is enough.
You may try this after you put it in init.d:
For Debian based OS:
sudo update-rc.d script_name defaults
For CentOS:
chkconfig --add myscript
Found a solution, the problem was with the priorites , I have changed the chkconfig options to 345 98 10 from 345 99 01.

Linux: process into a service

I am trying to make a linux executable as a service
I execute my program like this below
java -jar mytestprogram.jar
creates a process that runs continuously and serves REST requests. But I want to run it as a service where I can do
service mytestprogram start
service mytestprogram stop
service mytestprogram status
chkconfig mytestprogram on
etc. What is the most simple way of doing it?
That depends on your system manager
the most common way to do that on debian/ubuntu is to build an initscript and place it in /etc/init.d or /etc/rc/init.d and place a script named mytestprogram in that.
this is an example initscript:
#!/bin/sh
### BEGIN INIT INFO
# Provides: testone
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# X-Interactive: false
# Short-Description: Example init script
# Description: Start/stop an example script
### END INIT INFO
DESC="test script"
NAME=testone
#DAEMON=
do_start()
{
echo "starting!";
}
do_stop()
{
echo "stopping!"
}
case "$1" in
start)
do_start
;;
stop)
do_stop
;;
esac
exit 0
I suggest you to look some scripts in that directory, It's simple if you know bash a little ;)
Here is a sample shell script (make sure you replace the MAT name with the name of the your application):
I create one GitHubGist with the latest version of my script and a brief explanation to help those who need it. GitHub Gist link
#!/bin/bash
### BEGIN INIT INFO
# Provides: MATH
# Required-Start: $java
# Required-Stop: $java
# Short-Description: Start and stop MATH service.
# Description: -
# Date-Creation: -
# Date-Last-Modification: -
# Author: -
### END INIT INFO
# Variables
PGREP=/usr/bin/pgrep
JAVA=/usr/bin/java
ZERO=0
# Start the MATH
start() {
echo "Starting MATH..."
#Verify if the service is running
$PGREP -f MATH > /dev/null
VERIFIER=$?
if [ $ZERO = $VERIFIER ]
then
echo "The service is already running"
else
#Run the jar file MATH service
$JAVA -jar /opt/MATH/MATH.jar > /dev/null 2>&1 &
#sleep time before the service verification
sleep 10
#Verify if the service is running
$PGREP -f MATH > /dev/null
VERIFIER=$?
if [ $ZERO = $VERIFIER ]
then
echo "Service was successfully started"
else
echo "Failed to start service"
fi
fi
echo
}
# Stop the MATH
stop() {
echo "Stopping MATH..."
#Verify if the service is running
$PGREP -f MATH > /dev/null
VERIFIER=$?
if [ $ZERO = $VERIFIER ]
then
#Kill the pid of java with the service name
kill -9 $($PGREP -f MATH)
#Sleep time before the service verification
sleep 10
#Verify if the service is running
$PGREP -f MATH > /dev/null
VERIFIER=$?
if [ $ZERO = $VERIFIER ]
then
echo "Failed to stop service"
else
echo "Service was successfully stopped"
fi
else
echo "The service is already stopped"
fi
echo
}
# Verify the status of MATH
status() {
echo "Checking status of MATH..."
#Verify if the service is running
$PGREP -f MATH > /dev/null
VERIFIER=$?
if [ $ZERO = $VERIFIER ]
then
echo "Service is running"
else
echo "Service is stopped"
fi
echo
}
# Main logic
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
restart|reload)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|status|restart|reload}"
exit 1
esac
exit 0
In Ubuntu you can create the file as explained above with few lines, play around and see if it works for you.
description "My prog"
start on (net-device-up
and local-filesystems
and runlevel [2345])
stop on runlevel [!2345]
respawn
respawn limit 10 5
setuid root
setgid shnmon
script
/usr/local/bin/my_script -config.path /etc/myprog/yourconfig.xyz -children false >> /var/log/myprog.log 2>&1
end script
The "-config.path /etc/myprog/yourconfig.xyz" is optional incase you have a config file.
You can just edit the script part and test it and keep others default and edit the rest along the way

Resources