Start service as another user - Linux Scripting Help

Usefeul Technical Help and Info

Start service as another user - Linux Scripting Help

Postby Amos » Sat Sep 22, 2007 12:08 am

Pasted from help I got on IRC tyring to write the startup scripts for the servers..........


[23:31] <AmosT> i want to start a service as another user
[23:31] <bitrot> su user -c cmd
[23:32] <bitrot> as root
[23:32] <AmosT> hmmm
[23:32] <AmosT> lol what if the command has to be typed from within the directory
[23:32] <bitrot> and quote it if you're using args su user -c "cmd -arg1 -arg2"
[23:32] <AmosT> ok
[23:32] <bitrot> simple
[23:32] <AmosT> like i cant just type /home/amos/serviced
[23:32] <bitrot> and quote it if you're using args su user -c "cd /the\ dir ; ./cmd -arg1 -arg2"
[23:33] <AmosT> yes
[23:33] <AmosT> u da man
[23:33] <bitrot> or
[23:33] <bitrot> set it in the $PATH
[23:33] <bitrot> :)
[23:33] <bitrot> for the user
Don't Snooze

Amos
 
Posts: 134
Joined: Tue Apr 25, 2006 2:44 pm

Return to Technical Issues

Who is online

Users browsing this forum: No registered users and 1 guest

cron