[SOLVED] bash-script question: How to start a user A's process from other users?
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
bash-script question: How to start a user A's process from other users?
A Tomcat server is installed under user A. Now I am going to write a script which will start this Tomcat server. And this script can be executed from other users (from there account). And if other user run this script, the process ID should be of user A, so that user A can start or stop this process any time.
This means, at the beginning of the script I have set the process ID as user A. How to do this?
Before I mark this as solved, I have a further question:
When I run this script under root, it doesn't ask me for password. But when I run this under user A, it ask me for the password.
This script is located under "/opt/jboss/tomcat" where is user A's region. The user A can run all execute files without entering any password. But it's now not the case.
Is it possible to run the script under user A without asking for password?
Besides, I change the script as follow:
Quote:
#!/bin/bash
TOMCAT_USER=tomcat
echo $TOMCAT_USER
TOMCAT_HOME=${TOMCAT_HOME:-"/opt/jboss/tomcat"}
if [ "$TOMCAT_USER" = "RUNASIS" ]; then
SUBIT=""
else
SUBIT="su - $TOMCAT_USER -c "
fi
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.