*BSD News Article 26273


Return to BSD News archive

Newsgroups: comp.unix.bsd
Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!ads.com!decwrl!decwrl!usenet.coe.montana.edu!netnews.nwnet.net!ns1.nodak.edu!plains.NoDak.edu!bhati
From: bhati@plains.NoDak.edu (Amit Bhati)
Subject: Re: How to use the command "at" during logout???
Sender: usenet@ns1.nodak.edu (Usenet login)
Message-ID: <CJw8oK.2Btx@ns1.nodak.edu>
Date: Wed, 19 Jan 1994 20:24:20 GMT
References: <CJIqKn.Bu9@hkuxb.hku.hk>
Nntp-Posting-Host: plains.nodak.edu
Organization: North Dakota Higher Education Computing Network
Lines: 43

In article <CJIqKn.Bu9@hkuxb.hku.hk> h9211221@hkueee (CHU WAI LEUNG) writes:
>
>	Command "at".....
>	How to use it to run a scipt file just after I logout everytime???
>	Please e-mail to me to tell me...
>	Thanks you very much......
>	Bye...
>
>	William

Why dont you instead trap the EXIT signal? Attach the following 2 lines
at the end of your .profile file.

# Trap the EXIT signal and execute commands in the .logout file.
trap "$HOME/.logout" EXIT

Now all you have to do is make a file named ".logout" (in your HOME
directory). That file should contain a shell script for whatever you
would like to do at log-out time.... and there you go!

The above method will make you wait until it executes the shell
script in the file ".logout". Only then will you actually exit.
However if you wished to 'first' exit and 'later' have the script run
in the background you could write a small shell script that would get
the current time, then schedule all the commands you want executed
(using at) about a minute or so later. Place the date-catching and
"at"-command scheduling shell script in the ".logout" file and the
commands for "at" in another file...in your $HOME/bin
directory...

Now maybe there are more elegane methods to do all this. I would like
to know them too.

Cheers,
amit
--
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+
| Amit Bhati                          |
| bhati@{plains,badlands}.nodak.edu   |
|                                     |
| ...my other .sig is POSIX compliant.|
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+