天道酬勤,学无止境

scp

使用 Mercurial,是否有一种简单的方法可以将我的工作副本与默认远程存储库中的提示文件进行比较(Using Mercurial, is there an easy way to diff my working copy with the tip file in the default remote repository)

问题 使用 mercurial 时,我希望能够将文件的工作副本与默认远程存储库中的提示文件进行比较。 是否有捷径可寻? 我知道我可以做一个“hgincoming -p”来查看进入的更改补丁集,但是如果我做一个pull,那么直接查看特定文件的实际更改会很好最新的东西(或者我可能要推出的东西)。 我现在能想到的最简单的事情是创建一个小脚本来查看 .hg/hgrc 中的默认位置并使用 curl 下载文件(如果它通过 http,否则通过 ssh scp,或者只是做一个如果它在本地文件系统上,则直接 diff)然后将工作副本或提示与该临时副本进行比较。 我正在尝试向我的团队出售 mercurial,我的一名团队成员今天提出了这一点,因为他们可以使用他们的 GUI 工具在 SVN 中轻松完成。 回答1 经过一番挖掘,我发现了 Rdiff 扩展,它可以完成我想要的大部分功能。 它不随 mercurial 一起提供,但可以通过克隆存储库来安装它: hg clone http://hg.kublai.com/mercurial/extensions/rdiff 然后修改您的 ~/.hgrc 文件以加载扩展名: [extensions] rdiff=~/path/to/rdiff/repo/rdiff.py 这有点古怪,因为它实际上通过检测第一个参数是否是远程 URL 来修改现有的“hg diff

2021-11-26 13:49:55    分类:技术分享    svn   http   mercurial   diff   scp

Scp through ssh tunnel opened

I want to send files from machineA which has opened a reverse tunnel with a server. The reverse tunnel connects port 22 on machineA with port 2222 on the server: autossh -M 0 -q -f -N -o "ServerAliveInterval 120" -o "ServerAliveCountMax 1" -R 2222:localhost:22 userserver@server.com If I do: scp file userserver@server.com:. then SCP sends the file with a new login over SSH, in my case using public/private key. But if I do: scp -P 2222 file userserver@localhost:. I get a "connection refused" message. The same happens if I replace 2222 above with the port found with: netstat | grep ssh | grep

2021-11-24 08:51:35    分类:问答    ssh   scp   ssh-tunnel

Getting an error EOF : Command no found when using ssh

I am trying to rename the filenames in remote server like filename-dirname.suffix and copy the files to my server . I had written code like .... #!/usr/bin/bash TRANSFERSERVERXMLS="/emp/transfer/XMLS" REMOTESERVERXMLS="remoteemp/empdir/XMLS" # renaming the filenames in remote server like filename-dirname.suffix ssh abc@xyz REMOTESERVERXMLS=$REMOTESERVERXMLS 'bash -s'<< 'EOF' for i in $REMOTESERVERXMLS/* ; do if [[ -d $i ]]; then dirname=$(basename $i) for j in $REMOTESERVERXMLS/$dirname/* ; do fname="$(basename "$j")" prefix=$(echo $fname | awk -F "." 'NF{NF-=1};1') suffix=$(echo $fname | awk

2021-11-24 05:04:53    分类:问答    bash   unix   ssh   sh   scp

How to deploy from git repo without server having access to repo?

I have a PHP project in a BitBucket git repo. I work in a branch called "develop" for small fixes, or I work in temporary feature branches. When I'm ready to deploy, I merge those branches into "master". I want to make deploying to my live site as easy as that (merging to master and pushing to BitBucket). But I really don't want my server to have any access to my repo because that adds security concerns. If you care about security, you want your repo to be in as few places as possible. If your server gets compromised, that's a bad enough situation, but it would be even worse if the attacker

2021-11-22 13:03:13    分类:问答    git   deployment   rsync   scp

Paramiko / scp - check if file exists on remote host

I'm using Python Paramiko and scp to perform some operations on remote machines. Some machines I work on require files to be available locally on their system. When this is the case, I'm using Paramiko and scp to copy the files across. For example: from paramiko import SSHClient from scp import SCPClient ssh = SSHClient() ssh.load_system_host_keys() ssh.connect('192.168.100.1') scp = SCPClient(ssh.get_transport()) scp.put('localfile', 'remote file') scp.close() ssh.close() My question is, how can I check to see if 'localfile' exists on the remote machine before I try the scp? I'd like to try

2021-11-22 08:37:33    分类:问答    python   python-2.7   ssh   scp   paramiko

Using Mercurial, is there an easy way to diff my working copy with the tip file in the default remote repository

