./service.sh starting issues for couch potato and headphones

Couchpotato and headphones both no starting after resetting drobo 5n. below is the code for both.

#!/bin/sh

CouchPotato service

PATH=$PATH:/bin:/usr/bin:/sbin:/usr/sbin:/mnt/DroboFS/Shares/DroboApps/git/bin
. /etc/service.subr

prog_dir=dirname \realpath $0``

name=“CouchPotato”
version=“2”

python=$DROBOAPPS_DIR/python2/bin/python
pidfile="${prog_dir}/var/couchpotato.pid"
logfile="${prog_dir}/data/logs/CouchPotato.log"
user=root

create_user() {
grep -q “^${user}” /etc/passwd 1> /dev/null 2>&1
if [ $? -ne 0 ]; then
adduser -S -H -h “${prog_dir}/data” -D -s /bin/false -G nobody “${user}” 1> /dev/null 2>&1
fi
}

start() {
chmod a+rw /dev/null /dev/full /dev/random /dev/urandom /dev/tty /dev/ptmx /dev/zero /dev/crypto 1> /dev/null 2>&1
create_user
chown -R ${user} “${prog_dir}” 1> /dev/null 2>&1
rm -f “${pidfile}” 1> /dev/null 2>&1
su ${user} -s /bin/sh -c “${python} ${prog_dir}/app/CouchPotato.py --data_dir ${prog_dir}/data --daemon --pid_file ${pidfile} 1>> ${logfile} 2>&1”
return 0
}

case “$1” in
start) start_service ;;
stop) stop_service ;;
restart) stop_service ; sleep 3 ; start_service ;;
status) status ;;
*) echo “Usage: $0 [start|stop|restart|status]” ; exit 1 ;;
esac

#!/bin/sh

Headphones service

PATH=$PATH:/bin:/usr/bin:/sbin:/usr/sbin:/mnt/DroboFS/Shares/DroboApps/git/bin

. /etc/service.subr

prog_dir=dirname \realpath $0``

name=“Headphones”
version=“1”

python=$DROBOAPPS_DIR/python2/bin/python
pidfile="${prog_dir}/var/headphones.pid"
logfile="${prog_dir}/data/logs/headphones.log"
user=root

create_user() {
grep -q “^${user}” /etc/passwd 1> /dev/null 2>&1
if [ $? -ne 0 ]; then
adduser -S -H -h “${prog_dir}/data” -D -s /bin/false -G nobody “${user}” 1> /dev/null 2>&1
fi
}

start() {
chmod a+rw /dev/null /dev/full /dev/random /dev/urandom /dev/tty /dev/ptmx /dev/zero /dev/crypto 1> /dev/null 2>&1
create_user
chown -R ${user} “${prog_dir}” 1> /dev/null 2>&1
rm -f “${pidfile}” 1> /dev/null 2>&1
su ${user} -s /bin/sh -c “${python} ${prog_dir}/app/Headphones.py --datadir ${prog_dir}/data --daemon --pidfile ${pidfile} 1>> ${logfile} 2>&1”
return 0
}

case “$1” in
start) start_service ;;
stop) stop_service ;;
restart) stop_service ; sleep 3 ; start_service ;;
status) status ;;
*) echo “Usage: $0 [start|stop|restart|status]” ; exit 1 ;;
esac

Both worked fine until a restart of my 5N

Now get errrors for both

./service.sh: line 1: can’t create /tmp/DroboApps/couchpotato/name.txt: Permission denied
./service.sh: line 1: can’t create /tmp/DroboApps/couchpotato/version.txt: Permission denied
su: must be suid to work properly

::EDIT::

Okay still not working now ive reinstalled couchpotato but when i try and start the service i get following

./service.sh status

CouchPotato is enabled and stopped

./service.sh start

sh: can’t create /mnt/DroboFS/Shares/DroboApps/couchpotato/data/logs/CouchPotato.log: nonexistent directory

Try this:

mkdir -p /mnt/DroboFS/Shares/DroboApps/couchpotato/data/logs/

okay so now when i try to start it i get following error again.

/mnt/DroboFS/Shares/DroboApps/couchpotato/service.sh start
/mnt/DroboFS/Shares/DroboApps/couchpotato/service.sh: line 1: can’t create /tmp/DroboApps/couchpotato/name.txt: Permission denied
/mnt/DroboFS/Shares/DroboApps/couchpotato/service.sh: line 1: can’t create /tmp/DroboApps/couchpotato/version.txt: Permission denied
su: must be suid to work properly

Ive got both sabnzbd and sickbeard both running

::Edit::

Tried installing sudo with no luck

Okay not sure what ive done but after countless re installs ive managed to get couch potato running again im guessing no more restarts for me drobo for a bit.