How to shutdown Raspbian from within Squeak?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

How to shutdown Raspbian from within Squeak?

Louis LaBrunda
Hi All,

How can I shutdown Raspbian from within Squeak?  I use to know how to send OS commands, with I
think OSProcess, but it has been years and I forgot how and can't find the old code.  Thanks in
advance.

Lou
--
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon


Reply | Threaded
Open this post in threaded view
|

Re: How to shutdown Raspbian from within Squeak?

timrowledge

> On 08-03-2017, at 12:49 PM, Louis LaBrunda <[hidden email]> wrote:
>
> Hi All,
>
> How can I shutdown Raspbian from within Squeak?  I use to know how to send OS commands, with I
> think OSProcess, but it has been years and I forgot how and can't find the old code.  Thanks in
> advance.

It’ll be something like
UnixProcess thisOSProcess command: ‘sudo shutdown now'


tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
10.0 times 0.1 is hardly ever 1.0.



Reply | Threaded
Open this post in threaded view
|

How to shutdown Raspbian from within Squeak?

Louis LaBrunda
Hi Tim,

Thanks.  Do you remember how to load OSProcess in the first place?  And then is there a file,
like a .so files or something that I need to put somewhere?

Lou


On Wed, 8 Mar 2017 13:32:25 -0800, tim Rowledge <[hidden email]> wrote:

>
>> On 08-03-2017, at 12:49 PM, Louis LaBrunda <[hidden email]> wrote:
>>
>> Hi All,
>>
>> How can I shutdown Raspbian from within Squeak?  I use to know how to send OS commands, with I
>> think OSProcess, but it has been years and I forgot how and can't find the old code.  Thanks in
>> advance.
>
>It’ll be something like
>UnixProcess thisOSProcess command: ‘sudo shutdown now'
>
>
>tim
--
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon


Reply | Threaded
Open this post in threaded view
|

Re: How to shutdown Raspbian from within Squeak?

David T. Lewis
On Wed, Mar 08, 2017 at 05:09:59PM -0500, Louis LaBrunda wrote:
> Hi Tim,
>
> Thanks.  Do you remember how to load OSProcess in the first place?  And then is there a file,
> like a .so files or something that I need to put somewhere?
>
> Lou

You can load OSProcess and CommandShell (I recommend that you load both) from
the SqueakMap package loader.

If you prefer loading directly with Monticello, the repositories are here:
  http://www.squeaksource.com/OSProcess
  http://www.squeaksource.com/CommandShell

And general information is at:
  http://wiki.squeak.org/squeak/708
  http://wiki.squeak.org/squeak/1914
  http://wiki.squeak.org/squeak/6023

Having said that, I suspect that the reboot is going to be tricky.
The sudo command is designed for security, and it is smart enough not
to let the password input come from some arbitrary input stream such as
the one connected to your Squeak image. I'll try tinkering around with
it a bit, but I'm afraid this may not be not as simple as you might expect.

Dave


>
>
> On Wed, 8 Mar 2017 13:32:25 -0800, tim Rowledge <[hidden email]> wrote:
>
> >
> >> On 08-03-2017, at 12:49 PM, Louis LaBrunda <[hidden email]> wrote:
> >>
> >> Hi All,
> >>
> >> How can I shutdown Raspbian from within Squeak?  I use to know how to send OS commands, with I
> >> think OSProcess, but it has been years and I forgot how and can't find the old code.  Thanks in
> >> advance.
> >
> >It??ll be something like
> >UnixProcess thisOSProcess command: ??sudo shutdown now'
> >
> >
> >tim
> --
> Louis LaBrunda
> Keystone Software Corp.
> SkypeMe callto://PhotonDemon
>
>

Reply | Threaded
Open this post in threaded view
|

Re: How to shutdown Raspbian from within Squeak?

timrowledge

> On 08-03-2017, at 4:07 PM, David T. Lewis <[hidden email]> wrote:
>
>
> Having said that, I suspect that the reboot is going to be tricky.
> The sudo command is designed for security, and it is smart enough not
> to let the password input come from some arbitrary input stream such as
> the one connected to your Squeak image. I'll try tinkering around with
> it a bit, but I'm afraid this may not be not as simple as you might expect.
Actually on a Pi ’sudo’ is normally password-free, wjich is probably enough to make some people’s heads explode, but there y’are.


tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
CChheecckk yyoouurr dduupplleexx sswwiittcchh..



Reply | Threaded
Open this post in threaded view
|

Re: How to shutdown Raspbian from within Squeak?

David T. Lewis
On Wed, Mar 08, 2017 at 04:23:45PM -0800, tim Rowledge wrote:

>
> > On 08-03-2017, at 4:07 PM, David T. Lewis <[hidden email]> wrote:
> >
> >
> > Having said that, I suspect that the reboot is going to be tricky.
> > The sudo command is designed for security, and it is smart enough not
> > to let the password input come from some arbitrary input stream such as
> > the one connected to your Squeak image. I'll try tinkering around with
> > it a bit, but I'm afraid this may not be not as simple as you might expect.
> Actually on a Pi ???sudo??? is normally password-free, wjich is probably enough to make some people???s heads explode, but there y???are.
>

Yes, on raspbian it will probably work. The tricky bit is that if you do
need to enter a password, sudo will read the password from the controlling
terminal the Squeak VM process, represented by /dev/tty. That more or less
equates to your keyboard. There is no easy way for Squeak to insert a keyboard
wedge to supply the password keystrokes, which of course is exactly what
was intended from a security point of view.

Dave
 

Reply | Threaded
Open this post in threaded view
|

Re: How to shutdown Raspbian from within Squeak?

David T. Lewis
On Wed, Mar 08, 2017 at 07:33:18PM -0500, David T. Lewis wrote:

> On Wed, Mar 08, 2017 at 04:23:45PM -0800, tim Rowledge wrote:
> >
> > > On 08-03-2017, at 4:07 PM, David T. Lewis <[hidden email]> wrote:
> > >
> > >
> > > Having said that, I suspect that the reboot is going to be tricky.
> > > The sudo command is designed for security, and it is smart enough not
> > > to let the password input come from some arbitrary input stream such as
> > > the one connected to your Squeak image. I'll try tinkering around with
> > > it a bit, but I'm afraid this may not be not as simple as you might expect.
> > Actually on a Pi ???sudo??? is normally password-free, wjich is probably enough to make some people???s heads explode, but there y???are.
> >
>
> Yes, on raspbian it will probably work. The tricky bit is that if you do
> need to enter a password, sudo will read the password from the controlling
> terminal the Squeak VM process, represented by /dev/tty. That more or less
> equates to your keyboard. There is no easy way for Squeak to insert a keyboard
> wedge to supply the password keystrokes, which of course is exactly what
> was intended from a security point of view.
>

Actually, that reminds me - and I want to mention it now before I forget about
it yet again - I think that the sudo password input issue might be effectively
handled with the unix pseudo terminal interface (man 7 pty). Ian Piumarta made
a plugin for this along with his really quite amazingly good telnet terminal
emulator.

That stuff, along with other things such as the VNC server, is still available here:

  http://squeakvm.org/unix/goodies.html

I also recall Ian asking me a long time ago why I didn't add pty support to
the OSProcess plugin, which was a very good question, and I probably should have
paid attention to it.

Dave
 

Reply | Threaded
Open this post in threaded view
|

Re: How to shutdown Raspbian from within Squeak?

Chris Muller-3
In reply to this post by David T. Lewis
>> Actually on a Pi ???sudo??? is normally password-free, wjich is probably enough to make some people???s heads explode, but there y???are.

There's no reason anyone should let their head explode about that.
There are definitely use-cases for it, particularly in Pi
applications.

> Yes, on raspbian it will probably work. The tricky bit is that if you do
> need to enter a password, sudo will read the password from the controlling
> terminal the Squeak VM process, represented by /dev/tty. That more or less
> equates to your keyboard. There is no easy way for Squeak to insert a keyboard
> wedge to supply the password keystrokes, which of course is exactly what
> was intended from a security point of view.

