The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Regarding Shell Scripting anilkarikkandar UNIX for Dummies Questions & Answers 3 11-20-2006 12:26 AM
HELP PLS!! Shell Scripting!! Mary_xxx Shell Programming and Scripting 9 09-16-2006 06:52 AM
difference between AIX shell scripting and Unix shell scripting. haroonec Shell Programming and Scripting 2 04-12-2006 08:12 AM
something else on shell scripting master_6ez Shell Programming and Scripting 1 11-21-2004 11:42 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-24-2005
dipanrc dipanrc is offline
Registered User
  
 

Join Date: Oct 2005
Location: Kolkata
Posts: 8
Smile Shell scripting

Hi friends I am new in this forum....

I am currently working as a Linux Admin in a company.....

Currently i have faced a problem,if u help me that will great for me..

I need a little guidence 2 create a shell script which will

automatically changes 2 a specific user (just using "SU") according 2 me ,

then enter into a specifc directory and execute a executable file....

This should be completely time dependent and automatic.........
  #2 (permalink)  
Old 10-24-2005
Unbeliever Unbeliever is offline
Registered User
  
 

Join Date: Jul 2005
Location: England
Posts: 183
Really need a little more information. Is the script run as root? Is it the same executable file in each directory changed to? if not how do you know what executable to run?

Out of interest, if it is *not* run as root then it can only be done in a totally insecure way unless you use sudo or something.

Unbeliever
  #3 (permalink)  
Old 10-26-2005
Unbeliever Unbeliever is offline
Registered User
  
 

Join Date: Jul 2005
Location: England
Posts: 183
Thanks for the info in the PM.

Root can run scripts as different users using 'su -c <username>'

So you could be doing something like.

Code:
for user in <user list>
do
   cd <relevant directory>
  su -c $user <command>
done
  #4 (permalink)  
Old 10-27-2005
rajan_ka1 rajan_ka1 is offline
Registered User
  
 

Join Date: Sep 2005
Posts: 130
I have tried with our code

i have given

su -c root in shellscript
but the error

standard in must be a tty
rm: cannot unlink `TIP-14-3000434.tip': Operation not permitted

was coming

please help

regards
rajan
  #5 (permalink)  
Old 10-27-2005
Unbeliever Unbeliever is offline
Registered User
  
 

Join Date: Jul 2005
Location: England
Posts: 183
'su -c' is just a construct for running a command as another user. It looks like the program you are running is having problems running under cron or something similar. I've never actually seen either of the errors you mention.

I would try searching for them in google and see what turns up. Remember that when you 'su -c <command' the command is being run as that user and so many operations that would succeed as root may fail.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:38 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0