Sponsored Content
Full Discussion: shell scripting
Top Forums Shell Programming and Scripting shell scripting Post 302453140 by manish_1678 on Tuesday 14th of September 2010 07:11:52 AM
Old 09-14-2010
shell scripting

Hi ,
I have installed expect on the server and I am trying to execute the script but getting below error.Please suggest me the way out.
I would like to know how cct can be utilized here to call extlog.exp?

Code:
./passwdchng.sh
Enter your password:
password
dbaguest,192.168.175.1,password
./passwdchng.sh: logext.exp: command not found
oracle,192.168.175.2,password
./passwdchng.sh: logext.exp: command not found
root,192.168.175.3,password
./passwdchng.sh: logext.exp: command not found

Sripts are:--
#!/bin/bash

Code:
username="dbaguest"
echo "Enter your password:"
read newPassword
cat ssh.csv | while read line;
do
host=`echo $line | cut -d, -f1`
addr=`echo $line | cut -d, -f2`
paswd=`echo $line | cut -d, -f3`
echo "$host,$addr,$paswd"
cct=$(logext.exp $paswd $newPassword $addr $username)if [[ "$cct" == *login* ]]; then
echo "SSH Connection to $host succeeded" >> testlog
if [[ "$cct" == *successfully* ]]; then
echo "Password has been changed successfully for $host" >> testlog
else
echo "Password change failed for $host." >> testlog
echo "$host,$addr,$paswd" >> errorlog
fi
else [[ "$cct" == *Permission* ]]
echo "$host,$addr,$paswd" >> errorlog
fi
cct=""
done

Code:
#!/usr/bin/expect -f
set currentpasword [lrange $argv 0 0]
set newpassword [lrange $argv 1 1]
set ipaddr [lrange $argv 2 2]
set username [lrange $argv 3 3]
set cmd "passwd"
spawn /usr/bin/ssh -X $username@$ipaddr
expect -re "Enter password for key'.*':"
send "yes\r"
expect "*password*"
send "$currentpasword\r"
expect "%"
expect "Last login:" {
send "$cmd\r"
expect "%"
expect "*(current) UNIX password*"
send "$currentpasword\r"
expect "*New UNIX Password*"
send "$newpassword\r"
expect "*Retype*"
send "$newpassword\r"
expect "%"
expect "exit\r"
}

Regards,
Mk

Last edited by pludi; 09-14-2010 at 08:19 AM.. Reason: code tags, please...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

difference between AIX shell scripting and Unix shell scripting.

please give the difference between AIX shell scripting and Unix shell scripting. (2 Replies)
Discussion started by: haroonec
2 Replies

2. Shell Programming and Scripting

Call Shell scripting from Perl Scripting.

Hi How to call a shell scripting through a Perl scripting? Actually I need some value from Shell scripting and passes in the Perl scripting. So how can i do this? (2 Replies)
Discussion started by: anupdas
2 Replies

3. What is on Your Mind?

Shell scripting vs Perl scripting

Hi all, I would like to start developping some good scripting skills. Do you think it would be best to start with shell scripting or Perl? I already got a fundation, really basics, in perl. but I am wondering what would be best to be good at first. Can you please help me determine which one to... (14 Replies)
Discussion started by: Pouchie1
14 Replies

4. Android

Android Scripting Environment: Shell Scripting and Android

I just upgraded to Android 2.2 from 2.1. The GPS issue that was troublesome in 2.1 seems to have been fixed. Some of web browsing seems faster, but it could just be my connection is better today ;) Flash works in some browsers but not very good and it is too slow for Flash apps designed for... (0 Replies)
Discussion started by: Neo
0 Replies

5. What is on Your Mind?

Shell Scripting vs Perl scripting

Gents, I have been working in a Solaris/Unix environment for about 9 months. I took some linux classses online before getting the job. But, I am not very good at scripting. I want to learn how to script. Do you think that I should start with Shell scripting or Perl? I wanted to continue with... (2 Replies)
Discussion started by: Pouchie1
2 Replies

6. Web Development

Perl scripting or shell scripting?

i am going to study any one of the scripting languages mentioned above(shell 0r perl scripting) . Which is having more scope for a fresher? (1 Reply)
Discussion started by: Anna Hussie
1 Replies

7. UNIX for Dummies Questions & Answers

Shell Scripting

Hey I have a data in the file named as outputFile.txt. The data is in the format 123456,12345678912345,400,09/09/09,INACTIVE. I want this output without commas ie 12345612345678912345400090909INACTIVE. Please tell me what to do and clear explain all the terms, as I am new to it. (6 Replies)
Discussion started by: sampandey31
6 Replies

8. Shell Programming and Scripting

Shell scripting

Hi, if in a network there are lots of PCs connected with either windows or linux as operating system.Then what will be the shell script for the same and also if the PC has linux in it then we have to find if it is occupied or unoccupied. If the PC has windows in it then we have to find if it is... (6 Replies)
Discussion started by: akansha singh
6 Replies

9. Shell Programming and Scripting

help me in Shell Scripting

Hi there please have a look at the code..i want to create Using a named pipe. Run a find in the background starting in the working directory While this is happening wait for input from the user to ask him which file to find. If the user does not enter any data in 10 seconds ask the user again.... (1 Reply)
Discussion started by: kattak1511
1 Replies

10. UNIX for Dummies Questions & Answers

Shell script to read lines in a text file and filter user data Shell Programming and Scripting

sxsaaas (3 Replies)
Discussion started by: VikrantD
3 Replies
asadmin-list-persistence-resources(1AS) 			   User Commands			   asadmin-list-persistence-resources(1AS)

NAME
asadmin-list-persistence-resources, list-persistence-resources - gets all the persistence resources SYNOPSIS
list-persistence-resources --user admin_user [--password admin_password] [--host localhost][--port 4848] [--secure|-s] [--passwordfile filename][--terse=false] [--echo=false] [--interactive=true] Gets all the persistence resources. This command is supported in remote mode only. OPTIONS
--user authorized domain application server administrative username. --password password to administer the domain application server. --host machine name where the domain application server is running. --port port number of the domain application server listening for administration requests. --secure if true, uses SSL/TLS to communicate with the domain application server. --passwordfile file containing the domain application server password. --terse indicates that any output data must be very concise, typically avoiding human-friendly sentences and favoring well- formatted data for consumption by a script. Default is false. --echo setting to true will echo the command line statement on the standard output. Default is false. --interactive if set to true (default), only the required password options are prompted. Example 1: using list-persistence-resources asadmin> list-persistence-resources --user admin1 --password adminadmin1 --host pigeon --port 5001 Command list-persistence-resources executed successfully Where: sample_persistence_resource is the persistence resource listed. EXIT STATUS
0 command executed successfully 1 error in executing the command asadmin-create-persistence-resource(1AS), asadmin-delete-persistence-resource(1) J2EE 1.4 SDK March 2004 asadmin-list-persistence-resources(1AS)
All times are GMT -4. The time now is 05:56 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy