Re: ssh&scp batch

From: all mail refused (elvis_at_notatla.org.uk)
Date: 02/21/04


Date: 21 Feb 2004 16:37:03 GMT

In article <c17uad$6st$1@news-reader4.wanadoo.fr>, chris wrote:

>I wrote a script with this line in :
>scp -B myuser@myhost:/source/dir/myfile.tar.gz /target/dir
>(ssh_agent launched via keychain)
>
>if i execute my script via the console, it works fine
>
>but if i launch it via cron => i have an error message !!???
>
>an idea which will help me to solve this problem ???

0. Is this an error message that you think we already know
   or that you don't like to quote ?

1. Do you mean ssh-agent when you have ssh_agent ?

2. Stuff that fails when called by cron but works from elsewhere
   has normally failed for lack of some environment setting.
   Compare "env" output from the two places. Getting the cron
   job to source your .profile is a common solution.

3. In this case I suspect the stuff derived from ssh-agent is missing:
    SSH_AUTH_SOCK=/tmp/ssh-vOdx6785/agent.6785; export SSH_AUTH_SOCK;
    SSH_AGENT_PID=6786; export SSH_AGENT_PID;

-- 
Elvis Notargiacomo  master AT barefaced DOT cheek


Relevant Pages

  • Re: Cron Job will not run.
    ... >> The script below works perfectly when I run it from a console, however, ... From Cron it is not. ... Either add it to the crontab or set PATH in ...
    (freebsd-questions)
  • SUMMARY: cron entry: nth day of every month?
    ... cron can not handle this with its own syntax. ... 21st but "command" only runs if the output of the "date" command ... What I would suggest is rather than embedding the logic in each script ... The answer is it is _not_ possible to control it only with crontab ...
    (Tru64-UNIX-Managers)
  • Re: Cron Jobs
    ... > having a cron will mean yo server is forced by the script ... > best than allowing mail dequeing by connection. ... > host server so I can get emails for my domain example.com. ...
    (RedHat)
  • Re: Problems with periodic scripts in jails [Cron <operator@sosai> /usr/libexec/save-entropy]
    ... >> If a cron job (eg, a shell script) doesn't perform whatever locking it ... it's not difficult to imagine cron kicking off the script ... > That's a good suggestion. ...
    (freebsd-current)
  • Re: Silent Cron Jobs
    ... afaik cron mails all output from a script. ... cronjob I usually dump all stdout ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
    (Debian-User)