Programming :: Blacklist End Up In File And $a End Up In Stdout?

Jan 22, 2010

In this example, why does blacklist end up in the file blacklist and $a end up in stdout?

[code]...

The desired result is to have a file containing the results of lsmod which had the first word on the line beginning with snd_ copied into another file preceded by the word blacklist.

View 4 Replies


ADVERTISEMENT

Programming :: Redirecting Stdout To File And Terminal And Stderr To File?

Apr 20, 2010

I have a script where I want to redirect stdout to the terminal and also to a log file aswell as redirecting stderr to the same log file but not the terminal.I have the following code which I found on the net which redirects both stderr and stdout to a file and the logfile,

Code: if [ -p $PIPE1 ]
then
rm $PIPE1

[code]...

View 3 Replies View Related

Programming :: Cannot Redirect All Stdout And Stderr Into File

May 12, 2009

I have a little complex Makefile system. A parent Makefile call dozens of Makefiles in subdirctories. And the subdirctory Makefile calles shell script to do real building. I want to grab all output this Makefile system generate. So, i employ "make 2>&1 > make.log". but not all output messages are filed into make.log. The message generated by sub-makefile called shell script cannot be recorded into make.log. And another curiouse thing is, if i launch "make 2>&1 > make.log" in a perl script, all output do be sent into make.log.

View 2 Replies View Related

Programming :: STDIN, STDOUT, STDERROR Redirection For Scripting - Bash: Log.txt: No Such File Or Directory

Sep 7, 2010

I'm writing a script to execute bash commands in the PHP CLI. I would like to suppress errors from bash and write my own error message if an error occurs. So far I have this (assuming log.txt doesn't exist!):

Code:

tac log.txt 2>/dev/null

Which works as expected, tac kicks up an error but the error is suppressed, but when I use this:

Code:

tac < log.txt 2>/dev/null

I get:

Code:

bash: log.txt: No such file or directory

The tac error is suppressed but bash still gives me a dirty error.

View 2 Replies View Related

Software :: Redirect Stdout To File Produces Blank File

Dec 27, 2008

I cannot redirect output from commands such as iptables, iptables-save, and ifconfig. For example, any of the following DOESN'T work ( as root ):

Code:
iptables > tmp
iptables-save > tmp
ifconfig > tmp
The file tmp is ALWAYS blank, that is, 0 bytes in size. Wackier things DO work, such as:

Code:
echo "`iptables-save`" > tmp
iptables-save | tee tmp
Other commands like:

Code:
ls > tmp
DO work as expected.

Note that this problem happens regardless if I log-in remotely via ssh or locally on the computer in question. I am clueless as to what is causing this. Any ideas?The box is running 2.6.25-14.fc9.i686 and boots to runlevel 3. The modifications I've made to the box since installing the OS are things like compiling/installing latest OpenSSH,OpenSSL,httpd,BerkeleyDB,subversion,zlib etc -- nothing really out of the ordinary I'd say.

View 5 Replies View Related

Programming :: Using Stdout For More Than One Task?

Jun 30, 2009

I want to parse my mail log file and reuse the results but I'm having a hard time structuring the syntax. Something like:

Code:

grep hostname /var/log/mail.log |
grep NOQUEUE: |
sed -e 's/hostname postfix/smtpd/[[0-9]*]: //g'

at this point I want to redirect what I have in hand to a file but also ... fork? or split? whatever the term, to continue onward so that I can pipe the results further into wc -l or sort or programX. without having to re-loop through that huge log file.

View 2 Replies View Related

Programming :: Pipe Output To 2 Files But Not STDOUT?

Mar 24, 2011

I want to have the output of a program go to 2 different files but not going to standard out. Is there a way to do this in bash? I know that in Z shell its really easy. omething like: Code: echo "test" >> file1 >> file2 Would work. But in Bash it doesn't seem that easy. I know that tee will send the output to 2 files but it also sends it to STDOUT.Something like:Code: echo "test" | tee -a file1 file2 Would put the word "test" in file1, file2, and STDOUT. Is there a way to just send the output to file1 and file2?

View 2 Replies View Related

Programming :: Capture The Stdout Of A Heredoc In A Variable?

Aug 12, 2010

Why doesn't this work?

Code:
cat | myvar=$(</dev/stdin) <<EOS
This is some content
EOS
echo "$myvar"

i have also tried several variants of cat in place of the redirection.

Code:
$(cat -)
$(cat)
$(cat /dev/stdin)

None of the variants print "This is some content"

I have a version that works:

