General :: Run Script From Another With Multiple User Inputs And Expect

Jun 5, 2011

I am literally bashing (pun intended) my head against the keyboard at this minute! I am trying to automate a script via cron for my centos server. The script requires two user inputs (e.g. read VAR). However, I do not want to edit the original file, as I would like to be able to run it normally as well. It is also made by someone else, and so if an update becomes available, it will be easier to install. My idea is that i create a cron script, to run this second script from, and the only way i could find was with expect. However I am having troubles, In order to test out expect, I have created the following:
test.sh

[Code]...

It looks as if the second input is completely ignored ?! what i am doing wrong? or if there is a more elegant solution to running a script from a script with user inputs?

View 2 Replies


ADVERTISEMENT

General :: Create BASH Script To Process Multiple Inputs On Read

May 26, 2010

First post from a very new Linux user....I am trying to create a BASH script that will allow user to provide multiple directory names, Checks if the directory exists and if not create the directory.

I am using the following code:

Which works fine as long as the user enters a single directory name. How can I modify this so it will process all directory names user enters on the read response?

View 5 Replies View Related

General :: How To Make BASH Script Yes / No User Input Query Terminate With 3 Invalid Inputs?

Mar 16, 2010

I have a BASH script which at one point asks the user a yes/no question. I want to make it so that if the user types in an invalid input 3 times consecutively then the BASH script will echo an error and terminate with exit status 1.

View 9 Replies View Related

General :: Expect: Line Seems To Match Exactly However Expect Thinks Not?

Jun 16, 2010

I am writing an expect script. At a certain point there is a rule that produces this debugging output:

Code:

expect: does " Address or name of remote host [x.x.x.x]? " (spawn_id exp8) match glob pattern " Address or name of remote host [x.x.x.x]? "? no This just times out When I use -exact for the expect keyword it does work What am I doing wrong? THe first should also match in my opinion because it is equal as well. Even if I remove the I still have the same issue if I try without -exact. I don't understand. I tried removing the but still got the same.

View 5 Replies View Related

Programming :: Expect Command And Multiple Arguements?

Oct 4, 2010

I have the following code which I've thieved from here, there and everywhere:

Code:
[root@localhost /]# cat autossh
#!/usr/bin/expect -f

[code]....

View 3 Replies View Related

Programming :: /usr/bin/expect : Script To Check Server Load Using Both Expect And Bash?

Jul 27, 2010

I am trying to make a script that can be used to check server load on a remote server and produces sound on our local machine, when server load exceeds a particular limit.1. I want to execute command uptime or uptime | awk '{print$10}'on the remote server and store the result in a variable(say x), and later use it in the bash script.

Bash Part
#!/bin/bash
x=$(/root/Desktop/exp)

[code]...

View 1 Replies View Related

Ubuntu :: Good Expect Tutorial For Programing With Expect?

Nov 2, 2010

I'm trying to Use Expect to automate a curl function. basically I don't want to type enter for my script to run. Can anyone point me to a good Expect tutorial?

View 1 Replies View Related

General :: Change The Value Of The Inputs In Sed While Looping?

Feb 21, 2011

how to change the value of the inputs in sed while looping

As such:

for i in `seq 1 10`; do
"do something funny, using OpenFOAM"
cd system
sed 's/oldvalue/oldValue+increment/' -i sampleDict
cd ..
done

So basically, can you for instance create a constant "a" and increase it for every loop interval and use it for sed?

View 2 Replies View Related

Programming :: Expect Script: Send Function Key F12 In An Expect Script?

Nov 19, 2008

I'am new to expect how do i send function key F12 in an expect script?

View 1 Replies View Related

General :: Not Able To Come Out Of Expect / Sort It?

Jun 28, 2011

I am using expect command to pass password to my script.

like code...

it will send password properly, but after that it will not come out of expect to bash.

View 4 Replies View Related

General :: Embed Expect In Bash Script

May 14, 2010

I am trying to embed expect in my bash script to perform some tasks

USER="username"
PASS="password"
NAMES=`cat full_list`
for i in $NAMES
do
echo $i

[Code]....

