Login script


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Login script
# 1  
Old 07-25-2005
Login script

Hi,

I wrote a script for backing up a application database. When I run the script from command line, it works great.. But when I add that script to login profile of some user , it does not work ...

*******************************************
backup script:- (databasebk)

#!/bin/ksh
# set the environment
. /home/user1/lib/setregion US

stty intr '^C'
echo $BKPARAM
exec mpro -p bkup.p -e 200 -l 200 -s 31 -T /tmp -pf $BKPARAM
***************************************************
The setregion script uses the parameter "US" to set the environment. BKPARAM is one of the parameters set in "setregion" script.
When I run the script from command line, BKPARAM has the value :- /home/database/US/param.pf

When I added this to the login profile of a user, it did not work..
.profile file
*************************************************
# login profile of user "bkup"

. /home/db/bin/databasebk

# end of script
*******************************************

When I login with account "bkup" , it runs teh script databasebk ..but the parameters are not properly.. after putting an echo statement in "setregion" script, I found that it is not picking the parameter "US" ...so BKPARAM has the value /home/database//param.pf which in invalid..
I tried putting parameter US in double quotes etc..but still it did not work..

Not sure why it does not work when it is executed from login profile..
We are on Sun solaris 2.8

Any ideas.??

Thanks in advance
# 2  
Old 07-25-2005
I think you have a problem with the setregion script. It looks like it may be a permisison problem. From your post and your trouble shooting soo far it has to do with the setregion script. You did not clearifed if the script works for which users. You stated that it works great.. But when I add that script to login profile of some user... Does the user have permission to execute the setregion script? IF noy then theBKPARAM will not be set.
# 3  
Old 07-25-2005
Passing arguments to a dotted script is a ksh concept. The shell running .profile must not be ksh. What shell did you give the user?
# 4  
Old 07-25-2005
Thanks a lot..

it worked fine..actually it is the combination of both the issues..first it was the permission issue..once I corrected , the script started executing..
then I replace . with exec command..
now, it is cool

Thanks again..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script as login shell (passing args to login shell)

Hello all, for security reasons my compagny imposes that my script be launch remotly via ssh under the users login shell. So serverA launches the ssh command to serverB which has a local user with my script as a login shell. Local script works like a charm on his own. serverB$ grep... (20 Replies)
Discussion started by: maverick72
20 Replies

2. Shell Programming and Scripting

Help with login script.

Guys I need to write a script that will login to over 480 servers and run the last -n 45 "userid" | tail -1. OK, I am terrible at writting scripts. So I need the script to run this command and forward the output to my main server in /var/tmp/output. PLEASE HELP. :confused: (7 Replies)
Discussion started by: terrywhitejr
7 Replies

3. OS X (Apple)

Login/Logout script

Dear readers I use SnowLeopard 10.6.2 and need to do some special tasks at login and logout of an sepcific user. My problem is, how do I send a string "login" respectively "logout" from computer "A", where the login/logout script runs, to computer "B" where some other tasks need to be done. ... (3 Replies)
Discussion started by: tthaler
3 Replies

4. Programming

Login script for unix ?

Anyone know of a script or program in a unix platform that will allow one login and password for three databases ? Say i have a social site that has a video site and phpBB3 forum but i want them connected as one login. I heard there is a script that does that , anyone know the name or where to get... (0 Replies)
Discussion started by: rumrunner439
0 Replies

5. Shell Programming and Scripting

Login Script

Can anybody help in writing a script that takes username and password and then successfully login onto windows operating system box? For example 1. I have a box A with Linux OS. 2. I have another box B with windows OS. How to login onto boxB from boxA? (3 Replies)
Discussion started by: vinna
3 Replies

6. Shell Programming and Scripting

Help on a login script

I am trying to get a script together so when any user logs into the system it will display a message. After the user answers the question based on the answer they will proceed into the system or be logged out. I only want the person to get prompted once per message. Below is what I have in all... (1 Reply)
Discussion started by: gbarnes
1 Replies

7. Shell Programming and Scripting

How can we ssh login with script?

Hi all, Normally, we give ip address to login with ssh like ssh 172.168.0.1 And we can give login name to ssh like ssh -l root 172.10.0.21 Then the shell asks the password, we enter the password and login to the system. While using the script file, we are not able to supply the password to... (5 Replies)
Discussion started by: pcsaji
5 Replies

8. Shell Programming and Scripting

Automatic login script

Hi, I'm a beginner in unix.As a part of my script i need to remote logon using ssh. my script run as being asked for password and logons only after the user enters the password correctly. But my script stops executing after that as I login to a different server(different shell if i'm right).... (3 Replies)
Discussion started by: dayanand
3 Replies

9. Shell Programming and Scripting

Script with SU Login

I'm attempting to write a script where it temporarily would login as Super User to change some file permissions, cats the files, then exits. Can this be done by script with no manual(human) input? thanks (3 Replies)
Discussion started by: bkhviking
3 Replies

10. UNIX for Dummies Questions & Answers

Login and logout script

Hi all I know ho I can run a script when a user logs in, viz using the .login or .profile file, however what can I use to run a script when a user logouts ? Thanks J :confused: (1 Reply)
Discussion started by: jhansrod
1 Replies
Login or Register to Ask a Question