When using mercurial, I'd like to be able to diff the working copy of a file with the tip file in my default remote repository. Is there an easy way to do this? I know I can do an "hg incoming -p" to see the patch sets of changes coming in, but it'd be nice to just directly see the actual changes for a particular file that I'd get if I do a pull of the latest stuff (or what I might be about put push out). The easiest thing I can think of right now is to create a little script that takes a look at the default location in .hg/hgrc and downloads the file using curl (if it's over http, otherwise

2021-11-21 17:31:53    分类:问答    svn   http   mercurial   diff   scp

nohup causes "read_passphrase: can't open /dev/tty"

I have a simple remote ssh command in script, nohupssh.sh sleep 30 ssh -v -l developer server11 "/usr/local/jdk1.7.0_45/bin/jmap -histo:live 1770;" I run the script as follows: nohup nohupssh.sh > out.log 2>&1 & When I execute it as shown above, the jmap utility successfully executes on the remote server. However, if I execute it as shown above and exit the bash shell, I get the error shown below. Note that I have a properly formatted authorized_keys in both local and remote servers. Also note that there is NO id_rsa in either server since these servers are shared. I've tried many combinations

2021-11-21 01:15:44    分类:问答    ssh   scp   nohup

如何在通过中间服务器连接的本地和远程服务器之间传输数据?(how to transfer data between local and remote server connected via intermediate server?)

问题 我可以通过ssh -X servA从local登录,然后ssh -X servB从servA 若要从数据复制local到servB ,我scp从文件local到servA ,然后从servA到servB 。 直接从local复制文件到servB ,反之亦然可行吗? 回答1 您可以使用 nc (net cat) 作为 ssh 的代理。 因此,对于您的示例,请编辑您的~/.ssh/config文件,如下所示: Host servB ProxyCommand ssh -q servA nc servB 22 只要 nc 在您的路径中,您现在就应该能够 ssh 或 scp 目录到 servB 如果你没有 nc 你可以用 ssh -W 如果你的版本足够新(> = OpenSSH 5.4), Host ServB ProxyCommand ssh -W ServB:22 servA 回答2 在 ssh 配置文件中使用ProxyCommand 。 回答3 这是我通常做的(我在Mac机器上做的,不知道它是否与Windows机器不同): 与任何 servA 或 servB 建立连接后,您可以执行以下操作: 从本地复制到 servA 或 servB: $ scp -P <port-number used> <file location to copy from> <username_in

2021-11-19 16:18:03    分类:技术分享    linux   bash   shell   ssh   scp

使用命令行函数在python中复制日志(copying logs in python using the command line function)

问题 我对我的代码有疑问,我想我可以在这里验证。 我的要求是从两个不同的服务器复制 apache 日志和错误日志。 我用for循环写了一个python程序。 我的代码: def copylogs(Appache,Errorlog, folder_prefix) : root_path = '/home/tza/Desktop/LOGS/' folders = ['Appache','Errorlog'] for folder in folders: folder_name = folder_prefix + "_" + folder + str(int(time.time())) mkdircmd = "mkdir -p " + root_path + "/" + folder_name os.system(mkdircmd) filePath = root_path + folder_name serverPath = "/var/log/apache/*" cmd = "scp " + "symentic@60.62.1.164:" + serverPath + " " + filePath cmd = cmd.replace("60.62.1.164" ,myip1) cmd = os.system(cmd) print "Logs are at:",root_path

2021-11-18 16:21:35    分类:技术分享    python   automation   scp

用于在文件层次结构中查找特定文件的 Bash 脚本(Bash script to find specific files in a hierarchy of files)

问题 我有一个文件夹,其中有很多文件夹,在每个文件夹中我都有很多很多文件。 我不知道每个文件可能位于哪个文件夹中。我会定期收到我需要复制到预定义目的地的文件列表。 该脚本将在 Unix 机器上运行。 所以,我的小脚本应该: 读取接收列表查找列表中的所有文件通过 SCP 将每个文件复制到预定义的目的地 第 1 步和第 3 步,我想我会自己管理,但是我将如何进行第 2 步? 我正在考虑使用“查找”来定位每个文件,找到后,将位置写入字符串数组中。 找到所有文件后,我遍历字符串数组,为每个文件位置运行“SCP”命令。 我认为这应该可行,但我以前从未编写过 bash 脚本,所以有人可以帮助我入门吗? 我只需要一个基本的“查找”命令,它会查找文件名并在找到文件时返回文件位置。 回答1 find $dir -name $name -exec scp {} $destination \;

2021-11-15 14:57:42    分类:技术分享    bash   unix   find   scp