Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unix Scripting

Status
Not open for further replies.

heyben

Technical User
Nov 6, 2002
4
0
0
US
I am writting a script (ksh) to fire off a backup utility nightly. The utility prompts for a password when it runs.

I have tried the following method that works for ftp.

#!/bin/ksh
ndsbackup cf /data/bak/`date +%y%m%d` -a adminnamehere <<EOF
echo &quot;passwordhere&quot;
EOF

I have also tried without quotes/no echo statement etc, no dice. I always get prompted

password:

in the shell from which the script was run.

Anyone done something similar?

The utility is ndsbackup for Novell eDirectory on Solaris 2.8

The ndsbackup utility does not support providing the password in the command as an argument.

 
supposed 'ndsbackup' accept thiss, why echo ? -----------
when they don't ask you anymore, where they are come from, and they don't tell you anymore, where they go ... you'r getting older !
 
I recall seeing EXPECT/SEND used in uucp scripts for midem control.

I thought EXPECT/SEND were internals to the uucp process.

If they are not then can you provide a simple example of how to use them in a ksh script?

Ben
 
Is there a reason you can't set this up to run as a cronjob by the appropriate login id? Unless the utility requires interaction form a user...not really familiar with ndsbackup.
 
The ndsbackup utility is interactive. It allows the name of an administrative NDS user to be specified on the command line but does not allow for a password to be passed on the command line.

After starting it prompts for password: and waits for response.

The expect/send trick would work if it is available outside of uucp.

And as I mentioned in the first post I've tried the method that works so well with ftp.

I'm really stumped with this one...

Not to mention getting tired of logging into 12 unique servers and manually executing ndsbackup each day.

Once I get the script passing the password correctly then I *will* add a crontab entry to do this all for me.

Ben
 
Have you tried this?

ndsbackup cf /data/bak/`date +%y%m%d` -a adminnamehere < filethatcontainspassword

That might just work.
 
Yep, tried that one as well. The behavior is identical to

ndsbackup cf /data/bak/`date +%y%m%d` -a adminnamehere <<EOF
passwordhere
EOF


I get the password: prompt in the shell from which the script was executed.
 
Have you looked at the printf command?
You should be able to:
printf &quot;password\n&quot; | ndsbackup cf /data/bak/`date +%y%m%d` -a adminnamehere
 
Presumably ndsbackup works similarly to the passwd command, and empties stdin or ignores it completely somehow, so none of the above are working for you. I expect (heheh) expect is what you're looking for, however unfortunately there doesn't seem to be a conveniently precompiled binary on SunFreeware. Source can be obtained here:
Good luck! Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top