[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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.