delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
DomainKey-Signature: | a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id |
:list-unsubscribe:list-subscribe:list-archive:list-post | |
:list-help:sender:mime-version:from:date:message-id:subject:to | |
:content-type; q=dns; s=default; b=uIRA74OieHlrS8an/2/A3k3FdWda4 | |
2qLA0XWhHXGfSO6iiNQz2dzHUlbTAz90jvAroZXpiUy8ERtspdmgCHsh5FOLFc79 | |
3O/g80jrHsoVSjvfpHZE47a5k6nYtBuBRNlnaGePPXQyGHhA6QUZ7oc1Vj5pE43n | |
KBT4gc/vicBz4I= | |
DKIM-Signature: | v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id |
:list-unsubscribe:list-subscribe:list-archive:list-post | |
:list-help:sender:mime-version:from:date:message-id:subject:to | |
:content-type; s=default; bh=uVBbrAh7gGgDAE/sgiNGC36PmBs=; b=cRe | |
lXA0wV6KqQItUAu5rMIXWxJuS54vj9dDje2Gnv2Wby6a8nFX/VLO4e8rHFUXfm6l | |
n9+y52Uh1j/NbwDxqYeg+ZSM+Is0Yb2XfMuadWBM5Nx5AlCx2OMmUFOEFjoiOhy8 | |
UOa//M8S6wE02GdzTB5TQgQY1MBWIWBkWyTgF1qY= | |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
Authentication-Results: | sourceware.org; auth=none |
X-Virus-Found: | No |
X-Spam-SWARE-Status: | No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 |
X-HELO: | mail-wg0-f48.google.com |
X-Received: | by 10.180.211.2 with SMTP id my2mr28110333wic.13.1415606163212; Sun, 09 Nov 2014 23:56:03 -0800 (PST) |
MIME-Version: | 1.0 |
From: | Kal Sze <swordangel AT gmail DOT com> |
Date: | Mon, 10 Nov 2014 15:55:23 +0800 |
Message-ID: | <CAGZiy72_f5E=ENEzRQnmAXEqR04qQYW0UWjQ+JprrBNV6FHnTQ@mail.gmail.com> |
Subject: | ssh-add stuck from time to time. |
To: | cygwin AT cygwin DOT com |
X-IsSubscribed: | yes |
I'm using rsync in crontab to automate a periodic backup of some files to a Debian server. I'm trying to prevent the cron job from getting stuck when no ssh-agent is actually alive. Here is my setup: OS: Windows 8.1 64-bit Cygwin: 64-bit 1.7.32 Relevant packages*: - openssh 6.7p1-1 - keychain 2.7.1-1 - rsync 3.0.9-1 - cron 4.1-61 - bash 4.1.17-9 The crontab: BACKUP_LOG_PATH=/home/kal/backup.log */1 * * * * /usr/bin/flock -n /tmp/my_backup.lck /home/kal/backup The /home/kal/backup script: #!/usr/bin/bash # redirect stdout and stderr if BACKUP_LOG_PATH defined. if [ "$BACKUP_LOG_PATH" ]; then exec > "$BACKUP_LOG_PATH" 2>&1 fi keychain_file="/home/kal/.keychain/$HOSTNAME-sh" if [ -r "$keychain_file" ]; then . /home/kal/.keychain/$HOSTNAME-sh if kill -0 "$SSH_AGENT_PID" && /usr/bin/ssh-add -l > /dev/null; then kdd=/cygdrive/e/final/ if [ "$(ls "$kdd")" ]; then rsync -az --chmod=Dugo+rwx,Fugo+rw --remove-source-files --exclude='bundle_version' "$kdd"* kal AT my DOT debian DOT server:/srv/datafiles/ exit_status_1=$? if [ $exit_status_1 -ne 0 ]; then echo "[`date`]: failure ($exit_status)"; exit fi rsync -az --chmod=Dugo+rwx,Fugo+rw --remove-source-files "$kdd"* kal AT my DOT debian DOT server:/srv/datafiles/ exit_status_2=$? if [ $exit_status_2 -eq 0 ]; then find "$kdd" -mindepth 1 -depth -type d -empty -delete; echo "[`date`]: success"; else echo "[`date`]: failure ($exit_status)"; fi else echo "[`date`]: no file to transfer."; fi else echo "[`date`]: keychain not initialized."; fi else echo "[`date`]: keychain not initialized."; fi So after every reboot, the first thing I do is to open the cygwin bash terminal so keychain gets eval'ed and I input the passwords for my private keys. The problem is that, sometimes, `ssh-add -l` would get stuck and not return, even though the ssh-agent is clearly running. And so my cron job gets stuck. If I open a new cygwin bash terminal, keychain is eval'ed in ~/.profile and would also get stuck. What am I doing wrong? Best regards, Kal -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |