expect script in cron


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting expect script in cron
# 1  
Old 02-28-2003
expect script in cron

I wrote a script using 'expect' tool to change the password of my login id, every fortnight. And I had put it as a cron job.

The cron job is throwing an error


ld.so.1: /usr/local/bin/expect: fatal: libtcl8.3.so: open failed: No such file or directory

The environment variables are set properly with the paths.

Why is that I still get this error?

When I run the same script in command prompt, I dont get the error...I get the desired result.

Thanks
# 2  
Old 02-28-2003
Type the 'set' command at the prompt and put the ouput in the script. See if it runs successfully during it's next scheduled occurrance. If it does, then it is an environment variable (which is my guess). Most likely it is the LD_PATH (or similar) variable. You can start eliminating variables until you figure out which one is the critical one.
# 3  
Old 03-03-2003
I exported the LD_LIBRARY_PATH environment variable in a shell script, and invoked the expect script from the same script. The shell script was scheduled as cron job. It worked!

But I am facing yet another problem in the expect script. I am calling 'mkpasswd' command(which, in turn, is an expect script) from my expect script.

set NEWPASSWD [exec mkpasswd -d 2 -l 6 -s 0 -C 0]

It says "mkpasswd not found". How else can I store the output of 'mkpasswd' command in a variable?

Thanks
# 4  
Old 03-03-2003
Are you able to put the entire path to mkpasswd in there?
Code:
set NEWPASSWD [exec /usr/bin/mkpasswd -d 2 -l 6 -s 0 -C 0]

Be sure to replace the above with the real path to your mkpasswd.
# 5  
Old 03-04-2003
Yes Livinfree

I tried using the absolute path of mkpasswd...and I get the following error:

/usr/local/bin/mkpasswd: expect: not found
while executing
"exec /usr/local/bin/mkpasswd -d 2 -l 6 -s 0 -C 0"
invoked from within
"set NEWPASSWD [exec /usr/local/bin/mkpasswd -d 2 -l 6 -s 0 -C 0]"


I get this problem only when I execute the script as a cron job....from a command prompt, it works fine.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Expect script not executing via cron

Hello All, I'm having an issue getting an expect script to run as a cron job. The script executes fin if I run it from the command line but I get nothing when trying to run it as a cron job. I've researched other forums and threads and there have been references to the environment, or lack... (16 Replies)
Discussion started by: KingT617
16 Replies

2. Programming

Expect script returning string following a found expect.

I'm fairly new to scripting so this might not be possible. I am using Expect with Cisco switches and need to capture the string after finding the expect request. For example, when I issue "show version" on a Nexus switch, I'm looking to capture the current firmware version: #show version ... (0 Replies)
Discussion started by: IBGaryA
0 Replies

3. Shell Programming and Scripting

Expect Script not running from cron. Full Paths used

My cron file. Copied $PATH # Minute Hour Day of Month Month Day of Week Command SHELL=/bin/ksh PATH=/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/perl/lib:/perl/lib/lib/perl5:/perl/scripts:.:/perl/lib/local:/home/popeye:/temp 0... (3 Replies)
Discussion started by: popeye
3 Replies

4. Shell Programming and Scripting

expect script not running in cron "Urgent"

I wrote a script to download the files from sftp location to local. while running the script manually its working fine. when i schedule the same in cron its not working.... :wall::wall: here is the script: #!/bin/bash ... (2 Replies)
Discussion started by: ganga39
2 Replies

5. Shell Programming and Scripting

Using expect script with AIX's SMIT in cron

My searches turned up nothing relevant, so I apologize if this has already been looked at. I am trying to run an expect script from a Solaris machine, that ssh's into an AIX machine, and interacts with a SMIT created menu system that runs a few backups for me. The expect script runs fine when... (0 Replies)
Discussion started by: Mariognarly
0 Replies

6. Shell Programming and Scripting

Need help with Expect script for Cisco IPS Sensors, Expect sleep and quoting

This Expect script provides expect with a list of IP addresses to Cisco IPS sensors and commands to configure Cisco IPS sensors. The user, password, IP addresses, prompt regex, etc. have been anonymized. In general this script will log into the sensors and send commands successfully but there are... (1 Reply)
Discussion started by: genewolfe
1 Replies

7. Solaris

expect package is not invoked from cron

Hi, I am running some etl commands in the windows from shell script(from unix sun solaris 5.9) by using expect package .While running manually the script is working fine.While running from cron it is exiting the after successfully firing the ETL command(The control does not stop after firing... (1 Reply)
Discussion started by: megh
1 Replies

8. Shell Programming and Scripting

calling expect script in ksh is failing via cron

I'm calling an expect script via a ksh script in cron and it is failing. The script runs fine if i run it manually. Does anyone know if it is an issue with compatibilty and if there is a way around it? (2 Replies)
Discussion started by: bhatia
2 Replies

9. Shell Programming and Scripting

strange expect script behavior, or am i misunderstanding expect scripting?

Hello to all...this is my first post (so please go easy). :) I feel pretty solid at expect scripting, but I'm running into an issue that I'm not able to wrap my head around. I wrote a script that is a little advanced for logging into a remote Linux machine and changing text in a file using sed.... (2 Replies)
Discussion started by: v1k0d3n
2 Replies

10. UNIX for Dummies Questions & Answers

expect and cron

I have the following expect script, which I want to run in cron. It fails however, very likely due to the fact that there's no /dev/tty available. set timeout 30 spawn -nottycopy -nottyinit /usr/bin/ssh $hostname $command match_max 100000 expect "password" send -- "$password" send -- "\r"... (0 Replies)
Discussion started by: rein
0 Replies
Login or Register to Ask a Question