Code:
myvar=$(cat <<EOS
This is some content
EOS
)
echo "$myvar"

but i don't like the syntax and it doesn't play nice in my editor with code folding.

View 5 Replies View Related

General :: How To Echo The File To Stdout

Sep 26, 2010

I have a process which logs output to log.txt. If I want to see the process's status in real-time, is there a way to echo that output to stdout instead of opening the log in a text editor and constantly reloading?

View 3 Replies View Related

General :: Able To Write On Stdout But Not In A File

Aug 16, 2011

I want to keep a trace of the URL I visit, so I use a command line like this:

tcpdump -ien1 -v -X 'tcp port 80' | sed -nl
's/^.0x[0-9a-f]{4}:.{43}(.)$/1/p' |perl break.pl |perl -pe
's/(GET|POST).(.*?).HTTP/1....Host:.([a-zA-Z._0-9-]*)../"
BEGURL

[Code]....

I also tried redirecting stdout and stderr to /tmp/out, it's still empty. The file has write access. I have no idea what it can be. Is there anything else than stdout and stderr?

View 2 Replies View Related

Debian Programming :: Stdout Piped To Awk -> Terminal Output Stutters

May 5, 2013

I'm piping stdout from mplayer to awk, but the output stutters.

Code: Select allmplayer audiofile.m4a 2>&1 | awk -vRS="
" '$1 ~ /A:/ {print $0; fflush();}'

Instead of a steady output of lines to the terminal, output only occurs after a few seconds, between 6 or 12. This happens whether the input is from mplayer or avconv/ffmpeg. This never used to happen (a few years ago) so I wondered whether an awk update caused this to happen.

View 6 Replies View Related

Debian Programming :: Assign Variable In Bash When Stdout Is Updated

Jan 17, 2014

I am writing a script that calls a program which writes a lot of lines to stdout continuosly. If the last line in stdout has some regex, THEN, certain variables are updated. My problem is that I don't know how to do that.

A simplified example would be (it's not my exact case, but it I write it here to clarify): suppose I issue a ping command (which writes output to stdout continuously). Every time that the response time is t=0.025 ms, THEN, VARIABLE1=(column1 of that line) and VARIABLE2=(column2 of that line).

I think the following code would work in awk (however, I want the variables in bash and I don't know how to export them)

Code: Select allping localhost |awk '{ if ( $8 == "time=0.025" ) var1=$1 var2=$2}'

In the previous code, awk analyzes each line of the output of the ping command as soon as it is created, so the variables $var1, $var2, ... are updated at the appropriate time. But I need the "real-time" updated values of $var1, $var2 in bash, for later use in the script.

View 7 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

Ubuntu Servers :: Log Stdout To File During Boot?

Nov 30, 2010

do you know of a way to redirect stdout during boot time to have a log of the entire process?

I have a remote server which is not booting and I would like to know at which point it gets stucked, what could I do?

View 3 Replies View Related

Programming :: Redirecting Stdin / Stdout And Stderr For Program Run As Fork()/execl()?

Nov 24, 2010

I'm trying to write a program that will fork a series of FTP sessions. For each session, there should be separate input and output files associated with stdin and stdout/stderr.
I keep reading how I should be able to do that with dup2() in the child process before the execl(), but it's not working for me. Could someone please explain what I've done wrong? The program also has a 30-second sniper alarm for testing and killing of FTPs that go dormant for too long.

The code: (ftpmon.c)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

[code]....

The output:

$ ftpmon
Connected to gila-crstest.gilacorp.com (172.16.20.8).
220 (vsFTPd 2.0.1)
ftp> waitpid(): Interrupted system call

Why am I getting the ftp> prompt? If the dup2() works, shouldn't it be taking input from my script and not my terminal? In stead, it does nothing, and winds up getting killed after 30 seconds. The log file is created, but it's empty after the run.

View 3 Replies View Related

Programming :: Redirecting Stdin / Stdout And Stderr And Finding Files Name And Other Stats?

Aug 8, 2010

I'm working on an application used for backup/archiving. That can be archiving contents on block devices, tapes, as well as regular files. The application stores data in hard packed low redundancy heaps with multiple indexes pointing out uniquely stored, (shared), fractions in the heap.

And the application supports taking and reverting to snapshot of total storage on several computers running different OS, as well as simply taking on archiving of single files. It uses hamming code diversity to defeat the disk rot, instead of using raid arrays which has proven to become pretty much useless when the arrays climb over some terabytes in size. It is intended to be a distributed CMS (content management system) for a diversity of platforms, with focus on secure storage/archiving. i have a unix shell tool that acts like gzip, cat, dd etc in being able to pipe data between applications.

Example:

dd if=/dev/sda bs=1b | gzip -cq > my.sda.raw.gz

the tool can handle different files in a struct array, like:

Code:

enum FilesOpenStatusValue {
FileIsClosed = 0,
FileIsOpen,

[code]....

Is there a better way of getting the file name of the redirected file, (respecting the fact that there may not always exist such a thing as a file name for a redirection pipe).
Should i work with inodes instead, and then take a completely different approach when porting to non-unix platforms? Why isn't there a system call like get_filename(stdin); ?

If you have any input on this, or some questions, then please don't hesitate to post in this thread. To add some offtopic to the thread - Here is a performance tip: When doing data shuffling on streams one should avoid just using some arbitrary record length, (like 512 bytes). Use stat() to get the recommended block size in stat.st_blksize and use copy buffers of that size to get optimal throughput in your programs.

View 4 Replies View Related

General :: How To Get Original Blacklist Conf File In Directory

Jan 6, 2011

I need advice in getting the original blacklist.conf of the directory /etc/modprobe.d/ because I erased and I don't know if that file could make me have some issues in the future, so if any body can lend me a copy of that file or refere me to some page where i can get it. Is for the slackware 13 32bits distro.

View 2 Replies View Related

Ubuntu Servers :: Limit Size Of Log File When Redirecting Stdout?

Jun 7, 2010

I have a command line server that logs to stdout, which I start along the lines of ./server > log.txt

What I want to do is limit the size of log.txt, without modifying the server.

I am assuming there must be some kind of tool already that lets me do this, something like where I can pass in my server, the output file and a size limit? If so, can anyone enlighten me?

View 3 Replies View Related

General :: Script To Output Both The Stderr And Stdout To The Same Text File?

Aug 5, 2011

Am having issues getting the output from a script to be logged in a file. I need the script to output both the stderr and stdout to the same text file.

At present I have the following script:

Code:
#!/bin/bash
echo TR3_1 > printers.txt
snmpget -v 1 -c public 10.168.**.* SNMPv2-SMI::mib-2.43.10.2.1.4.1.1 &>> printers.txt

[Code].....

View 4 Replies View Related

Programming :: Libxml2: Removing Output On Stdout/stderr - Element CA Does Not Carry Attribute Maxlength

Jul 26, 2010

I'm using libxml2 to handle/manipulate some XML files. In order to check the consistency of a XML file, I have a DTD and I'm using the xmlValidateDtd method to compute the check.

However, when an error occures during the check (for example an attribute is missing in a XML tag), then libxml2 writes the error on the stdout/stderr. For exemple:

Code:

/home/XML/FreeFour.xml:18: element CA: validity error : Element CA does not carry attribute maxlength

The method return the right result (true or false depending on the check result), but occurring errors are written on the stdout/stderr, and I actually don't want that.

View 4 Replies View Related

Debian :: Can't Blacklist Ssb?

May 19, 2010

for the life of me I am unable to get this module not to load

root@milomak-mac:~# cat /etc/modprobe.d/blacklist.conf
# This file lists modules which will not be loaded as the result of
# alias expansion, with the purpose of preventing the hotplug subsystem

[code]....

View 8 Replies View Related

Networking :: How To Blacklist Any IP

Mar 29, 2009

I have a server setup that is getting repeatedly hit by the same IP address it has tried accessing my vsftp and /drupal/cron.php. For security reason I have disabled vsftpd while I am not using it. The webserver on the other hand I need to leave running.

Code:
- pam_unix Begin -
vsftpd: Unknown Entries:
check pass; user unknown: 2708 Time(s)
authentication failure; logname= uid=0 euid=0 tty=ftp ruser=Administrator rhost=211.161.251.123 : 2282 Time(s)
authentication failure; logname= uid=0 euid=0 tty=ftp ruser=administrator rhost=211.161.251.123 : 426 Time(s)
- pam_unix End -

I would like to be able to add the ip to a blacklist. Additionally I would like to whitelist my own ip when I am working remotely, my remote location doesn't match my reverse dns and my server gives me an error at the end of the day that someone (myself) might be trying to break in. Running Fedora Core 9 in case it matters.

View 4 Replies View Related

General :: Log Rotation Of Stdout?

Jun 1, 2011

I have a Linux program which can write information to stdout and stderr.

I have a shell script which redirects that output to a file in /var/log. (Via >> and 2>&1.)

Is there a way to make that log file rotate? (max size, then switch to a different file, keep only a limited number of files)

I've seen a few answers which talk about the logrotate program, which sounds good, but they also seem to be focused on programs which are generating log files internally and handle HUP signals. Is there a way to make this work with a basic output redirection script?

View 3 Replies View Related

OpenSUSE :: 11.4 Will Not Let Edit 50-blacklist.conf ?

Jun 17, 2011

I need to add the following line in /etc/modprobe.d/50-blacklist.conf ..

Code:

In order to get wlan working, but I cannot seem to edit the file .

I tried:

Code:

Code:

I also tried manually opening the file but it is read-only . (I did not set my root folder to read-only, however .)

I even wrote a script in /home/exo/.gnome2/nautilus-scripts that should let me open files as root, but nothing works ..

This is my script:

Code:

View 2 Replies View Related

OpenSUSE Network :: How To Blacklist Host

Jan 2, 2011

I need to blacklist any incoming/outgoing connections to Google. I need to add filter something like this: *google*

View 5 Replies View Related

General :: Blacklist Module In RHEL 4.5?

Apr 2, 2011

I want to blacklist one module in RHEL 4.5. In RHEL 5.X we can remove the module using modprobe and then blacklist it in the file /etc/modprobe.d/blacklist to make it permanent after reboot. But in RHEL 4.5 there is no such file like /etc/modprobe.d/blacklist. So how to blacklist a module in RHEL 4.5

View 3 Replies View Related

Server :: How To Blacklist Spammer In Postfix

Jan 22, 2010

I am daily getting the same junk / spam email from this sender and I see two IP's in the headers / logs of my Postfix server. I searched my Postfix logs for both IP's:

Code:
[root@mail postfix]# cat /var/log/maillog | grep "67.212.170.242"
Jan 22 05:29:30 mail postfix/smtpd[12205]: connect from civismtp.uas.coop[67.212.170.242]
Jan 22 05:29:30 mail postgrey[2245]: action=pass, reason=client AWL, client_name=civismtp.uas.coop, client_address=67.212.170.242, sender=b.148.1296207.0e628e696f0d17ad@mail.wfmc.org, recipient=carlos@iamghost.com
Jan 22 05:29:30 mail postfix/smtpd[12205]: C00DB77A862: client=civismtp.uas.coop[67.212.170.242]
Jan 22 05:29:31 mail postfix/smtpd[12205]: disconnect from civismtp.uas.coop[67.212.170.242]
Jan 22 05:29:33 mail amavis[2351]: (02351-18) Passed CLEAN, [67.212.170.242] [192.220.23.216] <b.148.1296207.0e628e696f0d17ad@mail.wfmc.org> -> <carlos@iamghost.com>, Message-ID: <20100122095052.183D3192C012@civismtp.uas.coop>, mail_id: eY2CHd1Jva+X, Hits: -3.288, size: 22942, queued_as: 8A54C77A8E9, 2530 ms

How do I block / reject all email from this sender? Is there a specific section in Postfix like sender_access or client_access that I can 'reject' all mail from the above sender. What is the difference between IP's on the logs? I show 192.220.23.216 & 67.212.170.242 but can understand what the two separate IP's are for?

View 4 Replies View Related

Slackware :: Regex In Blacklist For Slackpkg - How To Use

Mar 30, 2011

Today I moved my Slackware64-current installations to multilib. I blacklisted the gcc and glib packages in the blacklist-file for slackpkg. In the blacklistfile they say:

Code:
# Now we can blacklist using regular expressions.
# This one will blacklist all SBo packages:
#[0-9]+_SBo
I have blacklisted

Code:
...
# The gcc compiler suite:
gcc
gcc-g++
gcc-gfortran
gcc-gnat
gcc-java
gcc-objc

# The GNU libc libraries:
glibc
glibc-i18n
glibc-profile
glibc-solibs
glibc-zoneinfo
glibc-debug
...

How I can use the mentioned regular expressions in order to make blacklisting more efficient?

View 2 Replies View Related

Fedora :: Blacklist Program From Internet Access?

May 23, 2010

In Fedora 12 how do I make it so a specific program can't talk to the internet?

View 14 Replies View Related

General :: Blacklist A DNS Server Supplied Via DHCP?

Jul 2, 2010

The DHCP server on a network I use specifies a DNS server that I do not want to use. Is there a way to continue to use DHCP but to modify the provided information or to "blacklist" one (of the three provided) DNS servers?

The client in question is running Ubuntu 10.04. Networking is managed by NetworkManager but I'm not wedded to that. In fact, I don't like it and wouldn't mind a reason to use something else.

View 1 Replies View Related







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