Sponsored Content
Top Forums Shell Programming and Scripting Expect Script not running from cron. Full Paths used Post 302873107 by popeye on Monday 11th of November 2013 07:16:35 AM
Old 11-11-2013
To solve the problem

Use

Code:
expect ">"
send "lcd /home/popeye\r"
expect ">"
send "mput /home/popeye/Result*\r"
expect ">"

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

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... (4 Replies)
Discussion started by: Deepa
4 Replies

2. UNIX for Dummies Questions & Answers

expect and stty paths are different and resulting in error.

Hello, i am using expect to automate file transfers to and fro with a sftp server. below is the script i am creating and executing in the main program. but i am getting the following error: the main program that creates and runs this script looks for words like "not found" in... (6 Replies)
Discussion started by: The Nemi
6 Replies

3. 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

4. Shell Programming and Scripting

How to write an expect script to check if a process is running?

I'm new to expecting and i want to create a script to ssh to a device,check is a process is running and display that the process is running or not.This is what i have so far After executing this script i get an error. #!/usr/bin/expect set timeout -1 set ip "machine ip goes here" set... (5 Replies)
Discussion started by: icchi
5 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

how to debug an expect script running on a tomcat server

Hello everyone, I have a small expect script as follows; #!/usr/bin/expect -f set force_conservative 0 ;# set to 1 to force conservative mode even if ;# script wasn't run conservatively originally if {$force_conservative} { set send_slow {1 .1} proc send {ignore arg}... (1 Reply)
Discussion started by: randeel
1 Replies

7. Shell Programming and Scripting

Expect script cronjob running but dying prematurely

I have an Ubuntu machine that I'd like to update automatically. I've written an expect script to run the aptitude package manager and update my packages. Essentially it does: aptitude update && aptitude upgrade while answering "yes" at the appropriate time. It works quite nicely when run... (4 Replies)
Discussion started by: CluelessPerson
4 Replies

8. Shell Programming and Scripting

ps command showing full code of running script

Hi, I have a script running while rsync command is fired to push some files. The output of rsync cmd has been redirected to the script which is used to generate log files containing progress info with formatting. when I enter ps -ef | grep rsync it shows the full scripting code on the cmd line... (2 Replies)
Discussion started by: rajeevra
2 Replies

9. 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

10. 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
EXPECT_EXPECTL(3)							 1							 EXPECT_EXPECTL(3)

expect_expectl - Waits until the output from a process matches one of the patterns, a specified time period has passed, or anEOFis seen

SYNOPSIS
int expect_expectl (resource $expect, array $cases, [array &$match]) DESCRIPTION
Waits until the output from a process matches one of the patterns, a specified time period has passed, or an EOF is seen. If $match is provided, then it is filled with the result of search. The matched string can be found in $match[0]. The match substrings (according to the parentheses) in the original pattern can be found in $match[1], $match[2], and so on, up to $match[9] (the limitation of libexpect). PARAMETERS
o $expect - An Expect stream, previously opened with expect_popen(3). o $cases - An array of expect cases. Each expect case is an indexed array, as described in the following table: Expect Case Array +----------+--------------------------+---+---+---+ |Index Key | | | | | | | | | | | | | Value Type | | | | | | | | | | | | Description | | | | | | | | | | | | Is Mandatory | | | | | | | | | | | | Default Value | | | | | | | | | | +----------+--------------------------+---+---+---+ | 0 | | | | | | | | | | | | | string | | | | | | | | | | | | pattern, that will be | | | | | | matched against the out- | | | | | | put from the stream | | | | | | | | | | | | yes | | | | | | | | | | | | | | | | | | T{ 1 | | | | | | | | | | | | mixed | | | | | | | | | | | | value, that will be | | | | | | returned by this func- | | | | | | tion, if the pattern | | | | | | matches | | | | | | | | | | | | yes | | | | | | | | | | | | | | | | | | T{ 2 | | | | | | | | | | | | integer | | | | | | | | | | | | pattern type, one of: | | | | | | EXP_GLOB, EXP_EXACT or | | | | | | EXP_REGEXP | | | | | | | | | | | | no | | | | | | | | | | | | | | | | | | EXP_GLOB | | | | | | | | | | +----------+--------------------------+---+---+---+ RETURN VALUES
Returns value associated with the pattern that was matched. On failure this function returns: EXP_EOF, EXP_TIMEOUT or EXP_FULLBUFFER CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 0.2.1 | | | | | | | Prior to version 0.2.1, in $match parameter a | | | match string was returned, not an array of match | | | substrings. | | | | +--------+---------------------------------------------------+ EXAMPLES
Example #1 expect_expectl(3) example <?php // Copies file from remote host: ini_set("expect.timeout", 30); $stream = fopen("expect://scp user@remotehost:/var/log/messages /home/user/messages.txt", "r"); $cases = array( // array(pattern, value to return if pattern matched) array("password:", "asked for password"), array("yes/no)?", "asked for yes/no") ); while (true) { switch (expect_expectl($stream, $cases)) { case "asked for password": fwrite($stream, "my password "); break; case "asked for yes/no": fwrite($stream, "yes "); break; case EXP_TIMEOUT: case EXP_EOF: break 2; // break both the switch statement and the while loop default: die "Error has occurred!"; } } fclose($stream); ?> SEE ALSO
expect_popen(3). PHP Documentation Group EXPECT_EXPECTL(3)
All times are GMT -4. The time now is 11:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy