我编写了一个在本地执行时运行良好的脚本:
./sysMole -time Aug 18 18
Run Code Online (Sandbox Code Playgroud)
参数"-time"、"Aug"、"18"和"18"成功传递给脚本。
现在,这个脚本被设计为在远程机器上执行,但是从本地机器上的本地目录执行。例子:
ssh root@remoteServer "bash -s" < /var/www/html/ops1/sysMole
Run Code Online (Sandbox Code Playgroud)
这也很好用。但是当我尝试包含上述参数(-time Aug 18 18) 时,问题就出现了,例如:
ssh root@remoteServer "bash -s" < /var/www/html/ops1/sysMole -time Aug 18 18
Run Code Online (Sandbox Code Playgroud)
运行该脚本后,我收到以下错误:
bash: cannot set terminal process group (-1): Invalid argument
bash: no job control in this shell
Run Code Online (Sandbox Code Playgroud)
请告诉我我做错了什么,这非常令人沮丧。
是否有一种相当简单的方法来处理tar
目录中的多个(特定)文件?例如,假设以下是一个目录:
-rw-r--r-- 1 allend bin 98 Jul 20 15:50 scriptlog.log
-rw-r--r-- 1 allend bin 19533 Jul 29 21:47 serveralert.log
-rwxr--r-- 1 allend bin 1625 Jul 29 21:47 orion
-rw-r--r-- 1 allend bin 24064 Jul 29 21:49 orion_files.tar
-rwxr--r-- 1 allend bin 156 Aug 4 21:22 htmltest
-rw-r--r-- 1 allend bin 131 Aug 4 21:23 page.html
Run Code Online (Sandbox Code Playgroud)
如果我只想要tar
文件serveralert.log
和page.html
?
为什么我在运行命令后会被踢出 FTP 会话?似乎一旦我成功登录到服务器,在运行诸如“ls”之类的命令后会得到以下信息(我已将错误部分包含在“[ERROR]”标签中):
allen92@allen92-VirtualBox:~/Videos$ ftp -n ftp.FreeBSD.org
Connected to ftp.FreeBSD.org.
220 beastie.tdk.net FTP server (Version 6.00LS) ready.
ftp> user
(username) anonymous
331 Guest login ok, send your email address as password.
Password:
230 Guest login ok, access restrictions apply.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
[ERROR]
421 Service not available, remote server has closed connection
[ERROR]
ftp>
Run Code Online (Sandbox Code Playgroud)
这似乎发生在任何远程 FTP 服务器上。当我登录到本地机器并运行 FTP 命令时,一切正常。如果实际上“421”错误是一个通用错误,有什么办法可以找出问题的根源?任何有关这方面的线索将不胜感激。我一直无法找到有关此特定内容的任何支持问题的。任何有类似问题的人,请分享您的想法。
注意:我安装了VSFTPD。