CoreOS + Mail + Toolbox + Updates.

476 views
Skip to first unread message

Teedo

unread,
Jun 18, 2015, 3:37:43 PM6/18/15
to coreo...@googlegroups.com
Hi,

I'm trying to setup a systemd startup script/service so that every time CoreOS boots up, it sends an me email so that I can get an idea when an update happened.  Or even a script that sends a "hello" mail to me when i run it at the command line.

Of course, the command mail or mailx doesn't exist in CoreOS so I have to run "toolbox" and fork a fedora container and install it there.  The problem is that the installed mail tools are only available inside the toolbox's fedora container.  Since I'm trying to set up scripts/service outside of the fedora container that obviously won't work.  

My question is:

In a case like this, is there a parameter to pass to toolbox to tell it you want run a command inside it's fedora container without launching the fedora container?  Or do we have to keep a separate OS container running and do something like this:

docker exec -it {OS_Container} /bin/echo "Test Mail" | /usr/bin/mailx ........................... us...@somedomain.com 

Thanks in advance!


Brandon Philips

unread,
Jun 18, 2015, 4:18:52 PM6/18/15
to Teedo, coreo...@googlegroups.com
Hello Teedo-

This is totally untested.

I would suggest doing docker export as the toolbox script does and then instead of doing systemd-nspawn. Something like:

/usr/bin/chroot /var/lib/toolbox/core-fedora-latest /bin/bash -c 'echo "Test Mail" | mailx us...@somedomain.com'

Brandon

--
You received this message because you are subscribed to the Google Groups "CoreOS User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coreos-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Teedo

unread,
Jun 19, 2015, 2:25:55 PM6/19/15
to coreo...@googlegroups.com, taig...@yahoo.com
Thanks for the quick response Brian.   I'll look into modifying the toolbox script and will post the results.


Teedo

Teedo

unread,
Jun 19, 2015, 2:27:33 PM6/19/15
to coreo...@googlegroups.com
Oops.  I meant Brandon.  :)


Teedo

Adrien

unread,
Jul 22, 2016, 5:35:10 AM7/22/16
to CoreOS User
Hi Teedo,
It's an older topic, but that's exactly what I want to do. 
Can you tell me your configuration now ? With toolbox ? With a container ? ..
Thanks.

Adrien

unread,
Aug 3, 2016, 6:50:41 AM8/3/16
to CoreOS User
Hi Teedo, 

I follow-up your private answer after my private message, and I can tell you that I have a solution !
On a reboot for example, my docker containers restart auto and I receive an email on my mailbox :)

My solution is : 
A systemd script enable at startup and it call a script to send email.
This script to send email is based on this container : https://github.com/xueshanf/docker-aws-ses
It based on AWS SES to send email (my coreos is stored on AWS and I have un account in SES) but I think there is others containers with gmail or other (sendmail).

For your second question, yes it is possible to run commands from coreos inside the toolbox container like that : 

toolbox -q mkdir /home/toto

// and the folder /home/toto was created in the toolbox and you are always in your coreos

// g for quiet

So you can also run command to send email from toolbox but I didn't test it.


I hope I help you (and others ?) with my message and don't hesitate to contact me if needed.

Adrien
Reply all
Reply to author
Forward
0 new messages