The script initially reads a files containing a list of rpm's on each line and then spawns the rpm2ipc command which uploads the particular rpm to a repository. During this process it tries to enter the credentials, where it is failing.

View 3 Replies View Related

General :: Create A Expect Script To Input Username And Password?

Mar 21, 2010

i was able to input it directly from the script using this code

Code:
#!/usr/bin/expect -f
set USER "bibingeorge"

[code]...

View 5 Replies View Related

General :: Using The Expect And Send To Execute List Of Commands Inside A File?

Feb 2, 2011

i am working on some kind of PBX and i have list of telephone numbers inside a file, i have to insert these numbers into the correct command and then telnet to a remote server and execute these commands. i can read the telephone numbers and insert them into the command with no problem, but when i try to insert these commands into the send i face problem. here is the basic code

#!/bin/bash
read msisdn < input
string="ZZZZ:MSISDN=$msisdn;"

[code]....

i can make external loop inside the Bash which read the input file and issue the command and then telnet and execute, but this will make the script connects and disconnects again for each line which cause high load on that server and hardwar problem. i am wondering if there is an option inside the expect interperter which makes the send read directly from a file... somthing like this:

expect "<"
send "input-filename
"
expect "<"
expect eof

View 1 Replies View Related

Red Hat / Fedora :: How To Add Multiple User With Same Uid

Aug 31, 2010

Can we add multiple user with same uid....

View 3 Replies View Related

Ubuntu Multimedia :: No Sound Inputs Available?

Jan 6, 2010

I can't seem to get my microphone working. I've gone into Sound preferences in Sound Recorder and there aren't any options for sound input, only the one sound output option "Internal Audio"

I'm using the Input and Output jacks on the motherboard.

Anyone know what I can do to get this working?

I've been using Ubuntu for a few weeks, I'm trying to switch.

View 5 Replies View Related

Ubuntu :: How To Delete GRUB Inputs

Nov 27, 2010

