<<

Scripting in the Current Environment A Cheat Sheet By Johnnie Odom Anyone Can Script

If you type it in the Terminal or Command Window, it can be scripted.

If you can write a webpage, you can create a GUI for your scripts.

If you learn any programming, you can get fancy with your scripts.

And if you look around, you can steal or modify lots of existing scripts. What You Will Need

A good text editor. On Windows: Notepad++ or Visual Studio Not Notepad. NOT WORDPAD! OS X: TextWrangler / BBEdit, Coda, TextMate : Various based on religion (Seriously: Gedit, Vi, Emacs, nano, joe, jedit ...) Ideally a test environment. A server to run central scripts. Hint: SuSE / OES. A means to send desktop scripts to workstations. Hint: It’s ZENWorks What You Need to Find Out

The path to the scripting engine.

/usr/bin/php [Unix Style scripts begin with #!/path/to/engine]

:\Windows\System32\cmd.exe” [ZENworks likes to know engine path.]

What libraries are available?

Libraries installed by default or at system install.

Package system for installation of additional libraries.

Most script libraries are just shims to system libraries.

Google for documentation and scripting examples.

Also, look at Cool Solutions and developer.novell.com

And steal from Novell engineering (see what scripting files are included with the products.)

How do I run arbitrary / shell commands?

What facilities are available for error reporting and logging? System versus log file.

Can I put a GUI on it or make it clickable? Novell / TAG Targets

ZENWorks:

Command Line Interface (zman and zac - “zman batch” is your friend!)

Data Model

OES / SuSE / eDirectory

LDAP!

Any traditionally scriptable component of Linux (i.e. everything)

Screen-Scraping iManager

GroupWise

Current SOAP interface

Upcoming RESTful admin interface

eDirectory attributes

Vibe

Windows registry and Linux / OS X configuration files.

NetIQ / SuSE

Just about everything from these divisions has a firmly supported scriptable component. Workstation Targets

Files

Windows Registry

Application-Specific Databases

System commands Windows Options

Traditional batch (cmd.exe)

VBScript

Powershell (Use this!)

Other .NET languages as needed.

Soon, lots of Javascript. Linux / OS X Options Shell + Unix Utils

Perl

PHP

Python

Ruby

Expect - TCL

CGI

Javascript

AppleScript / osascript

Mono I Take Working Vacations A Few Words on and .NET

GUI targets keep shifting on Windows. If on Mono, use GTK# and install on Windows for cross-platform compatibility.

Don’t use DirectoryService for eDirectory connections -- it does not support SSL on standard LDAP. Use the Novell C# LDAP libraries instead. Also, those are (somewhat) cross-platform.

Mono is quite good now. Good for cross-platform solutions. LDAP Tips

Use a raw LDAP tool like LDAP Browser (have to search for that one) to see how eDirectory really represents items. Use your imagination. Group-Like Things have two entries -- one in the group, and one in each member object. Always filter searches by object class to make sure you avoid getting other objects with similar names. CLI Vs. GUI

CLI allows more flexible deployment and combination of scripts with other tools.

GUIs allow users to self-service.

If using a heavy environment (.NET), GUIs are fairly easy.

On OS X, osascript can trigger AppleScript GUI events (buttons, text boxes).

But the best GUI is the web. PHP of course, but also Perl, CGI, ruby, ASP etc. Demos Deploying Your Scripts

Yes, you can still do one-liners in the NCP login script.

ZENworks!

Yes, it can move script files to HD and run them as a launch action, but ...

Why not just run them direct as a ZENworks bundle?

Run from mapped drive.

File copy.

System package format - .msi (Win), .pkg (OS X), rpm (Linux) Some Crazy Ideas

Screen-Scraping iManager

Novell Virtual File System

XTier

LibFLAIM Conclusion

On the Unix side, check out Eric. S. Raymond’s “The Art of Unix Programming”

Be sure to submit to Cool Solutions http://www.novell.com/communities/coolsolutions

Write lots of code comments.

Remove your site assumptions.

Compose a friendly title page

Fabulous Prizes!

Have Fun!