Programming :: Shell Script Ssh : Eliminate Login Process Output?

Jun 1, 2009

I use tcl-expect script to ssh to the server. How can I eliminate the first 2 lines if using system(./script.sh) to execute it, as the default output will be shown on shell and the first 2 lines are included.

Essentially I just want to have the "ps" result, not the login process. code...

View 1 Replies


ADVERTISEMENT

Programming :: Displaying Process Id In Shell Script But There Is No Such Process?

Nov 9, 2010

I have a shell script to identify whether the process is running or not. If the process is not running, then I execute another script file to run my application. Below is my script and saved this script as monitorprocess.sh Code: #!/bin/bash

result=$(ps -ef | grep -v grep | grep "applicationname.sh" | awk '{print $2}')
echo $result
if [ "$result" == "" ];

[code]...

View 4 Replies View Related

Programming :: Redirecting The Output Of Child Process To New Xterm?

Aug 2, 2010

I am developing a application. In this I fork() 3 childs(lets say child1 , child2, child3) . The parent is now waiting for some input from keyboard.Child3 is continously getting data from child1 and child2 using pipe which it then will print using printf.Now as the parent is waiting for input from user through keyboard while child3 is continously printing the data. I want to do it in different terminals.Can you please guide me how to proceed ahead so that on one terminal , the parent waits for input fromser while on other terminal child3 prints data.

View 1 Replies View Related

Programming :: Process More Than 3 Hours Old From Shell Command?

Nov 14, 2010

My server pretty often becomes full up php processes running which are not needed. Is there a way to search for and kill any php process that is more than 3 hours old?

View 7 Replies View Related

Programming :: Redirect Output To Files Using Shell?

May 21, 2011

I have a huge database of students, I would like extract these data and write to individual file for each students.

I am running a loop in shell program (.sh file), the output of each run in the loop need to redirected to a file with variable name.

I tried the following line, but it did not work, where BodyMsg is the data and Rollno is the students roll number.

echo $BodyMsg > $RolNo".html"

View 5 Replies View Related

Programming :: Modify Output Of Shell Script

Dec 3, 2010

I'm running RHEL5.5 and nagios 3.2.0. The real question deals with how to change the printed output so nagios will work with it.I have made a script that will calculate network throughput on interfaces. The script is going through and finding all interfaces (eth, bond, lan) and doing the math to calculate throughput.The output is mainly for nagios to report and trend the values. As nagios wants to see nothing but perf data after the '|' character, I somehow need to have only one '|' character for all of the output.

View 2 Replies View Related

Programming :: Expect: Prevent Output From Spawned Process To Appear On Stdout?

Jul 3, 2009

I have this expect process:

