home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 48.4 Automatic Reminders and More: calendar Chapter 48
Office Automation
Next: 48.6 Get Calendar for Any Month or Year: cal
 

48.5 leave: A Maddening Aid to Quitting on Time

Time to leave! The message flashes across your screen, the terminal bell rings. You keep working.

You're going to be late! Another message, a minute later. Sheesh. Did your mother learn to use write (1.33 ) , or what?

No. It's the leave program that you started to remind you of a meeting. (A little while ago, it already told you that You have to leave in 5 minutes .) If your system has leave , you can start it in one of three ways:

  • leave 1300 sets the alarm for 1:00 p.m.

  • leave +30 sets the alarm for 30 minutes from now.

  • With no arguments, leave prompts you When do you have to leave? You can type an answer like 1300 or +30 above. Or, if you just press RETURN, leave will leave you alone. That's handy to put in your .login or .profile (2.2 ) file.

When will it stop nagging you? When you log out, leave stops automatically. Also, newer versions of leave will quit after ten minutes, saying That was the last time I'll tell you. Bye. Older versions keep on forever.

On some versions of leave , you can't set an alarm for any time tomorrow (past midnight). But you can use sleep (40.2 ) to start the leave past midnight. For example, maybe it's 10 p.m. now and you want to leave at 1 a.m. Midnight is two hours or 7200 seconds (60 x 60 x 2) from now. Add a fudge factor of 10 minutes (600 seconds) and type:

( )
 
$ (sleep 7800; leave 100) &


1234

You can also kill leave -though you have to use the "sure kill," signal 9 (38.8 ) . To see leave lurking in the background and get its PID (38.3 ) , you usually need the ps (38.5 ) -x option. Piping through grep leave will shorten the ps output:

% ps x | grep leave


 6914 p3 S     0:00 leave
19283 p3 R     0:01 grep leave
% kill -9 6914

- JP


Previous: 48.4 Automatic Reminders and More: calendar UNIX Power Tools Next: 48.6 Get Calendar for Any Month or Year: cal
48.4 Automatic Reminders and More: calendar Book Index 48.6 Get Calendar for Any Month or Year: cal

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System