I have this startup script, when i launch i have the execution done by username: root, instead of username: sun.
How can i tell the start_daemon to execute it as username : sun not root?
$ ps aux | grep python
root 950 0.1 0.2 171132 18936 ? S 05:35 0:00 /usr/bin/python /var/tmp/mp.py
root@nson:/etc/rc0.d# cat K20mp
#! /bin/sh
PATH=/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=/var/tmp/mp.sh
PIDFILE=/var/run/mp.pid
test -x $DAEMON || exit 0
. /lib/lsb/init-functions
case "$1" in
start)
log_daemon_msg "Starting mp"
start_daemon -p $PIDFILE $DAEMON --user sun --chuid sun
log_end_msg $?
;;
stop)
log_daemon_msg "Stopping mp"
killproc -p $PIDFILE $DAEMON
PID=`ps x |grep mp.py | head -1 | awk '{print $1}'`
kill -9 $PID
log_end_msg $?
;;
force-reload|restart)
$0 stop
$0 start
;;
status)
status_of_proc -p $PIDFILE $DAEMON atd && exit 0 || exit $?
;;
*)
echo "Usage: /etc/init.d/atd {start|stop|restart|force-reload|status}"
exit 1
;;
esac
exit 0
EDIT: Reference not working
http://man.he.net/man8/start-stop-daemon
http://refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/iniscrptfunc.html