Operating System - HP-UX
1834646 Members
2296 Online
110069 Solutions
New Discussion

Re: Using Expect in HPUX 11.11i

 
Joyce Tan
Occasional Contributor

Using Expect in HPUX 11.11i

Hi

Has anyone out there ever install Expect in a HPUX 11.11i before.

Can anyone tell me how to go about install it?

Regards
Joyce
7 REPLIES 7
Robert Bennett_3
Respected Contributor

Re: Using Expect in HPUX 11.11i

We use expect to change our passwords on 10.20, 11.00 and 11i servers.

Here's a good sight:

http://hpux.connect.org.uk/hppd/hpux/Tcl/expect-5.42/
"All there is to thinking is seeing something noticeable which makes you see something you weren't noticing which makes you see something that isn't even visible." - Norman Maclean
Cem Tugrul
Esteemed Contributor

Re: Using Expect in HPUX 11.11i

hi,
i have also asked similar as Joyce response
today.
i have downloaded and installed expect but
still do not know how can i go???
Our greatest duty in this life is to help others. And please, if you can't
Robert Bennett_3
Respected Contributor

Re: Using Expect in HPUX 11.11i

Expect uses the the tcltk language as background support for the internal calls such as spawn, send, expect, etcâ ¦ Before executing the script verify that both expect and tcltk are installed by running a swlist.


#!/bin/sh
RHOME=/roots/bin
SSHBIN=/usr/bin

for i in `cat all.sites`
do
echo $i
$SSHBIN/scp $RHOME/ch_pass.exp $i:/tmp
$SSHBIN/ssh $i "/tmp/ch_pass.exp"
$SSHBIN/ssh $i "rm /tmp/ch_pass.exp"
done

Here's the ch_pass.exp expect script called in the previous script used for changing the root password. Just change the variables xxxxxxxx to the old and wanted password:

#!/usr/local/bin/expect --
#
# Expect script to change passwords in an automated fashion
# NOTE: Expect may be found different places on the server
#
# Variables
set timeout 10
set username root
set password xxxxxxx
set oldpass xxxxxxx

# Main
spawn passwd $username
# Possible initial output from the passwd command
expect "Old*" {
send "$oldpass\r"
} "New*" {
send "$password\r"
}
# Possible second line output from the passwd command
expect "New*" {
send "$password\r"
} "Re-enter*" {
send "$password\r"
} "Last*" {
send "p\r"
}
# Possible third line input/output from the passwd command
expect {
"Re-enter*" { send "$password\r" }
"New*" { send "$password\r" }
eof
}
# Possible fourth line input/output from the passwd command
expect {
"Re-enter*" { send "$password\r" }
eof
}
# Possible fifth line input needed to exit shell from the passwd command
expect eof


Hope this helps
"All there is to thinking is seeing something noticeable which makes you see something you weren't noticing which makes you see something that isn't even visible." - Norman Maclean
Cem Tugrul
Esteemed Contributor

Re: Using Expect in HPUX 11.11i

Robert,
from my test hp-ux srv version 11i(B.11.11)

baan03:/#swlist|grep -i tcl
tcltk 8.4.9 tcltk
baan03:/#swlist|grep -i expect
expect 5.42 expect

Now,what must i do?
Our greatest duty in this life is to help others. And please, if you can't
Robert Bennett_3
Respected Contributor

Re: Using Expect in HPUX 11.11i

Install expect on all the server(s) you want to work with.

On your management server - set yourself up a file called all.sites (or any derivative thereof - but the script is running cat all.sites - which can be changed as you see fit) that looks like this.

server1
server2
server3
...

You may have to fully qualify these names depending on your environment. We place this in /roots/bin along with all our scripts.

copy the first script above to a filename of your choosing in /roots/bin (we use - chroot_pass.sh) and copy the expect script above to /roots/bin/ch_pass.exp

The chroot_pass.sh script will copy the ch_pass.exp script to that box, run the expect script, and the remove the script so there is no evidence of the password. Once the script has executed change the password variables back to xxxxxxxx.


Hope this helps

B
"All there is to thinking is seeing something noticeable which makes you see something you weren't noticing which makes you see something that isn't even visible." - Norman Maclean
Joyce Tan
Occasional Contributor

Re: Using Expect in HPUX 11.11i

Hi

I had encountered problem while installing the tcl. Please see the below message and advise, thanks!


#./configure
creating cache ./config.cache

checking whether to use symlinks for manpages... no

checking whether to compress the manpages... no

checking whether to add a package name suffix for the manpages... no

checking for gcc... no

checking for cc... cc

checking whether the C compiler (cc ) works... yes

checking whether the C compiler (cc ) is a cross-compiler... no

checking whether we are using GNU C... no

checking whether cc accepts -g... no

checking for building with threads... no (default)

checking how to run the C preprocessor... cc -E

checking for sin... no

checking for main in -lieee... no

checking for main in -linet... no

checking for net/errno.h... no

checking for connect... yes

checking for gethostbyname... yes

checking how to build libraries... shared

checking for ranlib... ranlib

checking if 64bit support is requested... no

checking if 64bit Sparc VIS support is requested... no

checking system version (for dynamic loading)... HP-UX-B.11.11

checking for dlopen in -ldl... no

checking for ar... ar

checking for shl_load in -ldld... yes

checking for build with symbols... no

checking for required early compiler flags... _LARGEFILE64_SOURCE

checking for 64-bit integer type... long long

checking for struct dirent64... no

checking for struct stat64... yes

checking for off64_t... checking for open64... yes

checking for lseek64... yes

yes

checking whether byte ordering is bigendian... yes

checking for getcwd... yes

checking for opendir... yes

checking for strstr... yes

checking for strtol... yes

checking for strtoll... no

checking for strtoull... no

checking for tmpnam... yes

checking for waitpid... yes

checking for strerror... yes

checking for getwd... yes

checking for wait3... yes

checking for uname... yes

checking for realpath... yes

checking dirent.h... yes

checking for errno.h... yes

checking for float.h... yes

checking for values.h... yes

checking for limits.h... yes

checking for stdlib.h... yes

checking for string.h... yes

checking for sys/wait.h... yes

checking for dlfcn.h... yes

checking for unistd.h... yes

checking for sys/param.h... yes

checking for sys/modem.h... yes

checking termios vs. termio vs. sgtty... termios

checking for fd_set in sys/types... no

checking for fd_mask in sys/select... missing

checking whether struct tm is in sys/time.h or time.h... time.h

checking for sys/time.h... yes

checking whether time.h and sys/time.h may both be included... yes

checking for tm_zone in struct tm... no

checking for tzname... yes

checking for gmtime_r... yes

checking for localtime_r... yes

checking tm_tzadj in struct tm... no

checking tm_gmtoff in struct tm... no

checking long timezone variable... yes

checking for st_blksize in struct stat... yes

checking for fstatfs... yes

checking for 8-bit clean memcmp... yes

checking for memmove... yes

checking proper strstr implementation... yes

checking for strtoul... yes

checking for strtod... yes

checking for strtod... (cached) yes

checking for Solaris2.4/Tru64 strtod bugs... ok

checking for ANSI C header files... yes

checking for mode_t... yes

checking for pid_t... yes

checking for size_t... yes

checking for uid_t in sys/types.h... yes

checking for socklen_t... no

checking for opendir... (cached) yes

checking union wait... no

checking for strncasecmp... yes

checking for BSDgettimeofday... no

checking for gettimeofday... yes

checking for gettimeofday declaration... present

checking whether char is unsigned... no

checking signed char declarations... no

checking for a putenv() that copies the buffer... yes

checking for langinfo.h... yes

checking whether to use nl_langinfo... yes

checking for sys/ioctl.h... yes

checking for sys/filio.h... no

checking FIONBIO vs. O_NONBLOCK for nonblocking I/O... O_NONBLOCK

checking how to package libraries... standard shared library

updating cache ./config.cache

creating ./config.status

creating Makefile

creating dltest/Makefile

creating t# make

cc -c -O -DTCL_DBGX= +z -I./../generic -I. -D_XOPEN_SOURCE=1 -D_XOPEN_SOURCE_EXTENDED=1 -D_LARGEFILE64_SOURCE=1 -DTCL_WIDE_INT_TYPE=long\ long -DHAVE_STRUCT_STAT64=1 -DHAVE_OPEN64=1 -DHAVE_LSEEK64=1 -DHAVE_TYPE_OFF64_T=1 -DWORDS_BIGENDIAN=1 -DHAVE_GETCWD=1 -DHAVE_OPENDIR=1 -DHAVE_STRSTR=1 -DHAVE_STRTOL=1 -DHAVE_TMPNAM=1 -DHAVE_WAITPID=1 -DHAVE_LIMITS_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_PARAM_H=1 -DHAVE_SYS_MODEM_H=1 -DUSE_TERMIOS=1 -DNO_FD_SET=1 -DHAVE_SYS_TIME_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_TZNAME=1 -DHAVE_GMTIME_R=1 -DHAVE_LOCALTIME_R=1 -DHAVE_TIMEZONE_VAR=1 -DHAVE_ST_BLKSIZE=1 -DSTDC_HEADERS=1 -Dsocklen_t=unsigned -DNO_UNION_WAIT=1 -DHAVE_PUTENV_THAT_COPIES=1 -DHAVE_LANGINFO=1 -DHAVE_SYS_IOCTL_H=1 -DTCL_SHLIB_EXT=\".sl\" ./../generic/regcomp.c

(Bundled) cc: warning 480: The -O option is available only with the C/ANSI C product; ignored.

(Bundled) cc: warning 480: The +z option is available only with the C/ANSI C product; ignored.

cpp: "./../generic/tcl.h", line 256: warning 2013: Unknown preprocessing directive.

cpp: "./../generic/tcl.h", line 382: warning 2013: Unknown preprocessing directive.

(Bundled) cc: "../generic/tcl.h", line 464: error 1705: Function prototypes are an ANSI feature.

(Bundled) cc: "../generic/tcl.h", line 506: error 1000: Unexpected symbol: "clientData".

(Bundled) cc: "../generic/tcl.h", line 506: error 1506: Parameters allowed in function definition only.

(Bundled) cc: "../generic/tcl.h", line 581: error 1000: Unexpected symbol: "Tcl_RegExpIndices".

(Bundled) cc: "../generic/tcl.h", line 586: error 1761: __synchronous keyword not supported on HP-PA systems.

(Bundled) cc: "../generic/tcl.h", line 658: error 1000: Unexpected symbol: "*".

(Bundled) cc: "../generic/tcl.h", line 658: error 1705: Function prototypes are an ANSI feature.

(Bundled) cc: "../generic/tcl.h", line 658: error 1573: Type of "interp" is undefined due to an illegal declaration.

(Bundled) cc: "../generic/tcl.h", line 659: error 1000: Unexpected symbol: "clientData".

(Bundled) cc: "../generic/tcl.h", line 659: error 1705: Function prototypes are an ANSI feature.

(Bundled) cc: "../generic/tcl.h", line 659: error 1573: Type of "interp" is undefined due to an illegal declaration.

(Bundled) cc: "../generic/tcl.h", line 661: error 1000: Unexpected symbol: "clientData".

(Bundled) cc: "../generic/tcl.h", line 661: error 1705: Function prototypes are an ANSI feature.

(Bundled) cc: "../generic/tcl.h", line 661: error 1573: Type of "clientData" is undefined due to an illegal declaration.

(Bundled) cc: "../generic/tcl.h", line 662: error 1000: Unexpected symbol: "data".

(Bundled) cc: "../generic/tcl.h", line 662: error 1506: Parameters allowed in function definition only.

(Bundled) cc: "../generic/tcl.h", line 663: error 1000: Unexpected symbol: "clientData".

(Bundled) cc: "../generic/tcl.h", line 663: error 1506: Parameters allowed in function definition only.

(Bundled) cc: "../generic/tcl.h", line 664: error 1000: Unexpected symbol: "clientData".

(Bundled) cc: "../generic/tcl.h", line 664: warning 5: "const" will become a keyword.

(Bundled) cc: "../generic/tcl.h", line 664: error 1000: Unexpected symbol: "const".

(Bundled) cc: "../generic/tcl.h", line 664: error 1705: Function prototypes are an ANSI feature.