When i boot and GRUB loads there are too many options for ubuntu.There are like 7 different ububt options(i think it's for different kernels) and last the windows partition.Is it possible to get rid of some of the old kernel options

View 5 Replies View Related

Hardware :: Ps2 And Usb Ports Won't Recognize Inputs

Sep 19, 2010

He doesn't do anything except emails, Internet search and sort pictures and I don't think he or his wife do anything I haven't shown them. The computer is an older model but I'm unsure of the brand, the motherboard is Intel entry server S845WD1-E. Recently his mouse stopped working, then his keyboard. I am going to try a ps2 card (the ps2 is internal to board). We are unable to use a usb mouse or keyboard. I have installed a new usb card but that did not work. I've tried different memory but have not run memck on it with another computer. After trying several suggestion from various support sites, including Intel, I finally cleared CMOS, removing the battery and then reset jumpers. Now I can enter Setup, but of course can't use the keyboard to change the settings in BIOS. I want to load CD-ROM first, but can't access via keyboard to change. I suspect the motherboard is going out, but still have hope. This couple is elderly and fixed income so I'm trying to milk it for all I can. I can use his HD on my system just fine.

View 1 Replies View Related

General :: TV Tuner Software "no Signal" - Error: "MythTV Is Using All Inputs But There Are No Active Recordings"

Feb 6, 2010

I am using Ubuntu 9.10. I have downloaded MythTV frontend and attempted installing and using Hauppage USB WinTv -HVR 950Q tuner. On TVTime I get "no signal". I attempt configuring source but ge nowhere. I have used MythTv backend to set up tuner. It recognizes the tuner, but when I select "Watch TV" I get the message: "Error: MythTV is using all inputs but there are no active recordings?"

View 1 Replies View Related

Ubuntu Servers :: Multiple User For A Web Server?

Jan 15, 2011

create an Apache web server with multiple user accounts, for work. Each user needs to be able to upload his/her files via SSH Each user needs his/her own web directory, (preferably in their home directory for ease with permissions) There web directories need to be password protected Only one user account (mine) should be allowed remote SSH control. It needs to be easy to add new users to the system.

View 1 Replies View Related

Red Hat / Fedora :: Creating User In Multiple Groups?

Aug 7, 2009

I created a user and I want the particular user in multiple groups. How Should I and after creating the user,If I want to delete that user from a particular group.

View 1 Replies View Related

Red Hat / Fedora :: Create Multiple User Account With UID?

Mar 15, 2011

Our requirement is to create multiple user account with UID:-

/tmp/users.txt
rohit
guna
samsir

like this 100 user names in /tmp/users.txt file

/tmp/uid.txt
2001
3789
1000134
like this 100 UID's in /tmp/UID.txt file

The script should take input from both the files and create user account. for example user account rohit should have an UID of 2001 and user samsir should have an UID of 1000134.

View 2 Replies View Related

Security :: Prevent Same User Ssh To The Multiple Server

May 23, 2010

how to prevent same user from ssh to multiple linux server at a same time , anyone of you have the script or how to do that ?

View 16 Replies View Related

Red Hat :: Create Multiple User At A Time In Rhel?

Feb 21, 2011

How can i create multiple users at a time in rhel?

View 2 Replies View Related

General :: Use 'iw' To Create Multiple Virtual Interfaces To Connect To Multiple Networks?

Oct 26, 2010

I'm trying to connect one computer to two others in an ad-hoc infrastructure.

[computer 1] ---- [computer 2] ---- [computer 3]

computer 2 is running Linux and has a single NIC wlan0. I want to it to connect to both computer 1 and computer 3 so each computer can talk to the other. No switch is available so it needs to be an ad-hoc setup.

[Code]...

View 1 Replies View Related

General :: Rename Multiple Files In Multiple Directories/subdirectories Recursively?

Aug 23, 2010

I am to rename all the files within a directory (which contains multiple subdirectories) recursively without invalid characters.

I tried the coding posted above.

find . -type f -printf '%p
' | while read file; do
oldfile=$(basename "$file")
newfile=$(echo "$oldfile" | sed 's/[^A-Za-z0-9_.]/_/g')
if [ ! "$newfile" == "$oldfile" ]; then
echo mv "$file" "${file%$oldfile}$newfile"
code....

but I get an error on both of them stating "find: bad option -printf find: [-H | -L] path-list predicate-list"

View 9 Replies View Related

Debian Configuration :: Preventing Multiple Instances Of User?

Sep 6, 2010

Currently, a user is able to log into multiple terminals simultaneously, creating a copy of their roaming profile on each, and potentially causing problems if the instances are logged out in the wrong order. Is there any way to prevent this, so that if a user has logged in on a machine and not logged out (and perhaps some timeout has not yet expired) then their login attempts on another machine will be rejected.

View 2 Replies View Related

OpenSUSE Install :: User Locked Out After Multiple Passwords?

Dec 5, 2009

I am having a problem with some users who get locked out after more than 3 failed attempts at login. This is exactly what I want to see - they will eventually remember those stronger passwords (maybe?) - but how do I re-enable their access? I haven't tried this on a live box but I can easily recreate the situation via vnc to the server in question and I assume the result would be the same. I like the policy that leads to this but I do need to let them back in - eventually. Where is the blacklist kept and how do I edit/reset it?

View 3 Replies View Related

Ubuntu :: Disable Multiple Logins For A Single User?

Apr 5, 2011

I'm trying to disable multiple logins for a single user on Ubuntu 10.10 but I haven't been able to find a way to do this on this version

View 4 Replies View Related

Ubuntu :: Adding Multiple User Account With Different Priviliges?

Jul 28, 2011

I have a desktop which has both windows and ubuntu. I want to add some users in ubuntu, say Me (first user),B and C. i) Certain folders should remain inaccessible from windows partition.ii)Me should be able access both B and C home folder, but not otherwise.iii) user B can access user C, but user C cannot access user B.

View 5 Replies View Related

Software :: Monitoring User Account Used By Multiple Users?

Feb 3, 2011

I am in the process of setting up a user account for an SFTP server that will possibly be used by multiple users. I am aware of the security risk involved, but it is a necessary evil.

I am trying to come up with an effective means of monitoring the user account. So far I have a script that runs the finger command, and emails me once an hour. Is there something else that I can do to keep a close eye on the account?

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved