Questions tagged [pipe]

156 questions
2
votes
4 answers

Is there an easy way to insert data/time in front of a log file with just shell scripting?

Say I want to monitor memory usage on a java process overnight. I can do something like top | grep java > out.log I will get a log file with a whole bunch of lines. Is there an easy way to get a data/time inserted in front of each line?
James Dean
  • 761
  • 1
  • 6
  • 5
2
votes
2 answers

Non-blocking bash redirection

Does anyone know how to redirect the output of a program, running from a bash script, to a named pipe IN NON BLOCKING MODE (having 'O_NONBLOCK' flag set)?
anderson
  • 191
  • 3
  • 7
2
votes
2 answers

Pipe email from google apps to server php script

I'm wondering if anyone here would have any ideas on how I can pipe support@domain.com to our ticket system on our server with our email being hosted via Google Apps. Is it possible to pipe a specific email address via DNS?
Ben
  • 3,630
  • 17
  • 62
  • 93
2
votes
2 answers

Updating a file in a zip archive from STDIN

I want to update/freshen a file in a zip archive with the contents of stdin. So far I haven't been able to find a way to tell the zip command that the contents of stdin correspond to a particular file. E.g. (the last line is how I'd expect it to…
Bo Jeanes
  • 1,430
  • 2
  • 13
  • 16
1
vote
1 answer

Mysqldump to compressed file

Situation: 1. mysql is backuped to disk with mysqldump (~250 GB) 2. dump is compressed with bpzip2 3. dump is moved to another DC 4. disk usage again in good state Problem: Filesystem usage peaks, example: I need 1 TB space to fit the data while…
1
vote
2 answers

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 and then email that to an email m@mail.com Is there anyway to remove…
Kohjah Breese
  • 171
  • 1
  • 11
1
vote
3 answers

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 …
noctonura
  • 443
  • 1
  • 4
  • 10
1
vote
0 answers

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} smtp inet n - - - - …
zekorius
  • 11
  • 1
1
vote
0 answers

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 output but I need to sometimes and would like to…
Jason
  • 11
  • 2
1
vote
3 answers

Bash piping answer in Ubuntu

In a bash script, I want to know know how to pipe in answers like for example: ssh -l username -i /home/ubuntu/.ssh/id host.com < yes The ssh connection would ask if I would like to continue the connection and I want to pipe in the answer yes…
UbuntuUser
1
vote
1 answer

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 <> Currently I'm doing something…
Rick
  • 299
  • 1
  • 4
  • 12
1
vote
1 answer

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 to send gziped data to save bandwith and disk space ?
bux
  • 606
  • 2
  • 6
  • 20
1
vote
1 answer

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 in another window. What I want is to be able to record it to…
Hawkeye
  • 2,669
  • 9
  • 30
  • 34
1
vote
1 answer

How to ask exim4 to redirect some email pattern to a specific email address?

I would like to redirect all email from *@domain.fr to username@gmail.com Do you know how I can configure my exim4 server on Debian to do so ? (My exim configuration seams to be split in different files) Thank you.
Natim
  • 616
  • 1
  • 6
  • 16
1
vote
1 answer

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 receiver will not read EOF, but will block until more…
lvella
  • 284
  • 2
  • 13