适用于多服务器管理员的便携式脚本语言?
请注意:如portableapps.com 中的“可移植”,而不是传统意义上可在多种架构或操作系统上使用的语言。无论是谁创造了“便携式”一词的这种用法,都应该受到严厉打击。 :)
我是一名 DBA 和系统管理员,主要负责运行 SQL Server 的 Windows 计算机。我正在寻找一种适用于 Windows 的编程/脚本语言,不需要管理员访问权限或安装程序,除了将其展开到文件夹中之外不需要安装过程。我的目的是拥有一种可以标准化的自动化语言。
到目前为止,我一直在使用批处理文件和 Unix shell 的组合,使用 UnxUtils 中的 sh.exe但这远非完美的解决方案。
我评估了一些选项,它们都至少有一个或另一个严重缺点。我对开源或双重许可证有强烈的偏好,但我更感兴趣的是找到合适的工具而不是其他任何东西。对依赖 Cygwin 或 Java 的任何东西不感兴趣,但目前我对需要 .NET 的东西没问题。
要求:
- 可管理的占用空间(1-100 个文件,安装后小于 30 MB)
- 在 Windows XP 和 Server (2003+) 上运行
- 无安装程序(exe、msi)
- 不依赖 JVM 或 Cygwin 安装
- 可与外部一起使用管道、进程和文件
- 支持 MS SQL Server 或 ODBC 连接
奖励点:
- 开源
- FFI,用于调用本机 DLL 中的函数
- GUI 支持(本机或 gtk、wx、fltk 等)
- Linux、AIX、和/或 OS X 支持
- 动态、面向对象和/或功能、解释或字节码编译;交互式开发
- 能够将脚本打包或编译为可执行文件
到目前为止我已经尝试过:
- Ruby:磁盘上 148 MB,23000 个文件
- Portable Python:磁盘上 54 MB,2800 个文件
- Strawberry Perl:磁盘上 123 MB ,3600 个文件
- REBOL:很好,除了闭源代码并且免费版本中没有 MSSQL 或 ODBC
- Squeak Smalltalk:很好,除了对脚本的支持很差
Please Note: Portable as in portableapps.com, not in the traditional sense of a language that can be used on multiple architectures or operating systems. Whoever coined this usage of the word portable should be whacked. :)
I'm a DBA and sysadmin, mostly for Windows machines running SQL Server. I'm looking for a programming/scripting language for Windows that doesn't require Admin access or an installer, needing no install process other than expanding it into a folder. My intent is to have a language for automation around which I can standardize.
Up to this point, I've been using a combination of batch files and Unix shell, using sh.exe from UnxUtils but it's far from a perfect solution.
I've evaluated a handful of options, all of them have at least one serious shortcoming or another. I have a strong preference for something open source or dual license, but I'm more interested in finding the right tool than anything else. Not interested that anything that relies on Cygwin or Java, but at this point I'd be fine with something that needs .NET.
Requirements:
- Manageable footprint (1-100 files, under 30 MB installed)
- Run on Windows XP and Server (2003+)
- No installer (exe, msi)
- No reliance on a JVM or Cygwin install
- Works with external pipes, processes, and files
- Support for MS SQL Server or ODBC connections
Bonus Points:
- Open Source
- FFI for calling functions in native DLLs
- GUI support (native or gtk, wx, fltk, etc)
- Linux, AIX, and/or OS X support
- Dynamic, object oriented and/or functional, interpreted or bytecode compiled; interactive development
- Able to package or compile scripts into executables
So far I've tried:
- Ruby: 148 MB on disk, 23000 files
- Portable Python: 54 MB on disk, 2800 files
- Strawberry Perl: 123 MB on disk, 3600 files
- REBOL: Great, except closed source and no MSSQL or ODBC in free version
- Squeak Smalltalk: Great, except poor support for scripting
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
我强烈建议你尝试 Lua。关于您的要求:
popen
,则支持还有你的加分点:
srlua
,或者我可以向您发送一个 120 行 Lua 脚本,该脚本将 Lua 源代码转换为 .c 文件,您可以将其链接到您的应用程序和解释器中以生成可执行文件。
I urge you to try Lua. Regarding your requirements:
popen
is provided then that is supported also.And your bonus points:
srlua
, or I can send you a 120-line Lua script that converts Lua source to a .c file that you link in with your app and the interpreter to make an executable.Additional bonus points:
有几个 Python 选项可能适合您的需求:
第一个是 IronPython, 可以是无需安装程序即可运行,并且可以很好地与 .net API 配合使用。这使您可以访问具有 .net API 或 COM 类型库的任何内容,您可以为其构建 PIA。正是出于这个原因,我使用 at 作为脚本编写机制 - 它可以放入系统内的目录中,并且不需要显式安装。.
您必须有一个适当的 .Net 运行时已安装,但 .Net 2.0 是随 SQL Server 2005 一起安装的。可以通过 ADO.net 访问 SQL Server,并且使用 Winforms 构建 GUI 相当简单。
第二个是Portable Python,它被设计为通过USB密钥运行。虽然我看到你已经尝试过,但你可以详细说明一下缺点是什么。如果基本安装中没有某些内容,您可以随时考虑构建包含它的自定义版本。 TkInter(至少)是捆绑的。
您还可以使用 Py2EXE 生成独立的 python 应用程序,并删除所有多余的垃圾。这将为您提供大约 10 个左右的文件(取决于 DLL 的数量),这些文件可以从单个目录(可能在 USB 密钥上)运行。
在 Unix-oid 操作系统上运行本地 python 安装非常简单,所以这几乎是理所当然的。此外,Python 随大多数 Linux 发行版一起提供,并且可以从大多数(如果不是全部)传统 UNIX 供应商那里作为“贡献软件”获得。 IIRC 它也与 MacOS 捆绑在一起。
There are a couple of options for Python that might fit your bill:
The first is IronPython, which can be run without an installer and will play nicely with .net APIs. This gives you access to anything with a .net API or a COM typelib that you could build a PIA for. I've used at as a scripting mechanism for precisely this reason - it could be dropped into a directory within the system and did not need to be explicitly installed..
You will have to have an appropriate .Net runtime installed, but .Net 2.0 is installed with SQL Server 2005. SQL Server can be accessed through ADO.net and building GUIs with Winforms is fairly straightforward.
The second is Portable Python which is designed to be run off a USB key. Although I see you've already tried it, you might elaborate on what the shortcomings were. If something isn't available in the basic install you could always look into building a custom version with it included. TkInter (at least) is bundled.
You can also use Py2EXE to generate standalone python applications with all superfluous junk stripped out. This will give you about 10 files or so (depending on the number of DLLs) that can be run from a single directory, possibly on a USB key.
Running local python installs on Unix-oid OS's is pretty straightforward, so that's pretty much a no brainer. Also, python comes with most linux distros and is available as 'contributed software' from most if not all trad unix vendors. IIRC it's also bundled with MacOS.
Tclkit 是一个单文件、独立的 Tcl/Tk 系统。我的mac版本大约是3.8兆。您可以获得几乎任何现代操作系统的版本。我随身携带一个拇指驱动器,里面有 Mac、Windows 和 Linux 二进制文件,这样我就可以在任何平台上运行我的脚本。无需安装,只需将一个文件复制到任何您想要的位置即可。
原始规范中唯一缺少的是开箱即用的 MS SQL Server / ODBC 支持。我知道人们使用 tcl 来实现这一点,但我认为你必须添加一个额外的库或其他东西。有关详细信息,请参阅 MS SQL Server 上的 Tcl'ers wiki 条目。
Tclkit is a single-file, self-contained Tcl/Tk system. The mac version I have is about 3.8 megs. You can get a version for just about any modern OS. I carry around a thumb drive that has mac, windows and linux binaries so I can run my scripts on any platform. No install is required, just copy one file wherever you want.
The only thing it's missing from your original spec is MS SQL Server / ODBC support out of the box. I know people use tcl for that but I think you'll have to add an extra library or something. See the Tcl'ers wiki entry on MS SQL Server for more information.
对于 tcl 来说,除了 Tclkit 之外,freewrap 是另一个小型便携式、独立的 tcl 解释器。
只需将 freewrap 可执行文件重命名为其他名称即可将其转换为独立解释器。将其重命名回 freewrap 会将其转换为脚本包装器。
此外,免费包装的应用程序包含 tcl 解释器。在紧急情况下,您可以尝试将应用程序作为 zip 文件打开,并编辑/替换其中包含的 tcl 代码(只需记住先复制一份)。当我在没有开发工具的客户站点但需要排除某些问题时,这多次帮助我解决问题。我只是复制了我部署的应用程序之一和 presto - 即时开发环境!
For tcl, apart from Tclkit, freewrap is another small portable, self-contained interpreter for tcl.
Just rename the freewrap executable to something else will convert it to a stand-alone interpreter. Renaming it back to freewrap will convert it to a script wrapper.
Also, freewrapped apps contain a tcl interpreter. In dire emergencies you can try opening the app as a zip file and edit/replace the tcl code contained within (just remember to make a copy first). This has saved me several times when I'm at a client site without development tools but need to troubleshoot something. I just make a copy of one of my deployed app and presto - instant development environment!
查看维基百科详尽的便携式软件列表
维基百科上有 Tiny C 编译器这里,还有它自己的主页此处。
通过引用维基百科的功能列表来总结一下:
希望这会有所帮助并且有用,
此致,
汤姆.
Looking at wikipedia's exhaustive list of portable software
There's Tiny C compiler, again on Wikipedia here, and its own homepage here.
To summarize by quoting from wikipedia's list of features:
Hope this helps and would be of use,
Best regards,
Tom.
每个现代的 Windows 版本都预装了 VBScript 和 JScript。它们不能满足您的所有功能(我想到的是编译为可执行文件),但它们在安装大小方面确实具有无与伦比的优势:很难击败
0
。Every somewhat modern Windows version comes pre-installed with both VBScript and JScript. The doesn't meet all your features (compile to an executable comes to mind), but they certainly have an unbeatable advantage with the installation size: it's hard to beat
0
.除了Lua建议之外,还有Idle。它基本上是 Lua 5.1 的超集,语言(和库)和实现都基于 Lua。它最初是为了成为一个更完整的 Windows 脚本解决方案而创建的:因为 Lua 主要用于嵌入,所以它有一个相当小的标准库,并且通常期望嵌入应用程序为 Lua 提供丰富的库。
这对于嵌入式语言来说是有意义的,因为毕竟 Adobe Lightroom、Nginx 和 World of Warcraft 之间没有太多共同的功能,因此您无法将任何内容放入标准中。图书馆。但对于一种更通用的操作系统脚本语言,人们需要一个稍大的库。因此,Idle 在其标准库中捆绑了几个 Lua 第三方库(有时很难在 Windows 上运行)。
Idle 标准库在 Lua 上添加的一些功能包括紧密的 Win32 集成、SQLite3 支持、网络支持、PEG 解析器生成器和存档支持。
此外,Idle 支持将 Perl 和 C 代码嵌入到您的 Idle 程序中。
In addition to the Lua suggestion, there is also Idle. It is basically a superset of Lua 5.1, with both the language (and libraries) and the implementation based on Lua. It was originally created to be a more complete scripting solution for Windows: because Lua is primarly intended for embedding, it has a rather small standard library and it is usually expected that the embedding application provides a rich library to Lua.
This makes sense for an embedded language, because, after all, there isn't much common functionality between, say Adobe Lightroom, Nginx and World of Warcraft, so there simply is nothing you can put in a standard library. But for a more general purpose OS scripting language, one would want a slightly larger library. Thus, Idle bundles a couple of libraries that are third-party (and sometimes hard to get to work on Windows) in Lua in its standard library.
Some of the things that the Idle standard library adds over Lua are tight Win32 integration, SQLite3 support, networking support, a PEG parser generator and archive support.
Also, Idle has support for embedding Perl and C code into your Idle programs.