Code:
spawn -noecho telnet my.host.com
expect {

[code]...

View 3 Replies View Related

Programming :: Kill Process More Than 3 Hours Old From Shell Command?

Nov 15, 2010

My server pretty often becomes full up php processes running which are not needed.Is there a way to search for and kill any php process that is more than 3 hours old? as I understand it, i need to use ps piped with awk. awk at the moment seems very complicated to me, do not how to start tackling it.

View 5 Replies View Related

Programming :: Shell Script - Redirect Output To File

Sep 6, 2010

I did a select on my db and now I need that this if consult return true for me salve the columns information in file. How I do this in Shell?!

View 3 Replies View Related

Programming :: Start A Process And Send Input To It In A Shell Script?

Jun 9, 2011

I'm building a Linux From Scratch system and partially automating it. I will likely want to do it again, and I would like to try to almost completely automate it.

My current approach is a script that takes an input file and sequentially runs each line in a new instance of bash. If one fails, it gives me the number of the step that failed so that I can use the "--step" option to resume after I fixed the issue.

This has some problems:
A varible created on one line will not be accessible on the next line. This is because each line is run in a separate shell (the reason for this is so that the commands in the input file and the script's internal variables can't interfere). You can't switch users or use chroot, again because each line is run in a separate shell.

What would be nice is to be able to start a bash process in the background and send commands to its stdin. I guess that a named pipe would work, but the named pipe will be gone after a chroot. Is there a way to do it without relying on the filesystem? Also, how do I know if the command failed?

View 14 Replies View Related

Programming :: Can Expect Return Control Of A Spawned Process To A Shell Script

Nov 19, 2009

Is it possible to have an Expect script spawn an SSH session, log in, then go into interactive mode and give control of the SSH session to a Bash script? Here's a simplified example of the script so far:

Code:
#!/bin/bash
expect -c "

[code]....

View 4 Replies View Related

Programming :: Creating Array From Command Output (Bash Shell Script)

Jan 26, 2011

I have a command that outputs n lines of text, and I want to place each line into an array element, but I can't seem to get the syntax correct

So my command is this:
cat $configfile | sed -n '/cluster:'$clustername'/,/cluster/ p' | awk /host/

Which produces many lines depending on the value of $clustername. I'd like to get each line as elements of an array.

View 5 Replies View Related

Programming :: Going Through A Multi-step Process To Produce Output Files, Which Involves 25,000 Greps At One Stage?

Nov 8, 2010

I am going through a multi-step process to produce output files, which involves 25,000 greps at one stage. While I do achieve the desired result I am wondering whether the process could be improved (sped up and/or decluttered).input 1set of dated files called ids<yyyy><mm> containing numeric id's, one per line, 280,000 lines in total:

Code:
123456
999996

[code]....

View 14 Replies View Related

General :: Eliminate Ssh Login Delay Without Touching Sshd?

Mar 11, 2011

Whenever I login to a certain server using SSH I get a very long delay before a prompt appears. Everything I looked up on this issue says that it's a DNS issue and that I should disable reverse DNS lookups on the server.

But, the remote server is a shared webhosting server. I e-mailed the sysadmins but they say they have no DNS issue and that they won't change the server configuration. So, how can I fix this issue from my side (client side)? I have a static IP address and a hostname that points to it.

View 2 Replies View Related

Programming :: Eliminate Garbage From Buffer C++

Mar 4, 2010

Code:
char retBuffer[100];
recv(sock , retBuffer ,sizeof(retBuffer) , 0);

if i send a string smaller then my buffer size retBuffer always have garbage of the end of it....what can i do to eliminate tis problem ?

View 2 Replies View Related

Programming :: BASH Shell Differences: Login Or Interactive

Feb 18, 2011

Intuitively I think that the Login Shell and the Interactive Shell are the same applications but have access to different environmental variables.It this true? Why is there more than one type of shell anyways? You can change users with the interactive shell, why not log on with it to?

View 10 Replies View Related

Programming :: Show The Output Of Shell Command Into A Textbox, Ex Ps -efc Command?

Oct 20, 2010

I am using gtk to program GUI. How can I show the output of shell command into a textbox, ex ps -efc command ?

View 3 Replies View Related

Programming :: Awk To Sum Up Login Time Of A User From Output Of Cmd "last -a"?

Aug 17, 2010

output of "last -a" is as follows:

usr pts/3 Tue Aug 17 12:28 - 12:44 (00:15) dom1.broadband.za
usr pts/3 Tue Aug 17 11:06 - 11:25 (00:18) dom1.broadband.za

I need to sum up $9, which is 15+18, but the parenthesis come in way and sum comes zero.

last -a|awk '{sum=sum+$9} {print sum}'

What am I doing wrong?

View 10 Replies View Related

Programming :: Eliminate "ISO C++ Forbids Variable Length Array" Warning?

Jan 27, 2011

As subjected I have this warning message code...

How can I get rid of this warning message?

View 6 Replies View Related

Fedora Installation :: F13 To F14 No Shell At Login / After Upgrading Cant Login On User?

Jun 3, 2011

yesterday I updated my fedora 13 to fedora 14 (on laptop) and today i cannot log in on user. It just go blank for a sec and is back to login.

At text console (alt+ctr+f2/f3) i enter my username and pass it give this for a sec and resets (clean) console
username: Name
password:
last used: [date]
login: no shell permission denied

i used unetbootin (fedora 14 netinstall to update) and later i updated 1,5G before reboot (did update that fix, forgot its name tho :s)

I would most likely reinstall everything, but i have some work at laptop and as death-line is near, i would prefer to fix it if possible.

edited:
i have installed F13 on unused space, is there a way for me to access and fix it? or at least get some files from there?

View 1 Replies View Related

Programming :: Difference Between Init.rc Process And Normal Process?

Mar 31, 2011

Is there any difference in cpu usage for process in init.rc(runs automatic when boot is happened) and manually running process. Will these both have same priority by default...?

View 1 Replies View Related

Programming ::get The PID Of The Process Giving Kill Signal To A Process?

Nov 26, 2008

I tried googling but didn't get any answer for this.I have a process called "abc" and it is running with PID "123".I have a putty session opened with PID "999".I am giving kill -TERM 123 from putty session.My process "abc" before dying it should catch the PID of the terminal which provided TERM signal to it.Is there any way to find this out

View 2 Replies View Related

Programming :: Shell Scripting / Create A Shell Script Similar To Ls?

Jun 5, 2011

I am trying to create a shell script similar to ls, but which only lists directories. I have the first half working (no argument version), but trying to make it accept an argument, I am failing. My logic is sound I think, but I'm missing something on the syntax.

Code:
if [ $# -eq 0 ] ; then
d=`pwd`
for i in * ; do
if test -d $d/$i ; then
echo "$i:"
code....

View 10 Replies View Related

General :: Diffrence Between Login And Non Login Shell?

Feb 17, 2010

diffrence between login and non login shell. What does it mean by user enviorment.

View 3 Replies View Related

Programming :: Bash-shell-like Less Functionality In The Python Shell?

Jun 25, 2010

Is there some type of functional way to read things in the Python shell interpreter similar to less or more in the bash (and other) command line shells?

Example:

Code:

>>> import subprocess
>>> help(subprocess)
...
[pages of stuff to read]
...

I'm hoping so as I hate scrolling and love how less works with simple keystrokes for page-up/page-down/searching etc.

View 4 Replies View Related

Server :: Set Process To Output To Apache2 Directory?

Aug 13, 2010

it seemed like the most accurate place. Also apologies for any inaccurate terminology, I'm a bit new at this. Running Apache2 on top of Debian 5.0

Anyway, I have irssi set to output logs to a folder accessible by my web server. User permissions are all set up, so it writes to the folder just fine, but when I access the server index in a web browser (i.e., page that says "index of /[directory] at the top) I cannot see the the directory or the logs that irssi is making. I can ssh in and see the folders and files in the terminal, so they are being created. How can I set it so these are viewable through the web server? I tried restarting the server, no effect.

View 1 Replies View Related

General :: Can't See The Output Shell In Child

Feb 4, 2010

I have following script.

Code:

#!/bin/bash
export VAR="shell"
echo " $VAR in parent "
bash
echo "shell in child "

If i execute this script, the output is just

Code:

shell in parent

Why can't I see the output shell in child ?

View 2 Replies View Related

Ubuntu :: Output Data To Running Process In Terminal?

Jul 10, 2011

There is text based game in the Ubuntu repos called gomoku (just 5 in a row) it comes with the package bsdgames. The manual page [URL] lists an option (-b) to run it in the background. I want to try that and if I know how it works create a simple graphical front-end. When I start the program with:

Code:
gomoku -b

it starts and remains active, the terminal does not return to prompt which is OK as the command is not finished. The manual says the program reads from stdin, and this might sound stupid but how to get anything there?

I've tried to pipe an echo command to gomoku which works but ends the program after is receives input.

Code:
echo "black" | gomoku -b

just finishes. After that when you type another command like:

Code:
echo "justsometext" | gomoku -b

gomoku tells it expects either black or white as input. So it forgot the previous "black" because it is a new instance.

How do I pass text to an already running gomoku?

View 2 Replies View Related

General :: Process The Output Of A Locate Command, Pipe It To What?

Sep 30, 2010

Is there a way to process the output of a locate command on the spot within bash. The output is 3 lines, ex:

Code:
[root@server confluence]# locate .timestamp
/opt/confluence/confluence-persistent/index/.timestamp

[code]....

View 3 Replies View Related

Server :: Mpstat Output Interpret And Process Info?

May 19, 2011

I've got a system that is maxing out CPU. Running "mpstat -P ALL 3 5" shows the following.

Quote:

08:30:21 PM CPU %user %nice %sys %iowait %irq %soft %steal %idle intr/s
08:30:24 PM all 100.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 1001.00
08:30:24 PM 0 100.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 1001.00

[code]....

All 5 groups show the same. My first question is why would CPU0 be the only one with intr/s and the others do not? Info.The OS is RHEL 5.4 running as a VM on ESXi 4.1. Memory doesn't appear to be an issue, the system has 8 GB and its only using about 1.5 GB. Second question, I'm positive the process that is the problem is the tomcat process. Does anyone know a good way to see whats happening with a specific process?

View 6 Replies View Related







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