LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 05-17-2012, 10:46 AM   #1
fachhoch@gmail.com
Member
 
Registered: Apr 2010
Posts: 82

Rep: Reputation: 1
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'
 
Old 05-17-2012, 11:04 AM   #2
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,344

Rep: Reputation: Disabled
Have you tried /bin/su --help? The help text contains at least three useful bits of information:
  1. /bin/su (unlike /usr/bin/su) does not take command arguments like that, use "-c"
  2. /bin/su passes a command to the login shell, which, as you say, your user doesn't have
  3. /bin/su allows you to specify a shell with the "-s" parameter
 
Old 05-17-2012, 11:23 AM   #3
fachhoch@gmail.com
Member
 
Registered: Apr 2010
Posts: 82

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by Ser Olmy View Post
Have you tried /bin/su --help? The help text contains at least three useful bits of information:
  1. /bin/su (unlike /usr/bin/su) does not take command arguments like that, use "-c"
  2. /bin/su passes a command to the login shell, which, as you say, your user doesn't have
  3. /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?
 
Old 05-17-2012, 12:43 PM   #4
fachhoch@gmail.com
Member
 
Registered: Apr 2010
Posts: 82

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by fachhoch@gmail.com View Post
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?
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.
 
Old 05-17-2012, 05:55 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,362

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
If you want it run as part of the tomcat startup script, then hook it into there and make it owned by tomcat.
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Script run as user login or logout in Vsftpd server singhpps Linux - Software 4 11-27-2010 11:06 AM
Run a script automatically upon user login? FastFeet Linux - General 3 05-21-2009 05:23 AM
Building a script to run after user login callingrohit Linux - General 4 04-26-2006 06:05 PM
How to run a Script as root, after Login as User, in GDM MHOOO Red Hat 14 03-08-2005 08:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:17 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