"motd" only for interactive shell sessions?

52 views
Skip to first unread message

Thomas Hartmann

unread,
Jan 24, 2019, 11:13:43 AM1/24/19
to singularity
Hi all,

I am looking for a way, to add a "motd" to an interactive container
session - but only to shell ;)

Thing is, that I added a "motd" echo - e.g.,
%environment
echo "Welcome to this wonderful namespace"
(or could be a separate script in /.singularity/env)

which is fine and one is greeted by it when running it with
> singularity shell ... mycontainer

however, all other instantiations obviously also execute the echo
> singularity exec ... mycontainer /usr/bin/date
>> Welcome to this wonderful namespace
>> Thu Jan 24 16:08:29 UTC 201
which is a bit noisy.

So, I wonder if somebody knows a nice way to source certain things only
for 'shell'? :)

Cheers and thanks,
Thomas

v

unread,
Jan 24, 2019, 1:03:47 PM1/24/19
to singu...@lbl.gov
What an awesome idea! Maybe try this?

From: ubuntu:16.04
Bootstrap: docker
 
%post
   sed -i '2iecho HELLO MY DEAREST NOODLE' /.singularity.d/actions/shell


Then shell:

$ singularity shell container.simg Singularity: Invoking an interactive shell within container...
HELLO MY DEAREST NOODLE
Singularity container.simg:/tmp> 


--
You received this message because you are subscribed to the Google Groups "singularity" group.
To unsubscribe from this group and stop receiving emails from it, send an email to singularity...@lbl.gov.


--
Vanessa Villamia Sochat
Stanford University '16

v

unread,
Jan 24, 2019, 1:05:55 PM1/24/19
to singu...@lbl.gov
This is like, the most fun idea! I am running to a meeting but I'm going to write up some other fun motd things you can do with containers :) I'll share a bit later!

Thomas Hartmann

unread,
Jan 25, 2019, 4:00:47 AM1/25/19
to singu...@lbl.gov, v
ah, very nice!

yes, the shell section really looks quite promising to add more fun ;)

just for starters a boring info header
> echo -e "Welcome to container based on $(/bin/cat
/etc/redhat-release)\nfor more information you can also run\n
'singularity help container.path"

probably I will add jq or so and spice up the motd with the build date
from /.singularity.d/labels.json

Cheers & many thanks!
Thomas
> <mailto:singularity%2Bunsu...@lbl.gov>.
>
>
>
> --
> Vanessa Villamia Sochat
> Stanford University '16
> (603) 321-0676
>
>
>
> --
> Vanessa Villamia Sochat
> Stanford University '16
> (603) 321-0676
>
> --
> You received this message because you are subscribed to the Google
> Groups "singularity" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to singularity...@lbl.gov
> <mailto:singularity...@lbl.gov>.

Thomas Hartmann

unread,
Jan 25, 2019, 4:10:42 AM1/25/19
to singu...@lbl.gov
ah, blasted - RH6 jq is to old and apparently has no way to deal with
dots in JSON object names.... :-/

> /.singularity.d/labels.json | jq '."org.label-schema.build-date"'
or similar all displease ancient jq

back to grep & cut ...

Justin Cook

unread,
Feb 4, 2019, 11:26:18 AM2/4/19
to singularity, thomas....@desy.de
Thomas,

From the jq website:

"jq is written in portable C, and it has zero runtime dependencies. You can download a single binary, scp it to a far away machine of the same type, and expect it to work."


Perhaps that helps?

Justin

Thomas Hartmann

unread,
Feb 5, 2019, 3:54:48 AM2/5/19
to singu...@lbl.gov, Justin Cook
thanks - but luckily the json is not as complex and cut/grep was a
portable quick&dirty solution ;)
> >>     <thomas....@desy.de <javascript:> <mailto:thomas....@desy.de
> >>         it, send an email to singularity...@lbl.gov <javascript:>
> >>         <mailto:singularity%2Bunsu...@lbl.gov <javascript:>>.
> >>
> >>
> >>
> >>     --
> >>     Vanessa Villamia Sochat
> >>     Stanford University '16
> >>     (603) 321-0676
> >>
> >>
> >>
> >> --
> >> Vanessa Villamia Sochat
> >> Stanford University '16
> >> (603) 321-0676
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> >> Groups "singularity" group.
> >> To unsubscribe from this group and stop receiving emails from it,
> send
> >> an email to singularity...@lbl.gov <javascript:>
> >> <mailto:singularity...@lbl.gov <javascript:>>.
> >
>
> --
> You received this message because you are subscribed to the Google
> Groups "singularity" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to singularity...@lbl.gov
> <mailto:singularity...@lbl.gov>.

Reply all
Reply to author
Forward
0 new messages