[Box-Admins] source.squeak.org startup issue resolved?

Ken Causey ken at kencausey.com
Sat Nov 16 21:18:53 UTC 2013


On 11/16/2013 12:00 PM, David T. Lewis wrote:
> On Sat, Nov 16, 2013 at 11:09:10AM -0600, Ken Causey wrote:
>> In preparation for our chat later today regarding SqueakSource issues I
>> should note that late yesterday I seem to have stumbled onto a (I say
>> 'A') solution for the issue we have had with source.squeak.org where
>> supervise (daemontools) was not able to start, or at least keep running,
>> the source.squeak.org instance.
>>
>> I 'fixed' it by modifying the run script so that it refers directly to
>> the VM executable (under /usr/local/lib/) rather than use the shell
>> script in /usr/local/bin/.  I don't understand why this fixed it, I
>> don't understand why it ever broke.  In fact I'm pretty sure I tried
>> this before to no effect.
>>
>> Confused,
>
> Hi Ken,
>
> Can you please post the run script that you are using for source.squeak.org?
> Here is the /home/ssdotcom/run script that I came up with for squeaksource.com
> running on box3. This script execs the /usr/local/bin/squeak script which in
> turn execs the squeakvm executable. I confirmed that the pid of the squeakvm
> is the same as the pid of the run script when it is started, and also that
> the squeakvm is being run under the ssdotcom user ID. I am a newbie at supervise
> but this seems to be working fine as nearly as I can tell.
>
> --- /home/ssdotcom/run ---
> #!/bin/sh
> # Thu Nov 14 18:23:37 CET 2013
> # run script for /usr/bin/supervise
>
> exec 2>&1
>
> USER=ssdotcom
> SSHOME=/home/ssdotcom/SqueakSource
> IMAGE=squeaksource.3.image
>
> VM=/usr/local/bin/squeak
> VMARGS='-vm-display-null'
>
> echo starting $0 in pid $$
>
> echo cd $SSHOME
> cd $SSHOME
>
> echo exec setuidgid ${USER} ${VM} ${VMARGS} ${SSHOME}/${IMAGE}
> exec setuidgid ${USER} ${VM} ${VMARGS} ${SSHOME}/${IMAGE}
>
> --- end of /home/ssdotcom/run ---
>
> I also set up logging with a /home/ssdotcom/log/run script as follows. This
> also seems to be working as expected.
>
> --- /home/ssdotcom/log/run ---
> #!/bin/sh
> USER=ssdotcom
> exec setuidgid ${USER} multilog t ./main
>
> --- end of /home/ssdotcom/log/run ---
>
> Dave
>

#!/bin/bash

# to connect via vnc, start vncserver and kill the running headless 
squeaksource instance
# daemontools will then restart this script, and squeak appear on the 
display
# to see what's running: "ps x"
# to kill squeaksource: "kill <pid>" (where <pid> is the squeakvm's 
process id)
# to start vnc: "tightvncserver :2" (and run "vncpasswd" before to set 
your own password)
# to stop vnc: "tightvncserver -kill :2" (this kills squeaksource, too, 
then restarts)

VNCDISPLAY=`ps x -u squeaksource -ocmd | grep '^Xtightvnc :' | sed 
's/.*://;s/ .*//'`
SQUEAK311=/usr/local/lib/squeak/3.11.3-2135/squeakvm
#SQUEAK311=/usr/local/bin/squeak311

if [ -n "$VNCDISPLAY" ] ; then
     su -c "$SQUEAK311 -display :$VNCDISPLAY 
/home/squeaksource/Squeak3.11-8824-SS.image" squeaksource
else
     su -c "$SQUEAK311 -vm-display-none 
/home/squeaksource/Squeak3.11-8824-SS.image" squeaksource
fi

Discard the comments and the logic to autodetect VNC and it could be two 
lines

#!/bin/bash
su -c "/usr/local/lib/squeak/3.11.3-2135/squeakvm -vm-display-none \ 
/home/squeaksource/Squeak3.11-8824-SS.image" squeaksource"

I actually spent a fair amount of time trying to get setuidgid to work. 
  It comes with daemontools and it seems like the perfect tool, and yet 
it didn't seem to set the uid or gid correctly or perhaps more likely 
the environment was not being properly setup.  In any case I switched 
back to su but changed the invocation slightly and, as I said used the 
executable directly.

Ken


More information about the Box-Admins mailing list