Programming :: Bash Script - Executing Answer To Another Script?
Nov 4, 2010
I have a simple BASH script that I want to make it execute USERNAME and PASSWORD to another bash script and htdigest. But After passwd, with htdigest and the script rustart, I have to manual enter the answers.
#!/bin/bash
echo -n "What is the user name?"
read -e USERNAME
[code]....
Quote:
This will ask me for username and password, but I want it to take the username and password from $USERNAME and $PASSWORD
service rustart restart
Quote:
This script needs a username to restart another exec, but I don't wana have to manually type in the username, I just want it to automatically fill in the $USERNAME
View 4 Replies
ADVERTISEMENT
Jan 24, 2011
I'm trying to create an SSL certificate and answer the questions inside a bash script. The command used to create the SSL certificate
Code: openssl req $@ -new -x509 -days 365 -nodes -out /etc/apache2/apache.pem -keyout /etc/apache2/apache.pem
The first question asked is. Country Name (2 letter code) [AU]:
View 4 Replies
View Related
May 18, 2010
How can I set the outgoing port for the socket? In wireshark, my outgoing port is 1024, and i want to set it to 6800 (or a similar port) I see the outgoing broadcast-message in wireshark, but no answer. There are three ECU's in the LAN, which should answer. The following code is a mixture of C/C++ and jointed from different articles:
[code]...
In wireshark I can only see the outgoing message. But the "recvBuffer" (in the lower part of the code) contains the same content as the sendBuffer. Is it right, that I need a sender and further more a receiver? Or should I receive the broadcast-answer on the same socket on which I send the bc?
View 5 Replies
View Related
Feb 12, 2011
I'm trying to execute the following command within a bash script:
Code:
tac /var/log/system.log | head -1
The script I wrote is:
[code]...
View 1 Replies
View Related
Dec 10, 2010
I have been searching for 90 minutes for something that I "think" should be fairly easy. I'm pretty new to Bash Scripting so I could be completely wrong. Then again it may be a weird request to even need something like this. But here it is.I have a script written to convert data from one of our software version to another. The only thing I need to add to it is a "check to make sure the user running the script is in the /tmp directory".
View 7 Replies
View Related
Apr 9, 2010
I have a TCL framewrok for my test cases automation. This is been working for last 1 year. But yesterday it exited with exception when a function was called. The exception was given as fork: not enough memory while executing "spawn bash"(procedure "runtrigger" line 36) invoked from within "runtrigger $fnAfter $sid_l $mapver" ("trigger" arm line 6) invoked from within
View 4 Replies
View Related
Dec 22, 2010
It could run on my computer. But there is no result.
[code]...
View 1 Replies
View Related
Jun 20, 2010
i m using atoi() to convert char value to int. and then passing that int as a swtich variable.switch goes in a case and exectuing that particualr function but returning 0 value....for example: i am finding no of process() and system up time().when switch program goes in system up time it gives right values means correct no of days, hrs , min and sec but when it goes in no of process() it gives 0 answer.
View 8 Replies
View Related
Jun 7, 2010
I have a CentOS system totally devoted to a 500GB disk. I have an additional disk mounted via an external device that will not execute scripts that are located on that device.
Current hardware configuration:
Quote:
t [root@localhost ~]# fdisk -l
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 60801 488279610 8e Linux LVM
Disk /dev/sdd: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdd1 * 1 42261 339457466+ 83 Linux
/dev/sdd2 42261 60801 148925985+ 5 Extended
/dev/sdd5 59372 60801 11486443+ 82 Linux swap / Solaris
/dev/sdd6 42261 58671 131814400 83 Linux
/dev/sdd7 58671 59371 5623808 82 Linux swap / Solaris
Partition table entries are not in disk order
[root@localhost ~]# uname -a
Linux localhost 2.6.18-194.3.1.el5 #1 SMP Thu May 13 13:08:30 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]#
View 17 Replies
View Related
May 20, 2010
I am trying to write little quiz to give different answer when given yes or no reply, however I got stuck with this. I am very very new to Python so please have patience. Can someone give me a sugesstions?
This is my code so far:
name = raw_input("
What is your name")
print "
Hello, " + name + "."
[Code]...
View 8 Replies
View Related
May 22, 2010
Code:
tupe=("File",("Open","Open a file"),"Edit",("Cut","Cut a file"),("Paste","Paste a file"),"About",("About","About the program"))
menutitle=""
menupos=0
for items in tupe:
if type(items)==str:
[Code]...
I'm trying to understand how to make "File" be the parent information for "Open","Open a file" and "Edit" to be the parent of "Cut, Cut a file" and "Paste", "paste a file". Does anyone have a suggestion for accessing the a nested tuple in this manner? The above code does not quite do what I want it to. The above code is for visual purposes, but I'm learning how to refactor for wx.python.
View 3 Replies
View Related
Jul 31, 2011
I wrote bash script that uses zenity and a choice to install various programs, tested it and it works, but only when I call it from terminal. I wanted to add it in gnome main menu. The script is /home/eee/zenity.sh. In accessories I added an entry with command:
Code:
/home/eee/zenity.sh
, but since there is no terminal it starts zenity, but it does not work. I have also tried
Code:
gksu gnome-terminal -x /home/eee/zenity.sh
[Code].....
View 4 Replies
View Related
Mar 3, 2011
Why is the timer not executing?
Code: #include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <signal.h>
#include <time.h>
#include <pthread.h>
void func(union sigval sv)
[Code]....
View 1 Replies
View Related
Aug 24, 2010
what we are trying to do is, to let the customer click a button in the web browser, and then the web server to call a shell script to do the work. The output from the stdout && stderr of the script should be displayed in the web browser once finished or timeout, along with the exit code of the script.
The shell script is however not on the web server, but on another app server. So to call this script from the web server as the identity 'tomcat':
Code:
$ sh appuser@app-server:$appbin/app-script
The .ssh/id_rsa.pub thing is done, and we have no problem doing this in the command line so far.
Our loaded ex-colleage has left us the webpages (jsp) with code like these:
Code:
<%@ include file="jsp_functions.jsp" %>
<%
String cmd = "sh $appbin/app-script";
ExecResult r = new ExecResult();
[Code].....
View 6 Replies
View Related
Oct 13, 2010
I am having the following error while executing script and initialing my application
./ss.sh: line 1: kk.sh: command not found
./ss.sh: line 2: mon.exe: command not found
Can somebody assist ASAP.
View 4 Replies
View Related
Nov 2, 2010
I have an application, probably cpu-intensive because sometimes it leaves the cpu with 0% idle (in top). Sometimes it hangs ("Done" does not print) when executing this part, but most of the time it executes just fine. Is there any wrong with this code?
View 2 Replies
View Related
Aug 25, 2010
I need a way to read and delete text found before a unique string, then delete the string. I would like to have the text stored in a variable--or better yet--executed it as a shell script directly.I intend to execute the stored text in bash. It does not matter much what language the program is it, however efficiency is desirable. This script is not going to be used on large files, but it may be executed many times sequentially so the faster the script works the better. Here is an example:
exclamation-"It worked!"
echo $exclamation
cd
[code]....
View 7 Replies
View Related
Jul 8, 2011
I need to execute an external command with Python from Web. I know there is subprocess module that executes external programs but I'm trying to execute a command registered for the execution of a program. In this case when I execute my file in the shell everything is Ok, but from the Web it doesn't work.
View 1 Replies
View Related
Mar 20, 2010
what i did is created a file called pro3types but the script starts & by pass the file. i added +x to file ran the process but still no luck. i was wondering what else i should change to get the menu to the sub-categories of product3 after users selecting it. all I need to get the pro3types runs after users selecting product3 from the previous menu. need more info please see the thread: "Adding New Selections to the existing Script"
[URL]
but here is code:
Code:
#!/bin/sh
echo SELECTTYPE
export -n selecttypechoice
[code]....
View 5 Replies
View Related
May 25, 2011
I am learning about OS and I wrote this simple forking program... Here's the code..
Code:
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
[Code].....
How can it print the first statement, that is BEFORE the fork() statement twice?
I am running Natty 11.04 btw..
View 8 Replies
View Related
May 6, 2009
I am fairly new to linux still and I'm currently trying to write a shell script (which I have never done) that is supposed to run the xrestop(like top) program. What I want to do is execute the program and check the identifier column to see if a certain program is running. If it is running I want to strip the data from that row of the terminal say every 5 seconds or so and put it in a text file. Is this going to be a complicated thing?
Heres a list of the columns when you run xrestop program res-base Wins GCs Fnts Pxms Misc PxmMem Other Total PID Identifier.
View 9 Replies
View Related
Feb 4, 2011
I would like to know how do I print the line # in a script. My requirement is, I have a script which is about ~5000 lines long. If there are any errors happen I just exit. And I would like to add the line # of the script where the error happened.
View 3 Replies
View Related
Jan 24, 2010
simple bash code:
Code:
#!/bin/bash
trap "echo 'you got me'" SIGINT SIGTERM # to trap ctrl+c
echo "Press ctrl+c during 5 sec loop"
for ((i=0;i<5;i++)); do
[Code]...
How come code behaves normally and stops when ctrl+c signal is caught and resumes, but after I use at least one timeout read in the code it looks like, if signal is caught again it doesn't pause the execution but skips the loop. If you remove -t (timeout) option from the read, both loops look the same!
View 10 Replies
View Related
Nov 26, 2008
I have a config file that contains:
my.config:
Code:
Now in my bash script, I want to get the output /home/user instead of $HOME once read. So far, I have managed to get the $HOME variable but I can't get it to echo the variable. All I get is the output $HOME.
Here is my parse_cmd script:
Code:
View 3 Replies
View Related
Jul 25, 2011
I have written quite a few separate bash & scripts and php scripts that up to now I have run from cron jobs. However I have to estimate how long each takes to run, before running the next and so it probably takes much longer than necessary to run them all. They have to run in order.
Now there are so many I am thinking it would be better to have a master bash script that would run one after the other, but I am not sure how to get the master script to wait before starting to run the next script. Is this possible and is there a command that will make the script wait between bash and php scripts , for them to finish, before running the next?
View 5 Replies
View Related
Apr 7, 2011
I'm still a but confused about the standard way of removing it for left-associative operators: [URL] Especially about how to construct an AST from it by executing a peice of code for every nonterminal matched. And I'm still not totally convinced that it will be left-associative, I just barely understand it. Also, how would you remove left-recursion for something like this:
Code:
expr ::= expr "(" param_list ")"
| other stuff...?
View 8 Replies
View Related
Jan 9, 2010
I would like to get the filename (without extension) and the extension separately. The best solution I found so far is:
Let FILE="thefilenameofsomefilesfor_instance.txt"
Code:
NAME=`echo "$FILE" | cut -d'.' -f1`
EXTENSION=`echo "$FILE" | cut -d'.' -f2`
I think it would be better to count the len and remove 3 chars to right to get the extension, but it can be macintosh filenames with have 4 chars for extensions.
View 5 Replies
View Related
May 8, 2009
wanted to know if i can execute commands on linux console through a web page and redirect it back to my web page !For example :if i send a query "ls"it should execute this command on my linux console and also redirect the list of the files to the web page from which i give the command !
View 8 Replies
View Related
Nov 11, 2010
I'm developing a Servlet which when it gets a request, it has to execute a command. I've tried in Windows and it works fine, but when I "install" my web app in Linux, if I try to execute the commands I get permission error.
An example of one command I'm trying to execute is: Runtime.getRuntime.exec("rm file_name"); -> This commands outputs that I don't have permissions.
If I add "su" before the command, how do I add the password?
View 4 Replies
View Related
Mar 31, 2011
I need to rename the resulted searched files from a loopI have the following code:
find . -name DOC* | while read i
do
find $i -type f -name '*.txt'
done
basically, I am searching for all txt files inside any folder starting with DOC name.this code is working fine with me.I need to rename those .txt files to .txtOLDOS: Ubuntu 10.4Bash shell
View 10 Replies
View Related