Try:

screen -dmS Screen-Name  /bin/bash -c "Command1 | tee logfile | tee >(mail
-s 'subject' not...@gmail.com")

On Wed, 30 Nov 2016, 00:26 aws backup, <albatin.salta...@gmail.com> wrote:

> Hello,
>
> now I built following pipe example:
>
> *screen -dmS Screen-Name  /bin/bash -c "Command1 | tee logfile | mail -s
> 'subject' not...@gmail.com <not...@gmail.com>"*
>
> Works fine so fare that I have the log file and get a notification email
> with the log as well.
> But now nothing appears anymore in the screen because it pipes it to the
> mail.
>
> Any suggestion how to get the stdout back to the screen session and still
> having the log and the email?
>
> Thank you.
>
> Robert
>
> On 23 Nov 2016, at 06:31, Neal Fultz <nfu...@gmail.com> wrote:
>
> *screen -d -m -S Screen-Name*
> *screen -S Screen-Name -p 0 -X stuff "Command1; Command2  | Command3
> && Command4"$(echo -ne '\015')*
>
> This first creates a screen session running a shell, most likely bash.
> Second, it sends some commands to the terminal input using stuff. In this
> case, you could append the `exit` command to your chain of commands to make
> the shell exit.
>
> Alternatively, you could instead use a single screen command to start a
> bash shell in non-interactive mode, and provide the commands to it instead
> of stuffing them through screen:
>
> screen -dRS Screen-Name /bin/bash -c "echo 1; echo a | sed s/a/A/; echo 2 > 
> /tmp/hooha.txt"
>
>
> This will automatically close when finished, and avoids stuff entirely.
>
>
>
> On Tue, Nov 22, 2016 at 2:37 PM, aws backup <albatin.salta...@gmail.com>
> wrote:
>
> Ok I figured out the correct syntax.
>
> *screen -d -m -S Screen-Name; screen -S Screen-Name -p 0 -X stuff
> "Command1; Command2  | Command3 && Command4"$(echo -ne '\015')*
>
> $(echo -ne '\015') starts the command pipe in the screen session. But now
> the screen is not terminating anymore after the command pipe has finished
> as it did before when it only received one command. Therefore the script
> runs into an error when it runs the next time because it makes a new screen
> session with the same name and then it does not know to which screen
> session to send the command.
>
> Why is it not terminating the session anymore? Is there a command which I
> can send there?
> Any other suggestion how to solve this problem?
>
> Thank you.
>
>
>
> On 19 Nov 2016, at 14:19, Colin Richardson <wormssm...@gmail.com> wrote:
>
> Oh, there is.a trick to that too. I will need to check on my raspberry pi,
> but I think you can send a ^M at the end and it acts like the user pressing
> ENTER. I don't remember the exact char off the top of my head and I am out
> and about shipping at the moment, but shoulder be able to google the
> command IDF is not M.
>
> On 19 Nov 2016 11:54 am, "aws backup" <albatin.salta...@gmail.com> wrote:
>
> Hi Colin,
>
> thank you. I tried but nothing arrived in the screen or it did arrive but
> didn't start.
> What is the exact syntax? Can I start the screen and send the commands in
> one command or do I have to start the screen in one command and in the next
> command I send the pipeline? I tried it like this:
>
> *screen -d -m -S Screen-Name; screen -S **Screen-**Name -p 0 -X stuff
> "Command1; Command2  | Command3 && Command4"*
>
> How is it with quotations in the command pipe? Can they interfere? For
> example:  -X stuff "command "$f" | command2 "text""
>
> Thank you.
>
>
>
> On 19 Nov 2016, at 12:07, Colin Richardson <wormssm...@gmail.com> wrote:
>
> Have u tried -X stuff "command | command2" with the quotes?
>
> On 19 Nov 2016 7:36 am, "aws backup" <albatin.salta...@gmail.com> wrote:
>
> Hello,
>
> I would like to start a screen session in detached mode and send a command
> pipeline to it. How can I do this?
> With my approach
>
> *screen -d -m -S Name Command1; Command2  | Command3 && Command4*
>
> only Command1 is send to the screen.
>
> Thank you.
>
>
>
> _______________________________________________
> screen-users mailing list
> screen-users@gnu.org
> https://lists.gnu.org/mailman/listinfo/screen-users
>
>
>
>
>
> _______________________________________________
> screen-users mailing list
> screen-users@gnu.org
> https://lists.gnu.org/mailman/listinfo/screen-users
>
>
> _______________________________________________
> screen-users mailing list
> screen-users@gnu.org
> https://lists.gnu.org/mailman/listinfo/screen-users
>
_______________________________________________
screen-users mailing list
screen-users@gnu.org
https://lists.gnu.org/mailman/listinfo/screen-users

Reply via email to