Sponsored Content
Top Forums Shell Programming and Scripting Expect Script not running from cron. Full Paths used Post 302871123 by popeye on Wednesday 6th of November 2013 09:51:08 AM
Old 11-06-2013
Expect Script not running from cron. Full Paths used

My cron file. Copied $PATH
Code:
# 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 12 * * * /home/popeye/xferResult &

The script
Code:
#!/usr/bin/expect 
spawn ftp -i 2.22.221.211
expect ":"
send "popeye\n"
expect ":"
sleep 1
send "thesailorman\n"
expect ">"
send "cd filestore\r"
expect ">"
send "put /home/popeye/Resulta\r"
#send "mput /home/popeye/Result*\r"
expect ">"
sleep 2 
send "bye\r"
close

The error

Quote:
spawn ftp -i 2.22.221.211
Connected to 2.22.221.211 (2.22.221.211).
220 ProFTPD 1.3.4a Server FTP Server [::ffff:2.22.221.211]
Name (2.22.221.211Smilie: popeye
331 Password required for popeye
Password:
230 User popeye logged in
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> cd filestore
250 CWD command successful
ftp> mput /home/popeye/Result*

local: /home/popeye/Resulta remote: /home/popeye/Resulta
227 Entering Passive Mode (2,22,221,211,66,33).
550 /home/popeye/Resulta: No such file or directory

local: /home/popeye/Resultb remote: /home/popeye/Resultb
227 Entering Passive Mode (2,22,221,211,66,34).
550 /home/popeye/Resultb: No such file or directory


local: /home/popeye/Resultc remote: /home/popeye/Resultc
227 Entering Passive Mode (2,22,221,211,66,35).
550 /home/popeye/Resultc: No such file or directory

local: /home/popeye/Resultd remote: /home/popeye/Resultd
227 Entering Passive Mode (2,22,221,211,66,36).
550 /home/popeye/Resultd: No such file or directory

ftp>
The files are there. Any help would be very appreciated.

Thanks Regards
POP

---------- Post updated 11-06-13 at 09:51 AM ---------- Previous update was 11-05-13 at 01:53 PM ----------

I solved the problem. I was wondering how to close threads. I like to keep a tidy ship.

Last edited by vbe; 11-06-2013 at 11:24 AM..
 

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
date(1) 						      General Commands Manual							   date(1)

NAME
date - display or set the date and time SYNOPSIS
[mmddhhmm[[cc]yy]] sssfff]] DESCRIPTION
The command displays or sets the current HP-UX system clock date and time. Since the HP-UX system operates in Coordinated Universal Time (UTC), automatically converts to and from local standard or daylight/summer time, based on your environment variable. See in below. Options recognizes the following option: Input and output values in Coordinated Universal Time (UTC), functionally equivalent to Greenwich Mean Time (GMT), instead of in local time. Slowly adjust the time by seconds (fff represents fractions of a second). This adjustment can be positive or negative. The system's clock will be sped up or slowed down until it has drifted by the number of seconds specified. Formats The command has two forms for displaying the date and time and one form for setting them. Display the current date and time. The output is the same as for the formatting directive for all languages except the default language. See and below. Display the current date and time according to formatting directives specified in format, which is a string of zero or more formatting directives and ordinary characters. If it contains blanks, enclose it in apostrophes or quotation marks. See below. All ordinary characters are copied unchanged into the output string. The output string is always terminated with a newline character. If is specified and format is omitted, only a newline is output. Set the HP-UX system clock to the date and time specified. You require the superuser privilege. If you include the option, the specified date and time is assumed to be in Coordinated Universal Time (UTC). The numeric argument is interpreted left to right in two-digit pairs as follows: mm Month number dd Day number in the month hh Hour number (24-hour system) mm Minute number cc Century minus one yy Last two digits of the year number If omitted, the current year is used. If you attempt to set the date backwards, generates the warning, Type or the equivalent for your locale to set the clock backwards; anything else to cancel the command. When is used to set the date, a pair of date change records is written to the file (UNIX Standard only, see standards(5).) No warning is generated if date is set backwards. Formatting Directives The following formatting directives, shown without the optional field width and precision specification, are replaced by the indicated characters. If a directive is not one of the following, the result is undefined. The output for digits, characters, and words depends on the language/locale settings. See in below. The examples assume that the command was executed on Wednesday, January 12, 1994 at 7:45:58 p.m. Pacific Standard Time, using the default language. Abbreviated weekday name. For example, Full weekday name. For example, Abbreviated month name. For example, Full month name. For example, Current date and time representation. For example, Century (the year divided by 100 and truncated to an integer) as a two-digit decimal number For example, Day of the month as a two-digit decimal number For example, Day of the month as a two-character decimal number with leading space fill [ ]. For example, Combined Emperor/Era name and year. Hour (24-hour clock) as a two-digit decimal number For example, Hour (12-hour clock) as a two-digit decimal number For example, Day of the year as a three-digit decimal number For example, Month as a decimal two-digit number For example, Minute as a decimal two-digit number For example, Newline character. Emperor/Era name. Emperor/Era year. Equivalent of either AM or PM. For example, Time as %H:%M Second as a two-digit decimal number (allows for possible leap seconds) For example, Tab character. Weekday as a one-digit decimal number For example, Week number of the year (Sunday as the first day of the week) as a two-digit decimal number All days that precede the first Sunday in the year are considered to be in week For example, Week number of the year (Monday as the first day of the week) as a two-digit decimal number If the week containing January 1 has four or more days in the new year (January 1 is Thursday or sooner), it is designated as week otherwise, (January 1 is Friday or later), it is designated as the last week of the previous year, and the next week is week For example, Weekday as a one-digit decimal number For example, Week number of the year (Monday as the first day of the week) as a two-digit decimal number All days that precede the first Monday in the year are considered to be in week For example, Current date representation. For example, Current time representation. For example, Year without century as a two-digit decimal number For example, Year with century as a four-digit decimal number For example, Time zone name (or no characters if time zone cannot be determined). For example, The character. Obsolescent Directives The following directives are provided for backward compatibility. It is recommended that the preceding directives be used instead. Date in usual U.S. format. For example, Use or instead. Full month name. For example, Use instead. Abbreviated month name. For example, Use instead. Time in 12-hour U.S. format. For example, Use instead. Time in 24-hour U.S. format. For example, Use or instead. Time zone name (or no characters if time zone cannot be determined). For example, Use instead. Modified Formatting Directives Some Formatting Directives can be modified by the and modifier characters to indicate a different format or specification for the language specified in the environment variable. If the corresponding keyword and is not specified or not supported, the unmodified field descriptor value is used. The command displays the keywords and their values in the specified language (see locale(1)). Alternate appropriate date and time representation. The name of the base year in alternate representation. Alternate date representation. Offset from (year only) in the alternate representation. Full alternate year representation. Day of month using the alternate numeric symbols. Day of month using the alternate numeric symbols with leading space-character fill if applicable. Hour (24-hour clock) using the alternate numeric symbols. Hour (12-hour clock) using the alternate numeric symbols. Month using the alternate numeric symbols. Minutes using the alternate numeric symbols. Seconds using the alternate numeric symbols. Week number of the year (Sunday is the first day of the week) using the alternate numeric symbols. Weekday as number using the alternate numeric symbols Weekday number of the year (Monday is the first day of the week) using the alternate numeric symbols. Year (offset from in alternate representation. Field Width and Precision An optional field width and precision specification can immediately follow the initial of a formatting directive in the following order: The decimal digit string width specifies a minimum field width in which the result of the conversion is right- or left-justified. The default is right-justified with space padding on the left. If the string starts with "", the result is left-justified with space padding on the right. If the string starts with "", the result is right-justified and padded with zeros on the left. The decimal digit string prec specifies the minimum number of digits to appear for the and numeric directives. If a directive supplies fewer digits than specified by the precision, it will be expanded with leading zeros. prec specifies the maximum number of characters to be used from the and text directives. If a directive supplies more characters than specified by the precision, excess characters are truncated on the right. If no field width or precision is specified for a or directive, the default is for the directive, the default is for the default is for the default is EXTERNAL INFLUENCES
For information about the UNIX Standard environment, see standards(5). Environment Variables determines the interpretation of the bytes within the format string as single- and/or multi-byte characters. determines the characters used to form numbers for those directives that produce numbers in the output. The characters used are those defined by (see locale(1) and in langinfo(5)). determines the content (for example, the weekday names produced by the directive) and format (for example, the current time representation produced by the directive) of date and time strings output by the command. determines the language in which messages (other than the date and time strings) are displayed. If or is not specified or is null, it defaults to the value of If is not specified or is null, it defaults to (see lang(5)). If any internationalization variable contains an invalid setting, all internationalization variables default to (see environ(5)). determines the conversion between the system time in UTC and the time in the user's local time zone. See environ(5) and tztab(4). also determines the content (that is, the time-zone name produced by the and directives) of date and time strings output by the command. If is not set or is set to the empty string, its default value is If the or the value cannot be read from the time zone adjustment table then returns the time in International Code Set Support Single and multibyte character code sets are supported. DIAGNOSTICS
The following messages may be displayed. The date/time specification is syntactically incorrect. Check it against the usage and for the correct range of each of the digit-pairs. The character c is not a valid format directive, field width specifier, or precision specifier. The date/time you specified is earlier than the current clock value. Type (or the equivalent for your locale) to set the clock backwards; anything else to cancel the command. You need the superuser privilege to change the date. EXAMPLES
Date in Different Languages Display the date. In this example, the environment variable contains and the language environment variables are set as noted. Set Date Set the date to Oct 8, 12:45 a.m. Display Formatted Date Display the current date and time using a format. Note the use of quotation marks due to the blanks in the format. The output resembles the following: Display Formatted Date Using Local Language Conversion With the date as set in the "Set Date" example above and set to (German): generates output similar to: where the month field is four characters long, flush-left, and space-padded on the right if the month name is shorter than four characters. The day field is two characters long, with leading zeros suppressed. WARNINGS
The former HP-UX format directive has been changed to for ANSI compatibility. Changing the date while the system is running in multiuser mode should be avoided to prevent disrupting user-scheduled and time sensitive programs and processes. Also, changing the date can cause and the SCCS and subsystems to behave in an unexpected manner. The daemon should be killed prior to setting the date backwards, then restarted. SCCS files should be checked with the command (see val(1)) if deltas have been made while the clock was wrongly set. The following formatting directives may be deleted from future releases: Currently, the maximum date supported is December 31, 2037 23:59:00 UTC. AUTHOR
was developed by AT&T and HP. FILES
SEE ALSO
locale(1), stime(2), ctime(3C), strftime(3C), tztab(4), environ(5), lang(5), langinfo(5), standards(5). STANDARDS CONFORMANCE
date(1)
All times are GMT -4. The time now is 09:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy