Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
 |
05-17-2012, 10:46 AM
|
#1
|
Member
Registered: Apr 2010
Posts: 82
Rep:
|
run batch script as user tomcat who does not have any login
I want to run a batch script as tomcat user .
tomcat user was created to run tomcat.
I tried
/bin/su tomcat wget -o /opt/tomcat/current/webapps/artms.war https://s3.amazonaws.com/blah/blah/blah/somefile.
but I get /bin/su: invalid option -- 'o'
|
|
|
05-17-2012, 11:04 AM
|
#2
|
Senior Member
Registered: Jan 2012
Distribution: Slackware
Posts: 3,349
Rep: 
|
Have you tried /bin/su --help? The help text contains at least three useful bits of information:
- /bin/su (unlike /usr/bin/su) does not take command arguments like that, use "-c"
- /bin/su passes a command to the login shell, which, as you say, your user doesn't have
- /bin/su allows you to specify a shell with the "-s" parameter
|
|
|
05-17-2012, 11:23 AM
|
#3
|
Member
Registered: Apr 2010
Posts: 82
Original Poster
Rep:
|
Quote:
Originally Posted by Ser Olmy
Have you tried /bin/su --help? The help text contains at least three useful bits of information:
- /bin/su (unlike /usr/bin/su) does not take command arguments like that, use "-c"
- /bin/su passes a command to the login shell, which, as you say, your user doesn't have
- /bin/su allows you to specify a shell with the "-s" parameter
|
is there any way I can tell linux to run this wget -o /opt/tomcat/current/webapps/artms.war https://s3.amazonaws.com/blah/blah/blah/somefile. using tomcat user?
|
|
|
05-17-2012, 12:43 PM
|
#4
|
Member
Registered: Apr 2010
Posts: 82
Original Poster
Rep:
|
Quote:
Originally Posted by fachhoch@gmail.com
|
Please help me how to run a command as a nonlogin user (I mean some other user like tomcat,apache etc) .
I want to write a startup script which uses wget to download a file and place it in tomcat /webapps folder.
the tomcat folder owner is tomcat so this new file whihc is copied I wnat tomcat to be the owner.Please help me.
|
|
|
05-17-2012, 05:55 PM
|
#5
|
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.x
Posts: 18,434
|
If you want it run as part of the tomcat startup script, then hook it into there and make it owned by tomcat.
|
|
|
All times are GMT -5. The time now is 12:14 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|