Sponsored Content
Top Forums Shell Programming and Scripting Expect command when triggered by launchd Post 302735193 by rowie718 on Friday 23rd of November 2012 05:47:51 PM
Old 11-23-2012
Quote:
Originally Posted by DGPickett
So, your expectations were thrown off by quoting and escqping? Well, that's layering for you. Good luck!
Not quite. I had been playing around with escaping and quoting and that wasn't the piece I was missing. The problem was that as soon as the first expect pattern was matched, and the appropriate response sent, the expect command exited, giving no time for the actual spawned process to run and complete. Adding another expect pattern that will not be matched means the expect command runs until it times out looking for that pattern. This approach gives us enough time for the spawned process (slapconfig) to conplete.

Not sure why it reacts differently based on launchd trigger, but this solution works.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Expect and auto expect command

I need to run a remote application(GUI) in a client.i.e on running a script in the client machine i should get the GUI application which is running in the server by providing password through the script.Will expect or autoexpect command suit for this scenario? could anyone help me by posting some... (0 Replies)
Discussion started by: arun_v
0 Replies

2. OS X (Apple)

interval in a launchd script

Hi, i'm planning a to automate my backup with a rsync user deamon in my launchd and let that run every 2 hours. my server contains a lot of video data which can expand rapidly , up to 1TB, in an interval of 2 hours. now i'm wondering what will happen when a rsync is running longer then the... (1 Reply)
Discussion started by: wessel
1 Replies

3. OS X (Apple)

[launchd] Creating a basic firewall

Hi, I'm trying to use launchd to detect whether certain ports are opened and if they are then to take some appropriate action, e.g. close the port or, worst case scenario, down the whole net connection. Apparently, force closing a port is not possible without killing the offending binary so... (3 Replies)
Discussion started by: ASGR
3 Replies

4. UNIX for Dummies Questions & Answers

Alert to be triggered

Hi, I need an alert to be triggered if any filesystem(imagine there are n no of filesystems) reaches more than 90%, it should send an alert to the mailbox stating which filesystem is at what percentage. How can I achieve this in unix? Many thanks. (8 Replies)
Discussion started by: venkatesht
8 Replies

5. Shell Programming and Scripting

Help with expect command

Hi, I am using following commands in my script to send a password to scp command. Everything is working fine except that I need a return code from the scp command. Do any one have an idea how to receive the exit code of scp command from expect. /usr/bin/expect << EOF spawn -noecho scp -pq... (0 Replies)
Discussion started by: pvamsikr
0 Replies

6. Shell Programming and Scripting

Expect command- need help

Hi All, I need help in making my script run perfectly as expected. This is a snippet from my script. I am trying to read the ";" from the below output using the expect command, but the command is not detecting it. Could you please help me correct the expect string? Snippet: ---- ---... (2 Replies)
Discussion started by: sonicj
2 Replies

7. UNIX for Dummies Questions & Answers

Launchd-owned processes unexpected behavior

Ok, so I have been struggling with this for a few days and I think I need an explanation of a few things before I go any further. I'm not sure it's possible to do what I'm trying, so before I pull my hair out, here is what I'm doing: I have written a program in LiveCode that sits on our... (2 Replies)
Discussion started by: nextyoyoma
2 Replies

8. Shell Programming and Scripting

Capture output of command triggered in background

Is there any way to trigger a sequence of commands in parallel and capture their output in variables? e.g. something on the following lines x=`echo "X" &` y=`echo "Y" &` z=`echo "Z" &` so that $x, $y, and $z evaluate to X, Y and Z res. (7 Replies)
Discussion started by: jawsnnn
7 Replies

9. Shell Programming and Scripting

Scripts triggered via 'expect' - stderr lost

I have a bash script on server that runs fine when run interactively and writes stderr output to a file. However, when invoked through a 'expect' script run on Mac OS my laptop which does ssh to the server : generates the expected file, but file has no content. I suspect the stderr is getting... (1 Reply)
Discussion started by: sdudc
1 Replies

10. Shell Programming and Scripting

Email need to be triggered

hi, Currently, in my code, the errors are written in log file. Additionally, i need to trigger the email of error captured. can we modify this script with email triggered along with existing command. echo "ERROR: $SCRIPT: $*" >>$LOGFILE (1 Reply)
Discussion started by: gowthamsoft
1 Replies
ATF-SH(1)						    BSD General Commands Manual 						 ATF-SH(1)

NAME
atf-sh [-s shell] -- interpreter for shell-based test programs SYNOPSIS
atf-sh script DESCRIPTION
atf-sh is an interpreter that runs the test program given in script after loading the atf-sh(3) library. atf-sh is not a real interpreter though: it is just a wrapper around the system-wide shell defined by ATF_SHELL. atf-sh executes the inter- preter, loads the atf-sh(3) library and then runs the script. You must consider atf-sh to be a POSIX shell by default and thus should not use any non-standard extensions. The following options are available: -s shell Specifies the shell to use instead of the value provided by ATF_SHELL. ENVIRONMENT
ATF_LIBEXECDIR Overrides the builtin directory where atf-sh is located. Should not be overridden other than for testing purposes. ATF_PKGDATADIR Overrides the builtin directory where libatf-sh.subr is located. Should not be overridden other than for testing purposes. ATF_SHELL Path to the system shell to be used in the generated scripts. Scripts must not rely on this variable being set to select a specific interpreter. EXAMPLES
Scripts using atf-sh(3) should start with: #! /usr/bin/env atf-sh Alternatively, if you want to explicitly choose a shell interpreter, you cannot rely on env(1) to find atf-sh. Instead, you have to hardcode the path to atf-sh in the script and then use the -s option afterwards as a single parameter: #! /path/to/bin/atf-sh -s/bin/bash ENVIRONMENT
ATF_SHELL Path to the system shell to be used in the generated scripts. SEE ALSO
atf-sh(3) BSD
September 27, 2014 BSD
All times are GMT -4. The time now is 11:21 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy