Re: How can I run ssh command in cron?



On 2008-02-24, Sailer <sailer.shen@xxxxxxxxx> wrote:
On 2??22??, ????6??02??, Adrian Ball <ab.use...@xxxxxxxxxxxxx> wrote:
On Thu, 21 Feb 2008 22:28:16 -0800, Sailer wrote:
On 2??17??, ????6??24??, Barry Margolin <bar...@xxxxxxxxxxxx> wrote:
In article
<SNIP>
But it looks the command not be run, I don't know and how to run
it in crontab?

<SNIP>

I receive a mail from system.

Content-Type: text/plain; charset=UTF-8 Auto-Submitted: auto-generated
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=root>
X-Cron-Env: <USER=root>

Pseudo-terminal will not be allocated because stdin is not a terminal.
Warning: remote port forwarding failed for listen port 1234

Try ssh -n (see man ssh) - this should attempt to run the command without
attempting to allocate a tty.

HTH,
Ade.

--
Adrian Ballhttp://www.majords.co.uk/
Do not use spam-trap ab.usenet address - please use:-
ade at majords . co . uk

I have not command to run,I just want to login remote ssh server, so I
cannot use -n. When I run "/usr/bin/ssh -R 1234:localhost:22 -l root
192.168.1.1 -n", it said:
Pseudo-terminal will not be allocated because stdin is not a terminal.

The flag you want is -N, which prevents ssh from trying to run any
remote command at all. It's intended specifically for sessions that
are only setting up port forwarding, just like you're doing here.


--
Christopher Mattern

NOTICE
Thank you for noticing this new notice
Your noticing it has been noted
And will be reported to the authorities
.



Relevant Pages

  • [ANN] pyKook 0.7.0 - task automation tool for Python, similar to Rake or Ant
    ... you can run commands on remote machines using ssh. ... Remote command execution is available. ...
    (comp.lang.python)
  • Remote Execution of sudo Command Hangs.
    ... One is trying to use ssh and sudo to ... If you run it via ssh from a remote system, however, it ... Reading the expect manual shows an exit command but also ...
    (freebsd-questions)
  • Re: help with text-append over SSH ? - dd: unknown operand >>
    ... I have an account on a system where I cannot log in over SSH, ... But again, file2 is remote, and I can't log in there... ... access to the 'echo' command and the 'dd' command on ... Then you are not running a 'standard shell', but some sort of local ...
    (freebsd-questions)
  • Re: How can I start a GUI application through SSH
    ... >> I would like to be able to start an X application through ssh. ... >> app to actually run on my local box (meaning I want the window to pop up ... > For the purpose of this discussion, the 'server' is the remote system the ... > If you want to learn more, you should read up on the xauth command. ...
    (freebsd-questions)
  • Re: Setting env variable via ssh
    ... from a bash command line, I want to invoke a remote ... before I can I invoke ... on the remote machine. ... How do I connect to the machine via ssh, set the environment variable and finally invoke ...
    (comp.unix.shell)