| Configure the Server from the Command Line |
89
Status
Lua return value
transfer start, returning it at any other state results in an
error.
Validation failure
LRET_INVALID
, optionally followed by a failure
description string
Script error
LRET_ERROR
followed by an error number or error
description string
Lua File Interfaces
Three Lua file interfaces allow Lua scripts to reference files:
lua_stat
,
lua_file_delete
, and
lua_rename
.
•
lua_stat("
file_path
")
Used to gather metadata for the single file specified by
file_path
, where
file_path
is relative to the docroot, if
defined. Metadata output include the following:
stat_data["exists"] = "true" | "false"
stat_data["size"] =
file_size
stat_data["blocks"] =
file blocks
stat_data["blocksize"] =
block_size
stat_data["type"] = "Invalid" | "S_IFDIR" | "S_IFREG" | "S_IFCHR"
|"S_IFBLK" | "S_IFIFO" | "S_IFSOCK" |
"S_IFLNK" | "Block stream" | "Custom" | "Unknown"
stat_data["mode format"] = "Windows format" | "Linux format"
stat_data["mode"] =
filemode
(format based on mode format above)
stat_data["uid"] =
uid
stat_data["gid"] =
gid
stat_data["ctime"] =
ctime
stat_data["mtime"] =
mtime
stat_data["atime"] =
atime
•
lua_file_delete("
file_path
")
Deletes the single file specified by
file_path
, where
file_path
is relative to the docroot, if defined.
•
lua_rename("
old_file_path
","
new_file_path
")
Renames the file specified by
old_file_path
with the new name specified by
new_file_path
, both of which are
relative to the docroot, if defined.
Lua Logging Interface
You can output simple text strings (format strings are not supported) to the Aspera logs using the
ascp
log interfaces.
For example, to log when the Lua script started, enter the following line in a Lua script:
lua_log("Lua script started")
This produces the following log entry:
xxxxxx LOG lua: Lua script started
The following
ascp
logging functions are supported:
•
as_log
•
as_err
•
as_dbg1