Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [pipe]

The tag has no usage guidance.

1
vote
2answers
27 views

Send email if script outputs string

I found this line: sh script.sh | grep 'NO' 2>&1 > grep.log && /usr/bin/mail -s "grep found something" m@mail.com < grep.log which will write the output of script.sh to grep.log ...
0
votes
0answers
16 views

using sudo with piped command on Ubuntu server [migrated]

If I need to use the following backup command on an Ubuntu server with sudo, how do I do so? Do I need sudo at two places? tar cf - directory | 7za a -si directory.tar.7z
0
votes
0answers
20 views

Diff and Patch from Terminal: hunk FAILED

I've created patches for some system files using the following logic: cp mpm_prefork.conf mpm_prefork.conf.original diff -u mpm_prefork.conf.original mpm_prefork.conf I then copied the output to a ...
-1
votes
1answer
24 views

Command that returns exit code still returning 0 when using “command 2>&1 | tee -a /var/log/file.log”

I'm running a script that executes a command and save the output to a file in /var/log. After that, it gets the exit code and execute another command based on an if/else condition. The problem is: 2>&...
1
vote
3answers
75 views

How to compress spaces in bash command output?

I work on a small screen and I'm trying to make the output of this command shorter, but I cannot get it to work. Command: docker container ls --all Output (too wide!): CONTAINER ID IMAGE ...
0
votes
1answer
112 views

Backuppc | Got fatal error during xfer (aborted by signal=PIPE)

I am running backuppc version 3.3.1 on an Ubuntu 16.04.5 LTS, I try to backup several Linux servers, almost Debian, ubuntu or proxmox hosts. My issue is that when I run the Full/Incermental backup ...
0
votes
1answer
96 views

Are bash pipes lazy or eager?

I was watching this command run tar cf - 20180412 -P | pv -s $(du -sb 20180412 | awk '{print $1}') | gzip > 20180412.tar.gz 9.02GiB 0:01:20 [ 114MiB/s] [============================================...
0
votes
1answer
111 views

set up master slave over ssh and port pipe for a Mysql replication

Everything started when I was asked to set up a syncing method for our Mysql server. Considering that I am a developer I got into deep waters first with DBA and now I found myself into SysAdmin. So I ...
1
vote
0answers
68 views

dovecot/postfix/postgres and piping mail to script

I'm trying to pipe mail to script I added lines like these to /etc/postfix/master.cf: myscript unix - n n - - pipe flags=F user=root argv=/var/myscript/igotmail.sh ${sender} ${size} ${recipient} ...
2
votes
0answers
133 views

stream a command's stdout, and merge with terminal's stdin to a single stdout

This answer shows numerous ways to stream multiple commands into another command, but since they use subshells you can't do stdin. While you can achieve this with named pipes, it's somewhat ugly and ...
0
votes
0answers
52 views

| date +'%b %d %T %Y' will return a current date

I'm trying to re-format a date: $ openssl x509 -enddate -noout -in cert.pem notAfter=Jan 30 02:19:17 2018 GMT But: $ openssl x509 -enddate -noout -in cert.pem | date +'%b %d %T %Y' Dec 26 11:25:...
1
vote
1answer
990 views

How to send text to stdin of docker container?

I have a docker container which runs a java program in foreground on startup. The java program listens to input on stdin. How can I programmatically send text to the java program? The container is ...
-1
votes
1answer
187 views

dovecot thinks alias to pipe is a user, rejects email

I have an AWS EC2 instance running Amazon Linux with Postfix for serving mail. I have only local users -- no virtual users -- and my users and aliases are served via PostgreSQL. My aliases table in ...
0
votes
2answers
458 views

Large mysql dump pipe to s3

Is there any problem in doing this with lots of data? mysqldump ... | gzip | s3cmd put - s3://bucket/file.sql.gz The MySQL dump is about 100GB in size. What happens if gzip or s3cmd can't process ...
1
vote
0answers
152 views

Read named pipe as output to echoing to a pipe

I've created a few named pipes for a few client programs such as cec so I only need to make the connection once in the background and just pipe in commands. Most of the time I don't need to read the ...
3
votes
3answers
524 views

Grep regex Stdout to telnet

I'm trying to use grep to get a regex result and pipe the results on-the-fly to telnet running an open port to a node server. The grep received continuous, but varied in interval, commands from a ...
0
votes
1answer
75 views

Can I filter output from `tail` with the `-f` flag?

I'd like to tail -f the output of access_log on RHEL 6.8 but pipe and grep that output to act as a filter. Is there such an option? That is I'd like live output from: # tail -f error_log | grep <...
1
vote
1answer
543 views

gzip piped output into ssh command

I make backup over ssh like this: mysqldump -u dbuser -pXXXXXXXX dbname | ssh -i ~/.ssh/id_rsa_backup backup@my.server.com 'cat > /var/backups/services/my_service/db/$(date +"%Y-%m-%d").sql' How ...
2
votes
1answer
772 views

Starting and stopping piped processes with Supervisor

I have a situation where I pipe the output of ffmpeg into a PHP script for some processing. I might have a few of these processes running at any given time and I figured to start and stop them I might ...
7
votes
2answers
1k views

Cat, Grep, Redirect Output… Blank File?

I just ran cat /opt/webapplications/Word/readme.log | grep -v 'Apple' and I got the output on the cli that I was expecting, which was all the lines in readme.log that did not contain 'Apple'... ...
1
vote
1answer
74 views

How do I pipe stdout and std error to a file and back to stdout on Windows?

On Windows when running a batch script I want to record the output of I run: myprogram.bat 1> mylog.log 2>&1 Which is great - but I have to run a separate tail process to read the output ...
0
votes
2answers
383 views

Streaming stdout

I have a script that outputs a lot of debug data that I would like to avoid to save on disk (specially since the file system is on a flash memory card). So I run it on the background with nohup + &...
3
votes
1answer
7k views

How to avoid “in use by another process” errors when piping output through a program?

In a Windows environment, are executable programs that are used to process piped output guaranteed to be unique tasks if called from different CMD environments? For example, suppose script1.cmd ...
1
vote
1answer
320 views

How to pipe a file being written to?

I have a binary file that is being written to continuously. I need to read the full content of that file to a pipe (either to nc or to a FIFO) and keep reading it while its is written (i.e. the ...
2
votes
3answers
5k views

Unzip from stdin to stdout - funzip, python

The goal is to read a zip file from stdin and uncompress to stdout. Funzip works and is the solution I am looking for, the zip contains a single file, unfortunately funzip fails when the compressed ...
-1
votes
1answer
297 views

Cron: Execute python script, capture stdout & stderr and send via msmtp [duplicate]

I try this for almost 4 hours now, in different ways. I googled a lot, but nothing I try work as expected. I have a simple .msmtprpc file, that allows me to send mails like this: echo -e "Subject: ...
0
votes
1answer
2k views

wget and pipe to tar in the background

I am trying to download a large file which is .tar.gz and (> 2GB) in size. The bash script also does lots of other things, so I want to kick off the download and then continue processing other ...
6
votes
2answers
4k views

Apache errorlog piping fail

Trying to log to a central syslog server, either direct using Apache's ErrorLog to pipe to logger, or getting syslog to forward, but nothing is working and the errors are not making sense to me. I can ...
1
vote
2answers
798 views

How to pipe postfix into Codeigniter controller

I currently have postfix piping into a PHP script to process the email via an alias. catchall: |/var/www/vhosts/website/httpdocs/scripts/incoming_mail.php However, I wish to use the DB config etc ...
0
votes
0answers
262 views

Remote packet capturing using fifo and dumpcap

I'm currently working on two linux servers where one server is running in 2.6.18-274.el5(Server A) and the second one in CentOS 7 (Server B). My requirement is to capture the packets of the network ...
6
votes
3answers
1k views

Postfix - Pipe multiple recipient message as a single message

I am trying to pipe emails through Postfix to a Python script I have. Currently, messages with multiple recipients are piped to the script once for each recipient. I would like these messages to be ...
1
vote
1answer
255 views

Postfix pipe mail at user level

I am trying to filter mail at the user level. I have CentOS and Postfix installed. I managed to install a filter on the server and its working great, except, instead of filtering by user, all emails (...
1
vote
1answer
551 views

Pipe multiple files into one tar gz

I'd like to call mysqldump to create multiple backup files and then archive them in one tar.gz. I am following this tutorial on mysqldump part: http://dev.mensfeld.pl/2013/04/backup-mysql-dump-all-...
0
votes
2answers
154 views

Unzip piping order

I have a file, foo.zip which looks something like this: foo.zip -- fileA.txt -- fileB.txt I can pipe the output of the extracted files like this: unzip -p foo.zip *.txt | something My problem is ...
3
votes
1answer
344 views

does email pipe to program cause problems with unicode characters?

I'm piping incoming mail into a PHP script, immediately storing the RAW email in a MySQL db. It works very well, except ~0.7% of emails arrive with a truncated message body. I found someone whose ...
1
vote
1answer
59 views

pipe rrd to a new directory

I am chrooted and running out of drive space, so I mounted back to the host drive which has plenty of space but cannot seem to redirect the outputted data to my empty drive [root@localhost rra]# ls /...
2
votes
3answers
14k views

Can't pipe echo to netcat?

I have the following command: echo 'HTTP/1.1 200 OK\r\n' | nc -l -p 8000 -c and when I curl localhost:8000 I am not seeing HTTP/1.1 200 .. being printed. I am on mac os x with netcat 0.7.1 Any ...
1
vote
1answer
567 views

Exim4 setup not working with piping

I'm trying to setup exim4 on the server, so that it can receive mail for a couple sub domains, and I want to pipe that to a PHP script. I want all incoming mail to be processed through my custom ...
5
votes
4answers
6k views

how to pipe a mysql dump to s3cmd

I want to transfer a mysql dump, compressed, to s3. I tried: mysqldump -u root -ppassword -all-databases | gzip -9 | s3cmd put s3://bucket/sql/databases.sql.gz but then I get: ERROR: Not enough ...
1
vote
1answer
291 views

Cat pipe mysql : Stopped. What stopped and how can I fix that?

I imported a large database from remote using a cat + mysql command : cat my_db.sql | mysql --host=external_host --user=my_user --password=some_password my_database And after some time, it returned ...
1
vote
5answers
624 views

How to split the output into different files?

I have a input file like foo xxx yyy zzz foo xxx yyy zzz foo xxx yyy zzz foo xxx yyy zzz bar xxx yyy zzz bar xxx yyy zzz foo xxx yyy zzz .. How to split the input file by line, into foo.txt ...
1
vote
1answer
435 views

Postfix Pipe then forward to original recipient

I may well be on the wrong track here with what I'm trying to do, so I'd appreciate any advice. Is it possible to pipe email to a script (which I have working), and then have Postfix forward it on ...
0
votes
2answers
758 views

Powershell pipe exporting to csv is loosing data

I'm trying to write a script that will take input from a .txt file of IP address. Do a reverse DNS lookup to get the hostname of the IP address and then export that data into .csv file. Here is what ...
2
votes
2answers
2k views

SELinux preventing /etc/aliases email pipe to script from working

When somebody sends an email to my server, e.g. somestringthatisnotnecessarilyauser@myserver.com I want it to pipe to a PHP script. So in my /etc/aliases file I have: ...
0
votes
1answer
141 views

How to comma-demilit the output from cut?

So far, I have this: grep -B 36 'pattern1' Mapper.1.Configuration.MapRules | grep "pattern2" | cut -d'"' -f2 which give me a new-line delimited list of values that I need. I could put this into a ...
1
vote
2answers
562 views

how to pipe results from LS to CD in ubuntu

I'd like to ls for the latest created directory in a given directory (we create a new folder for each release) and then cd to that directory. I'd like to create an alias for this so I don't have to ...
-1
votes
1answer
444 views

Make a copy of email using pipe in postfix alongside 1 content_filter

I am using postfix and already usHi. I am using postfix and already using a script as a content_filter which re-injects back to smtpd to all users, but before this happens, I would like to make a copy ...
0
votes
2answers
1k views

pipe raw email message to python script

In exim4, I use following pipe to send a message to a python script, process it, and upload it to django: send_to_django_mailbox: driver = pipe command = /usr/local/bin/python /etc/exim4/conf.d/...
8
votes
5answers
645 views

Grep-ing gzipped files [duplicate]

I have a set of 100 log files, compressed using gzip. I need to find all lines matching a given expression. I'd use grep, but of course, that's a bit of a nightmare because I'll have to unzip all ...
1
vote
1answer
6k views

Postfix: Pass a copy of an email to a script but deliver the original one to mailbox

It's actually quite simple: I want to pass all incoming emails to a PHP-script, but only as a copy, the original email shall still be delivered to the mailbox as usual. I just can't seem to get it ...