I would just:

  OSProcess command: 'xterm -e "sudo shutdown now"'

Reply | Threaded
Open this post in threaded view
|

How to shutdown Raspbian from within Squeak?

Louis LaBrunda
In reply to this post by David T. Lewis
Hi Dave and Tim,

Thanks for all the help.  I'm running Raspbian Jessie Lite (no desktop or GUI) and Squeak
headless.  On boot I auto run Squeak.  Given that I didn't load CommandShell, which I think is
a GUI interface.  Squeak auto runs a Seaside program that only has one user so there is a
password but no user id.  There is a setting screen and a main screen that allows the user to
control up to 4 relays and view the status of up to 4 sensors/switches.

This first pass is going to a friend where we will install it to control his garage doors thru
the internet via a smart phone (or any browser).  I want to be able to reboot and shutdown from
the browser just because sometime you need to.

The reboot and shutdown code I used is below.  Just before calling those methods, I call a
method to logoff from the web session.

I'm not sure I need to but it seemed prudent to quit Squeak before shutting down.  I wait 10
seconds to give the logoff time to paint.  I wanted to have the shutdown delay for a few
seconds with the "-t sec" option but on Raspbian the sec option is taken as minutes (seems like
a bug to me).  Anyway the "now" option seems to give Squeak enough time to quit without a
problem.

Thanks again for the help.

Lou

reboot
        "Reboot the computer."

        [
                (Delay forSeconds: 10) wait.
                UnixProcess thisOSProcess command: 'sudo shutdown -r now'.
                Smalltalk snapshot: false andQuit: true.
        ] fork.

shutdown
        "Shutdown the computer."

        [
                (Delay forSeconds: 10) wait.
                UnixProcess thisOSProcess command: 'sudo shutdown -P now'.
                Smalltalk snapshot: false andQuit: true.
        ] fork.

On Wed, 8 Mar 2017 20:17:06 -0500, "David T. Lewis" <[hidden email]> wrote:

>On Wed, Mar 08, 2017 at 07:33:18PM -0500, David T. Lewis wrote:
>> On Wed, Mar 08, 2017 at 04:23:45PM -0800, tim Rowledge wrote:
>> >
>> > > On 08-03-2017, at 4:07 PM, David T. Lewis <[hidden email]> wrote:
>> > >
>> > >
>> > > Having said that, I suspect that the reboot is going to be tricky.
>> > > The sudo command is designed for security, and it is smart enough not
>> > > to let the password input come from some arbitrary input stream such as
>> > > the one connected to your Squeak image. I'll try tinkering around with
>> > > it a bit, but I'm afraid this may not be not as simple as you might expect.
>> > Actually on a Pi ???sudo??? is normally password-free, wjich is probably enough to make some people???s heads explode, but there y???are.
>> >
>>
>> Yes, on raspbian it will probably work. The tricky bit is that if you do
>> need to enter a password, sudo will read the password from the controlling
>> terminal the Squeak VM process, represented by /dev/tty. That more or less
>> equates to your keyboard. There is no easy way for Squeak to insert a keyboard
>> wedge to supply the password keystrokes, which of course is exactly what
>> was intended from a security point of view.
>>
>
>Actually, that reminds me - and I want to mention it now before I forget about
>it yet again - I think that the sudo password input issue might be effectively
>handled with the unix pseudo terminal interface (man 7 pty). Ian Piumarta made
>a plugin for this along with his really quite amazingly good telnet terminal
>emulator.
>
>That stuff, along with other things such as the VNC server, is still available here:
>
>  http://squeakvm.org/unix/goodies.html
>
>I also recall Ian asking me a long time ago why I didn't add pty support to
>the OSProcess plugin, which was a very good question, and I probably should have
>paid attention to it.
>
>Dave
>
>
--
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon


Reply | Threaded
Open this post in threaded view
|

Re: How to shutdown Raspbian from within Squeak?

David T. Lewis
On Thu, Mar 09, 2017 at 06:53:31PM -0500, Louis LaBrunda wrote:
> Hi Dave and Tim,
>
> Thanks for all the help.  I'm running Raspbian Jessie Lite (no desktop or GUI) and Squeak
> headless.

OK good, in that case I don't think you need to worry about entering a password for sudo.


> On boot I auto run Squeak.  Given that I didn't load CommandShell, which I think is
> a GUI interface.

CommandShell is not a GUI interface, although it does provide one for both
Morphic and MVC.  Mainly it is a simulation of a simple Unix shell, connected
to OSProcess for running the external commands.

Here is something that might do what you want:

  shell := CommandShell new.
  shell if: 'sudo shutdown -P now'
        then: [ Smalltalk snapshot: false andQuit: true ]
        else: [ self error: shell errorStream contents ].

This should ensure that the shutdown command has run successfully before you
quit the image. I am pretty sure that the quit will happen before the OS has
a chance to kill it as a result of the shutdown command, so I don't think you
need to worry about timing.

Dave


>  Squeak auto runs a Seaside program that only has one user so there is a
> password but no user id.  There is a setting screen and a main screen that allows the user to
> control up to 4 relays and view the status of up to 4 sensors/switches.
>
> This first pass is going to a friend where we will install it to control his garage doors thru
> the internet via a smart phone (or any browser).  I want to be able to reboot and shutdown from
> the browser just because sometime you need to.
>
> The reboot and shutdown code I used is below.  Just before calling those methods, I call a
> method to logoff from the web session.
>
> I'm not sure I need to but it seemed prudent to quit Squeak before shutting down.  I wait 10
> seconds to give the logoff time to paint.  I wanted to have the shutdown delay for a few
> seconds with the "-t sec" option but on Raspbian the sec option is taken as minutes (seems like
> a bug to me).  Anyway the "now" option seems to give Squeak enough time to quit without a
> problem.
>
> Thanks again for the help.
>
> Lou
>
> reboot
> "Reboot the computer."
>
> [
> (Delay forSeconds: 10) wait.
> UnixProcess thisOSProcess command: 'sudo shutdown -r now'.
> Smalltalk snapshot: false andQuit: true.
> ] fork.
>
> shutdown
> "Shutdown the computer."
>
> [
> (Delay forSeconds: 10) wait.
> UnixProcess thisOSProcess command: 'sudo shutdown -P now'.
> Smalltalk snapshot: false andQuit: true.
> ] fork.
>
> On Wed, 8 Mar 2017 20:17:06 -0500, "David T. Lewis" <[hidden email]> wrote:
>
> >On Wed, Mar 08, 2017 at 07:33:18PM -0500, David T. Lewis wrote:
> >> On Wed, Mar 08, 2017 at 04:23:45PM -0800, tim Rowledge wrote:
> >> >
> >> > > On 08-03-2017, at 4:07 PM, David T. Lewis <[hidden email]> wrote:
> >> > >
> >> > >
> >> > > Having said that, I suspect that the reboot is going to be tricky.
> >> > > The sudo command is designed for security, and it is smart enough not
> >> > > to let the password input come from some arbitrary input stream such as
> >> > > the one connected to your Squeak image. I'll try tinkering around with
> >> > > it a bit, but I'm afraid this may not be not as simple as you might expect.
> >> > Actually on a Pi ???sudo??? is normally password-free, wjich is probably enough to make some people???s heads explode, but there y???are.
> >> >
> >>
> >> Yes, on raspbian it will probably work. The tricky bit is that if you do
> >> need to enter a password, sudo will read the password from the controlling
> >> terminal the Squeak VM process, represented by /dev/tty. That more or less
> >> equates to your keyboard. There is no easy way for Squeak to insert a keyboard
> >> wedge to supply the password keystrokes, which of course is exactly what
> >> was intended from a security point of view.
> >>
> >
> >Actually, that reminds me - and I want to mention it now before I forget about
> >it yet again - I think that the sudo password input issue might be effectively
> >handled with the unix pseudo terminal interface (man 7 pty). Ian Piumarta made
> >a plugin for this along with his really quite amazingly good telnet terminal
> >emulator.
> >
> >That stuff, along with other things such as the VNC server, is still available here:
> >
> >  http://squeakvm.org/unix/goodies.html
> >
> >I also recall Ian asking me a long time ago why I didn't add pty support to
> >the OSProcess plugin, which was a very good question, and I probably should have
> >paid attention to it.
> >
> >Dave
> >
> >
> --
> Louis LaBrunda
> Keystone Software Corp.
> SkypeMe callto://PhotonDemon
>
>

Reply | Threaded
Open this post in threaded view
|

How to shutdown Raspbian from within Squeak?

Louis LaBrunda
Hi Dave,

Thanks for explaining CommandShell, I will give it a try.

Lou


On Thu, 9 Mar 2017 19:36:20 -0500, "David T. Lewis" <[hidden email]> wrote:

>On Thu, Mar 09, 2017 at 06:53:31PM -0500, Louis LaBrunda wrote:
>> Hi Dave and Tim,
>>
>> Thanks for all the help.  I'm running Raspbian Jessie Lite (no desktop or GUI) and Squeak
>> headless.
>
>OK good, in that case I don't think you need to worry about entering a password for sudo.
>
>
>> On boot I auto run Squeak.  Given that I didn't load CommandShell, which I think is
>> a GUI interface.
>
>CommandShell is not a GUI interface, although it does provide one for both
>Morphic and MVC.  Mainly it is a simulation of a simple Unix shell, connected
>to OSProcess for running the external commands.
>
>Here is something that might do what you want:
>
>  shell := CommandShell new.
>  shell if: 'sudo shutdown -P now'
>        then: [ Smalltalk snapshot: false andQuit: true ]
>        else: [ self error: shell errorStream contents ].
>
>This should ensure that the shutdown command has run successfully before you
>quit the image. I am pretty sure that the quit will happen before the OS has
>a chance to kill it as a result of the shutdown command, so I don't think you
>need to worry about timing.
>
>Dave
>
>
>>  Squeak auto runs a Seaside program that only has one user so there is a
>> password but no user id.  There is a setting screen and a main screen that allows the user to
>> control up to 4 relays and view the status of up to 4 sensors/switches.
>>
>> This first pass is going to a friend where we will install it to control his garage doors thru
>> the internet via a smart phone (or any browser).  I want to be able to reboot and shutdown from
>> the browser just because sometime you need to.
>>
>> The reboot and shutdown code I used is below.  Just before calling those methods, I call a
>> method to logoff from the web session.
>>
>> I'm not sure I need to but it seemed prudent to quit Squeak before shutting down.  I wait 10
>> seconds to give the logoff time to paint.  I wanted to have the shutdown delay for a few
>> seconds with the "-t sec" option but on Raspbian the sec option is taken as minutes (seems like
>> a bug to me).  Anyway the "now" option seems to give Squeak enough time to quit without a
>> problem.
>>
>> Thanks again for the help.
>>
>> Lou
>>
>> reboot
>> "Reboot the computer."
>>
>> [
>> (Delay forSeconds: 10) wait.
>> UnixProcess thisOSProcess command: 'sudo shutdown -r now'.
>> Smalltalk snapshot: false andQuit: true.
>> ] fork.
>>
>> shutdown
>> "Shutdown the computer."
>>
>> [
>> (Delay forSeconds: 10) wait.
>> UnixProcess thisOSProcess command: 'sudo shutdown -P now'.
>> Smalltalk snapshot: false andQuit: true.
>> ] fork.
>>
>> On Wed, 8 Mar 2017 20:17:06 -0500, "David T. Lewis" <[hidden email]> wrote:
>>
>> >On Wed, Mar 08, 2017 at 07:33:18PM -0500, David T. Lewis wrote:
>> >> On Wed, Mar 08, 2017 at 04:23:45PM -0800, tim Rowledge wrote:
>> >> >
>> >> > > On 08-03-2017, at 4:07 PM, David T. Lewis <[hidden email]> wrote:
>> >> > >
>> >> > >
>> >> > > Having said that, I suspect that the reboot is going to be tricky.
>> >> > > The sudo command is designed for security, and it is smart enough not
>> >> > > to let the password input come from some arbitrary input stream such as
>> >> > > the one connected to your Squeak image. I'll try tinkering around with
>> >> > > it a bit, but I'm afraid this may not be not as simple as you might expect.
>> >> > Actually on a Pi ???sudo??? is normally password-free, wjich is probably enough to make some people???s heads explode, but there y???are.
>> >> >
>> >>
>> >> Yes, on raspbian it will probably work. The tricky bit is that if you do
>> >> need to enter a password, sudo will read the password from the controlling
>> >> terminal the Squeak VM process, represented by /dev/tty. That more or less
>> >> equates to your keyboard. There is no easy way for Squeak to insert a keyboard
>> >> wedge to supply the password keystrokes, which of course is exactly what
>> >> was intended from a security point of view.
>> >>
>> >
>> >Actually, that reminds me - and I want to mention it now before I forget about
>> >it yet again - I think that the sudo password input issue might be effectively
>> >handled with the unix pseudo terminal interface (man 7 pty). Ian Piumarta made
>> >a plugin for this along with his really quite amazingly good telnet terminal
>> >emulator.
>> >
>> >That stuff, along with other things such as the VNC server, is still available here:
>> >
>> >  http://squeakvm.org/unix/goodies.html
>> >
>> >I also recall Ian asking me a long time ago why I didn't add pty support to
>> >the OSProcess plugin, which was a very good question, and I probably should have
>> >paid attention to it.
>> >
>> >Dave
>> >
>> >
>> --
>> Louis LaBrunda
>> Keystone Software Corp.
>> SkypeMe callto://PhotonDemon
>>
>>
>
--
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon


Reply | Threaded
Open this post in threaded view
|

How to shutdown Raspbian from within Squeak?

Louis LaBrunda
In reply to this post by David T. Lewis
Hi Dave and Tim,

I loaded CommandShell and use it because I like the idea of being able to test if the command
"worked".  I wanted to have the shutdown/reboot to wait a few seconds before kicking in because
I want the session to logoff and the browser to understand that the session is done and not
keep talking to it.  I played around a lot and ended up with having to use the shutdown option
that waits 1 minute, as there doesn't seem to be a working way (-t should wait seconds but
waits minutes) to wait some number of seconds.

Anyway, other than the reboot (which shouldn't be used often) taking longer than I like I am
please with the way it all works.  If you like you can see the code below.

Thanks again.

Lou


shutdown
        "Shutdown the computer."
        | shell |

        shell := CommandShell new.
        shell if: 'sudo shutdown -P 1'
                then: [self logoffAndQuit]
                else: [errorMessage := 'Shutdown failed: ', shell errorStream contents].


reboot
        "Reboot the computer."
        | shell |

        shell := CommandShell new.
        shell if: 'sudo shutdown -r 1'
                then: [self logoffAndQuit]
                else: [errorMessage := 'Reboot failed: ', shell errorStream contents].

logoffAndQuit
        "Logoff and quit out of Squeak."

        self logoff.
        [
                (Delay forSeconds: 5) wait.
                Smalltalk snapshot: false andQuit: true.
        ] fork.

note: errorMessage will be display on the current screen when there is an error.


On Thu, 9 Mar 2017 19:36:20 -0500, "David T. Lewis" <[hidden email]> wrote:

>On Thu, Mar 09, 2017 at 06:53:31PM -0500, Louis LaBrunda wrote:
>> Hi Dave and Tim,
>>
>> Thanks for all the help.  I'm running Raspbian Jessie Lite (no desktop or GUI) and Squeak
>> headless.
>
>OK good, in that case I don't think you need to worry about entering a password for sudo.
>
>
>> On boot I auto run Squeak.  Given that I didn't load CommandShell, which I think is
>> a GUI interface.
>
>CommandShell is not a GUI interface, although it does provide one for both
>Morphic and MVC.  Mainly it is a simulation of a simple Unix shell, connected
>to OSProcess for running the external commands.
>
>Here is something that might do what you want:
>
>  shell := CommandShell new.
>  shell if: 'sudo shutdown -P now'
>        then: [ Smalltalk snapshot: false andQuit: true ]
>        else: [ self error: shell errorStream contents ].
>
>This should ensure that the shutdown command has run successfully before you
>quit the image. I am pretty sure that the quit will happen before the OS has
>a chance to kill it as a result of the shutdown command, so I don't think you
>need to worry about timing.
>
>Dave
>
>
>>  Squeak auto runs a Seaside program that only has one user so there is a
>> password but no user id.  There is a setting screen and a main screen that allows the user to
>> control up to 4 relays and view the status of up to 4 sensors/switches.
>>
>> This first pass is going to a friend where we will install it to control his garage doors thru
>> the internet via a smart phone (or any browser).  I want to be able to reboot and shutdown from
>> the browser just because sometime you need to.
>>
>> The reboot and shutdown code I used is below.  Just before calling those methods, I call a
>> method to logoff from the web session.
>>
>> I'm not sure I need to but it seemed prudent to quit Squeak before shutting down.  I wait 10
>> seconds to give the logoff time to paint.  I wanted to have the shutdown delay for a few
>> seconds with the "-t sec" option but on Raspbian the sec option is taken as minutes (seems like
>> a bug to me).  Anyway the "now" option seems to give Squeak enough time to quit without a
>> problem.
>>
>> Thanks again for the help.
>>
>> Lou
>>
>> reboot
>> "Reboot the computer."
>>
>> [
>> (Delay forSeconds: 10) wait.
>> UnixProcess thisOSProcess command: 'sudo shutdown -r now'.
>> Smalltalk snapshot: false andQuit: true.
>> ] fork.
>>
>> shutdown
>> "Shutdown the computer."
>>
>> [
>> (Delay forSeconds: 10) wait.
>> UnixProcess thisOSProcess command: 'sudo shutdown -P now'.
>> Smalltalk snapshot: false andQuit: true.
>> ] fork.
>>
>> On Wed, 8 Mar 2017 20:17:06 -0500, "David T. Lewis" <[hidden email]> wrote:
>>
>> >On Wed, Mar 08, 2017 at 07:33:18PM -0500, David T. Lewis wrote:
>> >> On Wed, Mar 08, 2017 at 04:23:45PM -0800, tim Rowledge wrote:
>> >> >
>> >> > > On 08-03-2017, at 4:07 PM, David T. Lewis <[hidden email]> wrote:
>> >> > >
>> >> > >
>> >> > > Having said that, I suspect that the reboot is going to be tricky.
>> >> > > The sudo command is designed for security, and it is smart enough not
>> >> > > to let the password input come from some arbitrary input stream such as
>> >> > > the one connected to your Squeak image. I'll try tinkering around with
>> >> > > it a bit, but I'm afraid this may not be not as simple as you might expect.
>> >> > Actually on a Pi ???sudo??? is normally password-free, wjich is probably enough to make some people???s heads explode, but there y???are.
>> >> >
>> >>
>> >> Yes, on raspbian it will probably work. The tricky bit is that if you do
>> >> need to enter a password, sudo will read the password from the controlling
>> >> terminal the Squeak VM process, represented by /dev/tty. That more or less
>> >> equates to your keyboard. There is no easy way for Squeak to insert a keyboard
>> >> wedge to supply the password keystrokes, which of course is exactly what
>> >> was intended from a security point of view.
>> >>
>> >
>> >Actually, that reminds me - and I want to mention it now before I forget about
>> >it yet again - I think that the sudo password input issue might be effectively
>> >handled with the unix pseudo terminal interface (man 7 pty). Ian Piumarta made
>> >a plugin for this along with his really quite amazingly good telnet terminal
>> >emulator.
>> >
>> >That stuff, along with other things such as the VNC server, is still available here:
>> >
>> >  http://squeakvm.org/unix/goodies.html
>> >
>> >I also recall Ian asking me a long time ago why I didn't add pty support to
>> >the OSProcess plugin, which was a very good question, and I probably should have
>> >paid attention to it.
>> >
>> >Dave
>> >
>> >
>> --
>> Louis LaBrunda
>> Keystone Software Corp.
>> SkypeMe callto://PhotonDemon
>>
>>
>
--
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon