Server :: How To Get Subshell Multiline Output
Aug 30, 2010
I'm putting together a small bash script which uses diff in a sub shell.
RESULT=$(diff file1 file2)
This is the first time I've tried to return multiline output from a subshell - how can I get this to display as multiple lines instead of one?
View 4 Replies
ADVERTISEMENT
Mar 3, 2011
I am doing some NSCA log parsing and I want to get an output like this:
2011-Feb-18:11:00:07
2011-Feb-18:11:00:07
2011-Feb-18:11:00:07
2011-Feb-18:11:00:08
2011-Feb-18:11:00:08
[Code]....
I have tried this, but it treats the entire output as a single line, then plops a timestamp on the end (I think):
Code:
sort -b -k4.9,4.12 -k4.5b,4.7Mb -k4.2,4.3 -k4.14,4 foo.log| date -j -f "%Y-%b-%d:%T" "+%s" "`awk -F '[ [/:]' '{print $7"-"$6"-"$5":"$8":"$9":"$10}'`"
View 1 Replies
View Related
Mar 3, 2011
I am doing some NSCA log parsing and I want to get an output like this:
2011-Feb-18:11:00:07
2011-Feb-18:11:00:07
2011-Feb-18:11:00:07
[code]...
View 6 Replies
View Related
Sep 8, 2010
I want to run some parts of a script in different terminals. I already found about subshell, () using parenthesis to group commands and using xterm -e (function), problem is I cannot get pid for the function running in the other terminal. And if I use & to set the job in background the terminal goes away as soon as it ends the job. I am using log files, and then send it them using built in mail. After all the parts finish I have to run the "main" script which needs the data from all the pieces. Also other question, i usually use bash, but to load a tool i need csh, the tool is not mine so i can not change the csh usage. There is anyway of passing bash scripts/commands at the moment of changing/invoking to csh shell in the same console?
View 14 Replies
View Related
Mar 17, 2010
I am stuck at a issue in shell scripting. I had tried all the possible ways, yet unable to reach a solutions. I am working on a application, which runs on C shell. For this I had created a installation script, which installs my application in the system, it is working fine. Now, the problematic part is that I had set an alias in ".cshrc" file, which invokes my application when any user types it. But for an alias to take effect, I need to re-login into the system, because I have to read ".cshrc" file again, in order to take effect of my alias. However I can use "source ~/.cshrc" file after my installation, so that my aliasing works without logging back again. But Requirement is that, just after installing the application, alias should be available to user, without logging back again and without issuing any extra command.
I had tried one other way is that, I had created a symbolic link in ~/bin directory, which points to my application to be run, but even that require, to issue rehash command in order to modify internal command hash table. So, my overall problem is that changing alias in subshell should be reflected to parent shell,without running any other command (all commands should be run in installation script only). Or, in other way how to rehash parent shell from subshell. The ultimate requirement is that,the command that will run my application, should be available just after executing the installation script, either by aliasing or by rehashing, or by any other means.
View 9 Replies
View Related
Apr 29, 2011
Is there any way to use "export" inside a bash script that will affect the variable in the parent process (i.e. the terminal where the script was run)?
View 5 Replies
View Related
Sep 24, 2010
I was reviewing some scripts written by a person that does not work with us anymore and I found a chunk of code I'd like to know more about.
Code:
mycli <<! >> /var/myprogram.log
command_1
[code]...
View 2 Replies
View Related
May 24, 2010
I am working on linux server with below specifications.Linux EDT 2008 i686 i686 i386 GNU/LinuxWhile checking the status of the server using the command 'opmnctl status' and when server is down the output is not getting redirected to file.I m using the command as,opmnctl status > abc.txt.
View 2 Replies
View Related
May 10, 2010
I have the following Cron job scheduled on my Postfix mail server: Code: 00 18 * * * /usr/bin/clamscan -r --remove /home/.This is just running a scan on my entire /home/ directory and removing any infected files it finds. My question is since this is being ran at 6pm via Cron, how can I get the results of this job emailed to me via text? Does anyone recommend a command I can add to the end which will dump the results into a file or email and send it to a specific email address? This server is my company Postfix MTA for everyone.
View 14 Replies
View Related
Jul 23, 2010
Is there a way to limit the amount of data that goes in to an rysnc log. The problem I have is that I email myself the log file to make sure it went ok but sometime the log is hugeHere is what I am doing with rsyncrsync -azHK --delete-after /home/ /mnt/usbbackup/home/ >/backup-log/backup.txt
View 1 Replies
View Related
Jun 5, 2011
how should I read below output of lm_sensors ? Im interested ONLY with temp1 and temp2.I suspect that temp1 presents motherboard chipset temp and temp2 CPU temp. I hope this is like this... but I have no 100% assurance.
Code:
~# /usr/local/bin/sensors
w83697hf-isa-0290
[code]....
View 3 Replies
View Related
Dec 28, 2010
In our server,top shows "si" with high number! softirq is very high on this server,approximate 90% on one core. How can I determine reason of this problem? Is there any way that I can determine cause of these softirq?what application or hardware generate these softirqs.
View 1 Replies
View Related
Apr 29, 2010
has no MTA (Postfix, Sendmail, Exim) installed so it can't email me the results of any cron job I schedule. I would then like to have the results from Cron be dumped into a small text file so I can read it later to view any issues.Right now my job is as follows:Code:01 18 * * * /usr/bin/shellscript.shAbove you see my script I want to run every day @ 6:01 pm. My question is what would the cron line look like if I wanted the results dumped into a random text file somewhere on my system?
View 1 Replies
View Related
Feb 12, 2010
I have installed opennms and net-snmp-5.5 in ubuntu9.10.Both are working properly but, i dont know how to get snmpwalk,snmpget,snmpset outputs in opennms.
View 3 Replies
View Related
Mar 28, 2011
The following is a script for making the bdf output of HP-UX in a human readable form .
Syntax for running the script is :-
# bdf | bdfrefine.pl
The output will be displayed in KB ,MB,GB or TB as per the disk space . Script details :-
#!/usr/bin/perl
######## SCRIPT FOR USER FRIENDLY bdf OUTPUT ##################
##-----------------------------------------------------------------######################
################# SLURPING INPUT ######################
##-----------------------------------------------------------------######################
[code]....
View 10 Replies
View Related
May 3, 2011
When I run 'sendmail -bv', it sends the mail delivery status report as a mail to the root. Is there a way I can redirect this to the console instead of sending as a mail. requirement is to programatically find the mail host of the recipient for which I thought of using this 'sendmail -bv' command. Is there any other better way to find mail host of the recipient
View 12 Replies
View Related
Feb 16, 2011
Iam comparing 2 filesystem using the below command.rsync -navrz --exclude=logs/* /opt/otm/ glrrd@105.78.7.100:/opt/otm/The output showing the files which are same in size and timestamp that are to be sync.Iam using rsync 2.6.3 version so i dont have itemize changes option to debug the problem.Is there anyway i can find the how rsync is finding the difference between the 2 filesytemEx: filesystem1
-rw-rw-r-- 1 glog glog 39132 Nov 26 2009 FinJ-code_2003-10-22_12h17_CEST+0200.jar
-rw-rw-r-- 1 glog glog 39132 Nov 26 2009 finj.jar
-rw-rw-r-- 1 glog glog 954987 Nov 26 2009 jakarta-taglibs-standard-1.1.2.zip
[code]....
View 3 Replies
View Related
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
May 25, 2011
I want to search for 1 file (say test.txt) on first server and all the output of this search to be greped as per my requirement and then transfered on the second server at the same location where they were on first server.
E.g.
output of search of file (test.txt) >> output.txt
/tmp/test.txt
/home/cpan/test.txt
/opt/cpanel/test.txt
Now I want to grep this output to only related to cpanel,
for f in 'cat output.txt'
echo $f | grep "cpanel"
if [ $? -eq 0 ]
then do scp.
But I am bit confused here, as in how to use scp command here.
scp $f root@second_server:/$f ?
View 3 Replies
View Related
May 18, 2009
I need to output of the script to the remote server via redirect. I created a simple script for your reference.Quote:
#!/bin/bash
W=`/usr/bin/w`
FREE=`/usr/bin/free`
[code]...
View 4 Replies
View Related
Jul 14, 2010
I am writing a script which will fetch data from different machines and display it on single terminal. I have created a file named SERVERNAMES containing ip address of machines I need to monitor. Then for every IP I am issuing ssh command to get date on that machine. However When I am trying it on the script it is just giving me output of first server and it is ignoring rest servers mentioned in file. ssh works fine without password for all machines mentioned in SERVERNAMES.
Code:
# cat SERVERNAMES
10.180.45.231
10.180.45.235
10.180.45.238
10.180.45.211
Script
Code:
#!/bin/bash
while read line
do
#Calculate Load on remote machine.
Date=`ssh -T -q $line date`
echo "Date on $line is:$Date"
done < SERVERNAMES
Code:
output.
Date on 10.180.8.231 is:Wed Jul 14 10:48:46 IST 2010
I am not getting the output for .
Code:
10.180.45.235
10.180.45.238
10.180.45.211
Is there anything wrong in ssh?
View 5 Replies
View Related
Oct 3, 2009
Consider the two runs of finger command for two different users:
Code:
[root@localhost ~]# finger root
Login: root Name: root
[code]...
View 3 Replies
View Related
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
May 2, 2010
I have apache 2.2.3 installed with php5 and libapache2-mod-php5. The server displays web-pages fine, but when I try to load a .php file, nothing shows up. There aren't any errors, not in the browser and not in the Apache2 error logs... just nothing shows up. When I look at the page source on the browser, all the HTML code is there, but all the PHP code is gone, as though it was parsed. I can't get any output to show up though, echo and print both do nothing.What could be the problem?Example:
Code:
<html>
<body>
[code]...
View 7 Replies
View Related
Jan 20, 2009
when the user clicks a button (assume war application) and the action'system.out.println' a message, how can I *remotly* read this message (read the message from a different computer instead of the server)?when I use the eclipse, I can read it from the console but if I'm in adifferent location, how can I see this message remotely?I'm thinking about remote debugging (JPDA), however, it's very difficult to configure in order to make JPDA run. I tried based on tutorial of google search, bug failed.I wonder if remote debugging can actually solve my problem. If not, is there any other to solve
View 1 Replies
View Related
Apr 29, 2010
I cant seem to get the sound working and when I click on perference then sounds and go to the output selection it has only dummy output as a option.
View 3 Replies
View Related
Mar 7, 2010
I installed KMplayer but I cant play video files...No video output but can get only the audio output...So how to make this work for videos?
View 2 Replies
View Related
Jan 25, 2011
Running 10.10 and win 7 on my HP dv6-2150us laptop and I'm having a few issues.
First how do I get HDMI audio output to my TV? I think I have just a integrated Intel graphics card. It works fine in windows but I can't seem to get it to work in Ubuntu. I tried searching but couldn't find anything pertaining to this issue.
View 3 Replies
View Related
Sep 27, 2010
I'm using pulse audio sound server in opnsuse 11.3 and latest version of flash player, The problem is playing video or sound with flash player in firefox, Once I play something in firefox sound output it seem like closed to other applications like amarok.
View 3 Replies
View Related
Jun 15, 2010
I have a ubuntu server running on a ten year old desktop and it runs great but i cant seem to change the video out put away from the normal anolog port to a TY port.My server is just for home use and I do not know the terminalThe reason I need to move to the other port is I do not have a screen for it but I do have a little old TV that will work.
View 2 Replies
View Related