-----BEGIN PGP SIGNED MESSAGE-----
> Can an SQL database (PostgreSQL) be connected to shell in a way that if
> a directory is changed on shell it will update the database with the
> changes? If so how?
> A prompt reply would be appreciated.
On most *nix systems, this feature is called "auditing." You may not
realize this, Greg, but what you *really* want to do is:
1) Turn on auditing (if auditing is not available, try new OS).
2) Write a script which grovels through the audit log periodically
and inserts the appropriate rows in your database.
Actually, there *is* another alternative:
1) Make everybody's shell /bin/bash (or translate the following)
2) Create the following alias in /etc/profile
alias cd="\cd $1;psql database -c \"insert into cdtable values (\'$PWD\');\\g\""
3) Hope your users don't unalias that.
BTW, the alternative offered above is BAD:
1) Every cd invokes psql == suckful performance.
2) Can be trivially broken by users.
3) Will not notice chdir()'s in shell-scripts and executables.
An improvement can be attained by grabbing the source to bash, and
modifying both the init code (attach to database) and the "cd" code
(insert row, COMMIT). However, this shell should *never* be used by
root (never futz with the root shell) or PostgreSQL superuser
| JAVA must have been developed in the wilds of West Virginia. |
| After all, why else would it support only single inheritance?? |
| Finger geek(at)andrew(dot)cmu(dot)edu for my public key. |
-----BEGIN PGP SIGNATURE-----
-----END PGP SIGNATURE-----
In response to
pgsql-hackers by date
|Next:||From: Tom Lane||Date: 1998-07-01 16:40:24|
|Subject: Re: [HACKERS] DB-shell connect |
|Previous:||From: Bruce Momjian||Date: 1998-07-01 15:30:25|
|Subject: Re: [HACKERS] DB-shell connect|