LinuxQuestions.org
Visit Jeremy's Blog.
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, 11: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, 12:04 PM   #2
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 2,403

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, 12:23 PM   #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, 01: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, 06:55 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

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


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 12:06 PM
Run a script automatically upon user login? FastFeet Linux - General 3 05-21-2009 06:23 AM
Building a script to run after user login callingrohit Linux - General 4 04-26-2006 07:05 PM
How to run a Script as root, after Login as User, in GDM MHOOO Red Hat 14 03-08-2005 09:41 AM


All times are GMT -5. The time now is 06:25 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration