LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-12-2004, 05:42 AM   #1
shwong
LQ Newbie
 
Registered: May 2004
Posts: 1

Rep: Reputation: 0
Unhappy Bash scripting help (su ...)


Hi,

A basic bash scripter, i need help in writing a script that requires a User "apache" to restart postgresql.

[apache@xxx apache]$ service postgresql restart
Password:

I've tried creating a file that contained the password, "pword". But it didn't worked:

[apache@xxx apache]$ su - root <pword
standard in must be a tty

How to i write a script to enter the password automatically?

Any other solutions to restart the postgresql as an apache user is very much appreciated. Thank you in advance for your time


best regards,
siew hui
 
Old 11-02-2005, 12:26 PM   #2
missy_b
LQ Newbie
 
Registered: Oct 2005
Posts: 3

Rep: Reputation: 0
As long as root is starting the script, you can do
su - apache <scriptname>
An example can be found (among other places)
in /etc/init.d/tomcat
If you are not root, then it might be a good idea to start with
http://www.courtesan.com/sudo/index.html
(just because I don't like unanswered questions :-)

Last edited by missy_b; 11-02-2005 at 12:30 PM.
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash scripting pete1234 Programming 1 09-27-2005 01:48 AM
Bash Scripting help jgtg32a Programming 5 09-06-2005 09:38 AM
bash scripting vadon Linux - Newbie 6 05-10-2005 04:07 AM
need help with bash scripting rich2oo1 Programming 2 12-17-2003 12:50 PM
HELP with BASH scripting atwah Linux - Newbie 6 09-09-2003 01:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration