Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora 17/18 > Using Fedora
FedoraForum Search

Forgot Password? Join Us!

Using Fedora General support for current versions. Ask questions about Fedora and it's software that do not belong in any other forum.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 19th June 2007, 09:10 AM
irri Offline
Registered User
 
Join Date: May 2007
Posts: 25
Start service as user

I have been given a startup script:

#!/bin/sh

# Start appname
case "$1" in
'start')
( cd /opt/manufacturer/appname ; ./appname) > /dev/null 2>&1
;;
'stop')
( cd /opt/manufacturer/appname ; ./appname) > /dev/null 2>&1
;;
*)
echo "usage: $0 {start|stop}"
;;
esac


I was told to put this in rc2.d and name it S99appname.

1) It doesn't start the app
2) If it did, it would start it as root and I want it to start as a user.

Is there a way to do this?

Thanks in advance.
Reply With Quote
  #2  
Old 19th June 2007, 09:32 AM
mnisay Offline
Registered User
 
Join Date: May 2005
Location: PH
Posts: 696
have you tried

runuser

?
Reply With Quote
  #3  
Old 19th June 2007, 09:48 AM
irri Offline
Registered User
 
Join Date: May 2007
Posts: 25
How do I use runuser?
Reply With Quote
  #4  
Old 19th June 2007, 09:58 AM
mnisay Offline
Registered User
 
Join Date: May 2005
Location: PH
Posts: 696
#man runuser
#man sudo

Ex:

runuser username command1
Reply With Quote
  #5  
Old 19th June 2007, 10:03 AM
InKo's Avatar
InKo Offline
Registered User
 
Join Date: Dec 2005
Location: EU
Age: 36
Posts: 637
why do not simply use the SU command?
in your inittab to run at boot up
Code:
su <username> -c "<command>"
__________________
The software required «Windows 98 or better», so I installed Linux.
Reply With Quote
  #6  
Old 19th June 2007, 10:12 AM
irri Offline
Registered User
 
Join Date: May 2007
Posts: 25
can I choose to run it from Bash in inittab?
Reply With Quote
  #7  
Old 19th June 2007, 10:16 AM
mnisay Offline
Registered User
 
Join Date: May 2005
Location: PH
Posts: 696
might as well put it here

/etc/rc.local
Reply With Quote
  #8  
Old 19th June 2007, 10:24 AM
InKo's Avatar
InKo Offline
Registered User
 
Join Date: Dec 2005
Location: EU
Age: 36
Posts: 637
Code:
su --shell=<shell> -l <user> -c "<command>"
<shell> e.g. /bin/tcsh


p.s. runuser also has the option -s or --shell
__________________
The software required «Windows 98 or better», so I installed Linux.
Reply With Quote
  #9  
Old 19th June 2007, 10:28 AM
irri Offline
Registered User
 
Join Date: May 2007
Posts: 25
So at the end of inittab I can just add:
su --shell=/bin/bash -1 username -c "application"
?
Reply With Quote
  #10  
Old 19th June 2007, 10:33 AM
mnisay Offline
Registered User
 
Join Date: May 2005
Location: PH
Posts: 696
did you typed -1 (minus one)? That should be -l (minus small L)
Reply With Quote
  #11  
Old 19th June 2007, 10:59 AM
irri Offline
Registered User
 
Join Date: May 2007
Posts: 25
The actual line I am adding to inittab is:

su --shell=/bin/bash -l render1 -c "alfserver"

Where render1 is the username and alfserver is the app. It doesn't seem to start.
Reply With Quote
  #12  
Old 19th June 2007, 11:09 AM
InKo's Avatar
InKo Offline
Registered User
 
Join Date: Dec 2005
Location: EU
Age: 36
Posts: 637
Quote:
Originally Posted by mnisay
did you typed -1 (minus one)? That should be -l (minus small L)
sorry, my bad! of course it must be minus small L... thanx mnisay!

@irri: sorry, I actually wanted to say you can put the discussed line into /etc/rc.d/rc.local.

you can also write a little script in /etc/init.d/ to start it at boot time so that you can then control it using
Code:
 service <myscript> start | stop | restart
etc.
For a permanent use I would take the last way. For testing - with rc.local

__________________
The software required «Windows 98 or better», so I installed Linux.
Reply With Quote
  #13  
Old 19th June 2007, 11:40 AM
irri Offline
Registered User
 
Join Date: May 2007
Posts: 25
It works!
I put the line in rc.local

Thanks to you both. I've been try to get that going for ages.
Reply With Quote
  #14  
Old 19th June 2007, 12:20 PM
mnisay Offline
Registered User
 
Join Date: May 2005
Location: PH
Posts: 696
ur welcome. just adding more words from the last postings, its been a while, now ive got fedora 7, getting better and wider! yahooouu!

thanks fedora guyz, well done!
Reply With Quote
  #15  
Old 19th June 2007, 01:49 PM
Kirurgs Offline
Registered User
 
Join Date: Apr 2007
Posts: 56
Well, it could be very nice, if services can be run as other users, then you could make one easily and run as what user needed...
Smth graphical...
And NO, I'm not against CLI, but for newbies and for easier of use for desktop - yes...
Reply With Quote
Reply

Tags
service, start, user

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How-To ?: Start a service on user login to gnome heftigrat Using Fedora 16 19th October 2009 06:05 PM
Can't start nmb service in F9 OralDeckard Servers & Networking 2 27th May 2008 05:19 PM
chkconfig wokrs but service start says unknow service gkk Servers & Networking 4 10th December 2007 02:45 AM
how to start service linoob Servers & Networking 7 23rd May 2006 07:15 PM


Current GMT-time: 00:54 (Thursday, 23-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat