Re: ntpd -s via ssh remote command 'hangs'

2014-10-07 Thread Daniel Melameth
On Mon, Oct 6, 2014 at 6:34 PM, Philip Guenther  wrote:
> On Mon, Oct 6, 2014 at 2:09 PM, Tor Houghton  wrote:
>> Hi,
>>
>> Dumb question: I'm running 'sudo ntpd -s' as part of a remote command to an
>> OpenBSD guest[*]; unless I add a 'pkill sshd' to the end of the remote
>> command, e.g.
>>
>>   ssh guesthost 'sudo pkill -9 ntpd && sudo ntpd -s && date && pkill sshd'
>>
>> the ssh connection won't disconnect. Why is this ('sudo ntpd -s' by itself,
>> in a shell, returns a prompt)?
>
> By itself, one of the ntpd daemons will keep open the stdin/out/err it
> was started with, which in this case will be the pipe or tty created
> by of the ssh server.
>
> The easiest solution (if there isn't a virtualbox toolset) is to use
> the rc.d framework, which will handle the fds:
> ssh guesthost '/etc/rc.d.ntpd restart'

You might also want to consider doing this via /etc/apmd/resume
instead.  See apmd(8) for details.

> and put the -s in ntpd_flags in rc.conf.local



Re: ntpd -s via ssh remote command 'hangs'

2014-10-06 Thread Tor Houghton
On Mon, Oct 06, 2014 at 05:34:34PM -0700, Philip Guenther wrote:
> 
> By itself, one of the ntpd daemons will keep open the stdin/out/err it
> was started with, which in this case will be the pipe or tty created
> by of the ssh server.

Aha. Thank you very much for the explanation.

> 
> The easiest solution (if there isn't a virtualbox toolset) is to use
> the rc.d framework, which will handle the fds:
> ssh guesthost '/etc/rc.d.ntpd restart'
> 
> and put the -s in ntpd_flags in rc.conf.local
> 

Yes; this is very much the more elegant solution; thanks again.

Tor



Re: ntpd -s via ssh remote command 'hangs'

2014-10-06 Thread Philip Guenther
On Mon, Oct 6, 2014 at 2:09 PM, Tor Houghton  wrote:
> Hi,
>
> Dumb question: I'm running 'sudo ntpd -s' as part of a remote command to an
> OpenBSD guest[*]; unless I add a 'pkill sshd' to the end of the remote
> command, e.g.
>
>   ssh guesthost 'sudo pkill -9 ntpd && sudo ntpd -s && date && pkill sshd'
>
> the ssh connection won't disconnect. Why is this ('sudo ntpd -s' by itself,
> in a shell, returns a prompt)?

By itself, one of the ntpd daemons will keep open the stdin/out/err it
was started with, which in this case will be the pipe or tty created
by of the ssh server.

The easiest solution (if there isn't a virtualbox toolset) is to use
the rc.d framework, which will handle the fds:
ssh guesthost '/etc/rc.d.ntpd restart'

and put the -s in ntpd_flags in rc.conf.local


Philip Guenther



Re: ntpd -s via ssh remote command 'hangs'

2014-10-06 Thread Giancarlo Razzolini
On 06-10-2014 18:09, Tor Houghton wrote:
> Hi,
>
> Dumb question: I'm running 'sudo ntpd -s' as part of a remote command to an
> OpenBSD guest[*]; unless I add a 'pkill sshd' to the end of the remote
> command, e.g.
>
>ssh guesthost 'sudo pkill -9 ntpd && sudo ntpd -s && date && pkill sshd'
>
> the ssh connection won't disconnect. Why is this ('sudo ntpd -s' by itself,
> in a shell, returns a prompt)?
>
> Regards,
>
> Tor
>
> * Yep, it's a clunky work-around for resetting the guest's clock after
> VirtualBox startvm'ing a savestate'd guest (perhaps there is a better way?
> :-})
>
You have lots of options. You can install the virtualbox guest additions
(as far as I know the OpenBSD doesn't have it) if your machine is linux.
But in your case, instead of using ntpd, you could run a ntpd on your vm
host and in your guest you should run the rdate(8) command. It will not
daemonize itself, it will just set the clock (or not) and exit. You
could even run it in the machine start, just put it on the
/etc/rc.conf.local.

Cheers,

[demime 1.01d removed an attachment of type application/pkcs7-signature which 
had a name of smime.p7s]



ntpd -s via ssh remote command 'hangs'

2014-10-06 Thread Tor Houghton
Hi,

Dumb question: I'm running 'sudo ntpd -s' as part of a remote command to an
OpenBSD guest[*]; unless I add a 'pkill sshd' to the end of the remote
command, e.g.

  ssh guesthost 'sudo pkill -9 ntpd && sudo ntpd -s && date && pkill sshd'

the ssh connection won't disconnect. Why is this ('sudo ntpd -s' by itself,
in a shell, returns a prompt)?

Regards,

Tor

* Yep, it's a clunky work-around for resetting the guest's clock after
VirtualBox startvm'ing a savestate'd guest (perhaps there is a better way?
:-})