(Bundled) cc: "../generic/tcl.h", line 664: error 1573: Type of "interp" is undefined due to an illegal declaration.

(Bundled) cc: "../generic/tcl.h", line 666: error 1000: Unexpected symbol: "clientData".

(Bundled) cc: "../generic/tcl.h", line 666: error 1000: Unexpected symbol: "Tcl_CmdProc".

(Bundled) cc: "../generic/tcl.h", line 666: warning 5: "const" will become a keyword.

(Bundled) cc: "../generic/tcl.h", line 666: error 1000: Unexpected symbol: "ClientData".

(Bundled) cc: "../generic/tcl.h", line 666: error 1000: Unexpected symbol: "const".

(Bundled) cc: "../generic/tcl.h", line 666: error 1705: Function prototypes are an ANSI feature.

(Bundled) cc: "../generic/tcl.h", line 666: error 1573: Type of "interp" is undefined due to an illegal declaration.

(Bundled) cc: "../generic/tcl.h", line 666: error 1677: Parameter type has an invalid storage class specifier "static".

(Bundled) cc: "../generic/tcl.h", line 666: error 1573: Type of "cmdClientData" is undefined due to an illegal declaration.

(Bundled) cc: "../generic/tcl.h", line 669: error 1000: Unexpected symbol: "clientData".

(Bundled) cc: "../generic/tcl.h", line 669: warning 5: "const" will become a keyword.

(Bundled) cc: "../generic/tcl.h", line 669: error 1000: Unexpected symbol: "const".

(Bundled) cc: "../generic/tcl.h", line 669: error 1000: Unexpected symbol: "Tcl_Command".

(Bundled) cc: "../generic/tcl.h", line 669: warning 5: "const" will become a keyword.

(Bundled) cc: "../generic/tcl.h", line 669: error 1000: Unexpected symbol: "*".

(Bundled) cc: "../generic/tcl.h", line 669: error 1705: Function prototypes are an ANSI feature.

(Bundled) cc: "../generic/tcl.h", line 669: error 1573: Type of "interp" is undefined due to an illegal declaration.

(Bundled) cc: "../generic/tcl.h", line 672: error 1705: Function prototypes are an ANSI feature.

(Bundled) cc: "../generic/tcl.h", line 673: error 1705: Function prototypes are an ANSI feature.

(Bundled) cc: "../generic/tcl.h", line 675: error 1000: Unexpected symbol: "clientData".

(Bundled) cc: "../generic/tcl.h", line 675: warning 5: "const" will become a keyword.

(Bundled) cc: "../generic/tcl.h", line 675: error 1000: Unexpected symbol: "char".

(Bundled) cc: "../generic/tcl.h", line 675: error 1000: Unexpected symbol: "Tcl_EncodingState".

(Bundled) cc: "../generic/tcl.h", line 675: error 1705: Function prototypes are an ANSI feature.

(Bundled) cc: "../generic/tcl.h", line 675: error 1573: Type of "statePtr" is undefined due to an illegal declaration.

(Bundled) cc: "../generic/tcl.h", line 679: error 1000: Unexpected symbol: "clientData".

(Bundled) cc: "../generic/tcl.h", line 679: error 1506: Parameters allowed in function definition only.

(Bundled) cc: "../generic/tcl.h", line 680: error 1000: Unexpected symbol: "*".

(Bundled) cc: "../generic/tcl.h", line 680: error 1705: Function prototypes are an ANSI feature.

(Bundled) cc: "../generic/tcl.h", line 680: error 1573: Type of "evPtr" is undefined due to an illegal declaration.

(Bundled) cc: "../generic/tcl.h", line 681: error 1000: Unexpected symbol: "clientData".

(Bundled) cc: "../generic/tcl.h", line 681: error 1705: Function prototypes are an ANSI feature.

(Bundled) cc: "../generic/tcl.h", line 681: error 1573: Type of "clientData" is undefined due to an illegal declaration.

(Bundled) cc: "../generic/tcl.h", line 683: error 1000: Unexpected symbol: "*".

(Bundled) cc: "../generic/tcl.h", line 683: error 1000: Unexpected symbol: ")".

(Bundled) cc: "../generic/tcl.h", line 685: error 1616: Unable to open intrinsic file "/usr/local/lib/sysintr".

(Bundled) cc: "../generic/tcl.h", line 685: error 1000: Unexpected symbol: "clientData".

(Bundled) cc: "../generic/tcl.h", line 685: error 1705: Function prototypes are an ANSI feature.

(Bundled) cc: "../generic/tcl.h", line 685: error 1573: Type of "clientData" is undefined due to an illegal declaration.

(Bundled) cc: "../generic/tcl.h", line 687: error 1000: Unexpected symbol: "clientData".

(Bundled) cc: "../generic/tcl.h", line 687: error 1506: Parameters allowed in function definition only.

(Bundled) cc: "../generic/tcl.h", line 688: error 1000: Unexpected symbol: "clientData".

(Bundled) cc: "../generic/tcl.h", line 688: error 1705: Function prototypes are an ANSI feature.

(Bundled) cc: "../generic/tcl.h", line 688: error 1573: Type of "clientData" is undefined due to an illegal declaration.

(Bundled) cc: "../generic/tcl.h", line 689: error 1000: Unexpected symbol: "clientData".

(Bundled) cc: "../generic/tcl.h", line 689: error 1506: Parameters allowed in function definition only.

(Bundled) cc: "../generic/tcl.h", line 690: error 1705: Function prototypes are an ANSI feature.

(Bundled) cc: "../generic/tcl.h", line 691: error 1705: Function prototypes are an ANSI feature.

(Bundled) cc: "../generic/tcl.h", line 692: error 1000: Unexpected symbol: "clientData".

(Bundled) cc: "../generic/tcl.h", line 692: error 1506: Parameters allowed in function definition only.

(Bundled) cc: "../generic/tcl.h", line 693: error 1000: Unexpected symbol: "clientData".

(Bundled) cc: "../generic/tcl.h", line 693: error 1705: Function prototypes are an ANSI feature.

(Bundled) cc: "../generic/tcl.h", line 693: error 1573: Type of "interp" is undefined due to an illegal declaration.

(Bundled) cc: "../generic/tcl.h", line 695: error 1000: Unexpected symbol: "clientData".

(Bundled) cc: "../generic/tcl.h", line 695: error 1000: Unexpected symbol: "*".

(Bundled) cc: "../generic/tcl.h", line 695: error 1000: Unexpected symbol: ")".

(Bundled) cc: "../generic/tcl.h", line 697: error 1616: Unable to open intrinsic file "/usr/local/lib/sysintr".

(Bundled) cc: "../generic/tcl.h", line 697: error 1000: Unexpected symbol: "clientData".

(Bundled) cc: "../generic/tcl.h", line 697: error 1506: Parameters allowed in function definition only.

(Bundled) cc: "../generic/tcl.h", line 698: error 1000: Unexpected symbol: "clientData".

(Bundled) cc: "../generic/tcl.h", line 698: warning 5: "const" will become a keyword.

(Bundled) cc: "../generic/tcl.h", line 698: error 1000: Unexpected symbol: "*".

(Bundled) cc: "../generic/tcl.h", line 698: error 1705: Function prototypes are an ANSI feature.

(Bundled) cc: "../generic/tcl.h", line 698: error 1573: Type of "interp" is undefined due to an illegal declaration.

(Bundled) cc: "../generic/tcl.h", line 700: error 1000: Unexpected symbol: "*".

(Bundled) cc: "../generic/tcl.h", line 701: warning 5: "const" will become a keyword.

(Bundled) cc: "../generic/tcl.h", line 700: error 1506: Parameters allowed in function definition only.

(Bundled) cc: "../generic/tcl.h", line 701: error 1000: Unexpected symbol: "char".

(Bundled) cc: error 2017: Cannot recover from earlier errors, terminating.

*** Error exit code 1



Stop.

============================================
Rainer von Bongartz
Honored Contributor

Re: Using Expect in HPUX 11.11i

The problem lies here:

checking for gcc... no
checking for cc... cc

You only have the bundled C Compiler, which cannot compile code with ANSI features.

Download and install gcc

Regards
Rainer
He's a real UNIX Man, sitting in his UNIX LAN making all his UNIX plans for nobody ...