PsotLogin and PostSession scripts for Solaris


 
Thread Tools Search this Thread
Operating Systems Solaris PsotLogin and PostSession scripts for Solaris
# 1  
Old 08-25-2011
PsotLogin and PostSession scripts for Solaris

Hi Guys

I am currently tring to setup a system to monitor (also for billing purpose) all the instruments in our facility (university reserch instrumentation facility). The OS's running on these computers include Windows, Redhat and Solaris (Solaris 9 in csh). I have managed to get login/off scripts done for Windows and Linux machines. But I failed to setup similar script for solaris. I am a winodws guy and not good at unix system especially Solaris. There is a "last" command in Solaris that can get login/off information but it does not fit our needs since we want to know instantly/remotely/automatically who is login/off of that machine and when.

Can anyone give me some advice how to do it? Thanks.
 
Here is what I did for Linux machines, which works well. I inserted following scripts to record the login/off information,

For login, insert /etc/gdm/PostLogin/Defaults with
l=login
filename = "/...../log.txt"
echo "$HOSTNAME $USERNAME $l $dat" > filename

For logout, insert /etc/gdm/PostSessionDefault with
l=logout
filename = "/...../log.txt"
echo "$HOSTNAME $USERNAME $l $dat" > filename

Last edited by jimx; 08-25-2011 at 06:11 PM..
# 2  
Old 08-26-2011
Queries:
1. In above code, if someone directly shut down system, it won't log in mentioned file, what is remedy for that?
2. Do your user login to solaris using CLI/GUI?
3. How did you achieve "instantly/remotely/automatically" in above code, you are putting entries into a file only? Same can be achieved by last command on both linux and solaris.

There are couple of solutions avaialble ranging from writing a shell script to use BSM audit.

Please answer above queries to assist you further.
# 3  
Old 08-26-2011
Don't reinvent the wheel. Solaris has built-in accounting features.

The Blog of Ben Rockwood
# 4  
Old 08-26-2011
Thanks for the help guys.

To achenle, in short, the accounting is a small part of this project. Also, the Solaris built in accounting system does not fit our needs.

To psshah,
1) The instrument controller computers do not shut down. Users only need to login to use the instrument and then logoff when they are done. Sometimes we have to shut down the computers but that is rare.

2) GUI

3) There are over 20 instruments in our facility. There is a program (written in vb.net) running on a windows computer in our main office which is monitoring the login/off activities of all the instruments (basically monitoring the log.txt made by the login/off script of that instrument). Whenever the program detects a user finishes the experiment and logoff the instrument, a few things will be done instantly. Two examples, 1) the usage information will be collected instantly. By adding other information (user name, research group, account #, time, cost, etc), a new entry will be added to a billing database which will be processed monthly. 2) The user's newly save data will be located and uploaded to a cloud storage (for data backup, or user can process data in his/her lab).

In fact this system has been running for a while, except the two Solaris instruments which I still don't know how to get login/off information instantly from our main office.

Thanks again for any advice.
# 5  
Old 08-29-2011
On Solaris you first need to implement IP QoS so you can see how much traffic is made, then use accounting extended facility and to get login/logout and other information use Solaris audit options or syslogd deamon to get when someone loged in and then log out.

Then create small shell script which will extract information you need.
# 6  
Old 08-29-2011
have a look under /etc/X11/gdm/PostLogin and /etc/X11/gdm/PostSession directories.
# 7  
Old 08-31-2011
Thanks guys for the advise.

What tamitot suggested is just what I am looking for (very similar to what I did on linux machines). But I could not find /etc/X11/gdm directory on the Solaris computers. I am running Solaris 2.6 and Solaris 7. In fact, I have search whole directories for gdm or X11 and found none. Any advise? Thanks
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Solaris

When were all scripts on the Solaris server last executed?

Hi All, I am new to this forum and I am hoping someone will be able to help me:) I have inherited a very old Solaris server that has a number of scripts around 500 in total. I need to migrate the scripts to Linux but I would like to know which ones are currently being executed rather... (10 Replies)
Discussion started by: josamy
10 Replies

2. Solaris

Moving directory structure and scripts from HP to Solaris

Hi, I am presently working in a migration project from HP Unix to Sun Solaris. I need to place all the directory structures, shell scripts and users into Sun Solaris. By doing this task manually there is a possibility for discrepencies. So any tools are there to do these kind of... (4 Replies)
Discussion started by: nag_sathi
4 Replies

3. Solaris

Solaris 10 startup scripts

Hi all, I have a server in maintenance mode and need to boot it up. Its due to a broken service "RepX". I need to stop the service from trying to start at boot up but i can't find where it is booting up from... it is not in any of the rcX.d directories and the two locations i have found it... (6 Replies)
Discussion started by: Tommyk
6 Replies

4. Solaris

Scripts in solaris server

hi, i want to know whether we can use both perl and unix shell in a single script in Solaris server (4 Replies)
Discussion started by: chn10db001
4 Replies

5. Shell Programming and Scripting

2 shell scripts in Sun Solaris

Hi, Can somebody pls help me? I need to write 2 shell scripts in Sun Solaris operating system which would do this: 1. go to the specified directory - I am using alias for it at the moment 2. start the particular sql script with the output log as same as the script but with timestamp e. g.... (4 Replies)
Discussion started by: balco
4 Replies

6. Solaris

Solaris login scripts

I've got Solaris 9. I've read that I can do a login script for each individual user with the .postlogin file, but is there not a way to set up something like that from a group-membership level? If there is, how can one trace down what group membership login scripts are being run? (0 Replies)
Discussion started by: citrowske
0 Replies

7. UNIX for Advanced & Expert Users

scripts no longer running (solaris 8)

hello: I am a somewhat experienced unix user, but brand new to this forum. I am encountering a strange new problem. I have a shell script called foo.ksh it has been running for years (literally) on my Sun (Solaris 8) machine. Recently we put a version of samba on this machine to... (3 Replies)
Discussion started by: smcadoo
3 Replies

8. UNIX for Dummies Questions & Answers

kill scripts under Solaris

I should know this, but do K scripts in the /etc/rc?.d directories get run in numerically ascending or descending order? By default there are none in rc3.d. Is it OK to put 2 in there, and will they be run first (which is my goal). Thanks, Chuck (1 Reply)
Discussion started by: 98_1LE
1 Replies
Login or Register to Ask a Question