FAQ's - APPX Software, Inc. : Trash :
603 - Automating Export/Import with Unix Crontabs | |
"Can I run an APPX process via a Unix command (one liner) to Export and Import? I would like to setup a crontab to handle this if I can."
The part invoked via the APPX menu system that turns an APPX file into a flat (but still machine architecture-dependent format) file The part invoked via the "appx -e=filename" which turns the machine dependent format into APPX's portable interchange format. (This is an optional step for going between machines with different byte orders, like between RS/6000 AIX and Windows boxes) Each of these steps would be automated in different ways. The second is shorter, so we'll discuss it first.
-------------------------------------------------------------------------------- 2. Converting files from ASCII to 'brf', and back You can put the commands:
appx -e=filename (for Export) and ... into batch scripts or crontab entries in the same way that you'd put an entry in to run an APPX process. You'd specify -i={filename} and -e={filename} arguments, instead of the -a={application}, -d={database}, and such. To see this argument list, run appx -u from the Unix command line, or appxutil -u from a DOS popup box. (See Moving Files Between Platforms for further discussion of 'Endian' byte order conversion.) -------------------------------------------------------------------------------- 1. Exporting and Importing via APPX menu system This requires recording an APPX action script (which you do interactively at the keyboard). You then set up a batch script to replay that script in unattended mode:
export APPX_SCRIPT_OUT=/tmp/export.script Start APPX and perform the sequence of events that you want to run via cron later. (This part's totally up to you, so no example is provided. Think of this like recording and saving a macro in Word, for playback AND EVEN EDITING IF YOU WANT TO TWEAK IT A BIT later, except that the feature is turned on before you get into APPX and you can't turn it on and off during your APPX session.) Exit APPX Copy the script just created to a new name (so it doesn't get overwritten next time you enter APPX). You can look at the script in vi (or whatever) if you want. You'll see it's a logical trace of the options you chose and input you provided.
--------------------------------------------------------------------------------
Set the environment variable APPX_SCRIPT_IN equal to the filename of the script you want to replay. export APPX_SCRIPT_IN=/tmp/export.script
Run "appx", take your hands off the keyboard and WATCH IT GO!
# Run first APPX script
"2>&1" says to redirect stderr into stdout. ">/dev/null" says to throw that stdout stream away. I think that's what most people do. However, occasionally errors get reported on that stream, so IMHO it's useful to keep it, either for a few days (in case you don't notice a problem until later) or at least until the next time the script is run. For example, to save the stdout/stderr stream until the next run of the same script, you could use a line like: appx 2>&1 >/tmp/export.script If you wanted to be fancy and save these by date, so that you could store a week (or more's worth at a time), you could do something like: appx 2>&1 >/tmp/export.script.`date +"%y%m%d.%H%M"` That mishmash, when executed, will resolve to a filename like /tmp/export.script.990527.0322 ... which embeds the date and time of the APPX script's START of execution, into the filename.
Of course, if you do this, you'll be creating a new file in /tmp each time you run the cron entry, so be warned that you'll have to create some sort of UNIX shellscript to remove these when you no longer want them around, or remember to delete them periodically, so that /tmp doesn't fill up. | |
[Append to This Answer] | |
2010-May-20 12:29am |
Previous: | 702 - APPX Software Y2K Information |
Next: | 624 - File Analysis and Recovery |
|