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
os(3erl)						     Erlang Module Definition							  os(3erl)

NAME
os - Operating System Specific Functions DESCRIPTION
The functions in this module are operating system specific. Careless use of these functions will result in programs that will only run on a specific platform. On the other hand, with careful use these functions can be of help in enabling a program to run on most platforms. EXPORTS
cmd(Command) -> string() Types Command = string() | atom() Executes Command in a command shell of the target OS, captures the standard output of the command and returns this result as a string. This function is a replacement of the previous unix:cmd/1 ; on a Unix platform they are equivalent. Examples: LsOut = os:cmd("ls"), % on unix platform DirOut = os:cmd("dir"), % on Win32 platform Note that in some cases, standard output of a command when called from another program (for example, os:cmd/1 ) may differ, compared to the standard output of the command when called directly from an OS command shell. find_executable(Name) -> Filename | false find_executable(Name, Path) -> Filename | false Types Name = string() Path = string() Filename = string() These two functions look up an executable program given its name and a search path, in the same way as the underlying operating sys- tem. find_executable/1 uses the current execution path (that is, the environment variable PATH on Unix and Windows). Path , if given, should conform to the syntax of execution paths on the operating system. The absolute filename of the executable program Name is returned, or false if the program was not found. getenv() -> [string()] Returns a list of all environment variables. Each environment variable is given as a single string on the format "VarName=Value" , where VarName is the name of the variable and Value its value. getenv(VarName) -> Value | false Types VarName = string() Value = string() Returns the Value of the environment variable VarName , or false if the environment variable is undefined. getpid() -> Value Types Value = string() Returns the process identifier of the current Erlang emulator in the format most commonly used by the operating system environment. Value is returned as a string containing the (usually) numerical identifier for a process. On Unix, this is typically the return value of the getpid() system call. On VxWorks, Value contains the task id (decimal notation) of the Erlang task. On Windows, the process id as returned by the GetCurrentProcessId() system call is used. putenv(VarName, Value) -> true Types VarName = string() Value = string() Sets a new Value for the environment variable VarName . timestamp() -> {MegaSecs, Secs, MicroSecs} Types MegaSecs = Secs = MicroSecs = int() Returns a tuple in the same format as erlang:now/0 . The difference is that this function returns what the operating system thinks (a.k.a. the wall clock time) without any attempts at time correction. The result of two different calls to this function is not guaranteed to be different. The most obvious use for this function is logging. The tuple can be used together with the function calendar:now_to_universal_time/1 or calendar:now_to_local_time/1 to get calendar time. Using the calendar time together with the MicroSecs part of the return tuple from this function allows you to log timestamps in high resolution and consistent with the time in the rest of the operating system. Example of code formatting a string in the format "DD Mon YYYY HH:MM:SS.mmmmmm", where DD is the day of month, Mon is the textual month name, YYYY is the year, HH:MM:SS is the time and mmmmmm is the microseconds in six positions: -module(print_time). -export([format_utc_timestamp/0]). format_utc_timestamp() -> TS = {_,_,Micro} = os:timestamp(), {{Year,Month,Day},{Hour,Minute,Second}} = calendar:now_to_universal_time(TS), Mstr = element(Month,{"Jan","Feb","Mar","Apr","May","Jun","Jul", "Aug","Sep","Oct","Nov","Dec"}), io_lib:format("~2w ~s ~4w ~2w:~2..0w:~2..0w.~6..0w", [Day,Mstr,Year,Hour,Minute,Second,Micro]). The module above could be used in the following way: 1> io:format("~s~n",[print_time:format_utc_timestamp()]). 29 Apr 2009 9:55:30.051711 type() -> {Osfamily, Osname} | Osfamily Types Osfamily = win32 | unix | vxworks Osname = atom() Returns the Osfamily and, in some cases, Osname of the current operating system. On Unix, Osname will have same value as uname -s returns, but in lower case. For example, on Solaris 1 and 2, it will be sunos . In Windows, Osname will be either nt (on Windows NT), or windows (on Windows 95). On VxWorks the OS family alone is returned, that is vxworks . Note: Think twice before using this function. Use the filename module if you want to inspect or build file names in a portable way. Avoid match- ing on the Osname atom. version() -> {Major, Minor, Release} | VersionString Types Major = Minor = Release = integer() VersionString = string() Returns the operating system version. On most systems, this function returns a tuple, but a string will be returned instead if the system has versions which cannot be expressed as three numbers. Note: Think twice before using this function. If you still need to use it, always call os:type() first. Ericsson AB kernel 2.14.3 os(3erl)
All times are GMT -4. The time now is 10:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy