Forum OpenACS Development: execute bash commands on TCL script

Collapse
Posted by Iuri Sampaio on
I am trying to write a TCL script that runs some commands in the unix environment and get back some results to use in the system environment.

I saw exec()
http://www.tcl.tk/man/tcl8.4/TclCmd/exec.htm

But i still need more documentation and samples about the theme.

Does anyone have?

Collapse
Posted by Iuri Sampaio on
I found a very good one
http://wiki.tcl.tk/812
Collapse
Posted by Brian Fenton on
Hi Iuri,

if you have a specific question I can try to answer it.

Brian

Collapse
Posted by Rodrigo Proença on
Hi Iuri,

I wrote TCL scripts to perform the backup of the database using the web as well:

if [catch {
set database_name [db_get_database]
[exec pg_dump -O -f $dest/db.dmp $database_name ]
} errmsg] {
set msg "Error: $errmsg"

} else {
set msg "Done"
}

...

if [catch {
[exec gzip -9 $dest/db.dmp]
} errmsg] {
append msg "Error: $errmsg"
} else {
append msg "Done"
}

It looks like what you want?

Collapse
Posted by Iuri Sampaio on
Precisely!

with little amends i will be fine

Thanks Rodrigo

Collapse
Posted by Rodrigo Proença on
Iuri,

Package monitoring has a good example too. It runs the command line (TOP) and inserts each response row in database.