Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

rc2.d script 1

Status
Not open for further replies.

7280

MIS
Apr 29, 2003
331
IT
Hi,
i wrote a script to start up when system boots.
But i want that this script should be executed by another user..
how can i do it?
 
Hi,

What you could do, within the startup put something like:

su - username -c command_to_run


feroz
 
It's not working.
When i run it without su - username -c it works, while
when i run it with - user id doesn't.
Of course if i run the script manually directly by that user it works (i have permissions)
Any idea?

This is my script:

#!/sbin/sh
#
#

AVAYA_IC_HOME=/usr/aicprod/IC60

AVAYA_USER_NAME=User
#
# The password has to be changed if the Admin password is changed in ICManager.
#
AVAYA_USER_PASSWORD=password

case "$1" in
start)
cd ${AVAYA_IC_HOME}/etc

AVAYA_ORB_CMD="icadmin so"

${AVAYA_IC_HOME}/bin/${AVAYA_ORB_CMD} 2>&1

cmdtext="starting"

;;
stop)
cd ${AVAYA_IC_HOME}/etc

AVAYA_ORB_CMD="icadmin tva"

${AVAYA_IC_HOME}/bin/${AVAYA_ORB_CMD} ${AVAYA_USER_NAME} ${AVAYA_USER_PASSWORD} 2>&1

cmdtext="stopping"
;;
*)

echo "Usage: $0 {start|stop}"
exit 1
;;
esac

echo "orb $cmdtext."
sleep 30
exit 0


I put su - user here:
su - avaya -c ${AVAYA_IC_HOME}/bin/${AVAYA_ORB_CMD} 2>&1

Any idea??
 
This is the message i have:
Command: /usr/aicprod/IC60/lib/icadmin
Usage: icadmin {-terse} command|alias arguments.. [Try: icadmin help]
 
Try:

Code:
su - avaya -c "${AVAYA_IC_HOME}/bin/${AVAYA_ORB_CMD} 2>&1"




Annihilannic.
 
Perfect!!
With the su - user -c " " it works.
Thanks very much.

Tarek
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top