Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!usenet.ins.cwru.edu!ncoast!allbery From: allbery@NCoast.ORG (Brandon S. Allbery KB8JRR) Newsgroups: comp.unix.admin Subject: Re: Forcing actions at login Message-ID: <1991Jan13.231048.25341@NCoast.ORG> Date: 13 Jan 91 23:10:48 GMT References: <6153@ecs.soton.ac.uk> <446@minya.UUCP> <1991Jan10.191546.268@am.sublink.org> Reply-To: allbery@ncoast.ORG (Brandon S. Allbery KB8JRR) Followup-To: comp.unix.admin Organization: North Coast Computer Resources (ncoast) Lines: 58 As quoted from <1991Jan10.191546.268@am.sublink.org> by alex@am.sublink.org (Alex Martelli): +--------------- | jc@minya.UUCP (John Chambers) writes: | [discussion of using a script as shell for a pseudo-user] | :It turns out to be a bad idea to use /bin/sh as the login shell for | :such a script. Why? Well, /bin/sh insists on running /etc/profile | :for all users; there's no (documented ;-) way to suppress this. If | :your /etc/profile does "cat /etc/motd" (and most do), it is just a | | Just kludge up a way to disable motd-checking - simplest scheme I can | think of, offhand, is to add something like: | egrep "^$LOGNAME:.*NOMOTD" /etc/passwd >/dev/null && exit +--------------- $ sed -n 6,10p /etc/profile if test ! -f $HOME/.hushlogin; then if newer-than /etc/motd $HOME/.enoughalready; then cat /etc/motd touch $HOME/.enoughalready fi fi $ cat newer-than.c #include #include #include main(argc, argv) int argc; char **argv; { struct stat f1, f2; if (argc != 3) { fprintf(stderr, "usage: newer-than file1 file2\n"); exit(2); } if (stat(argv[1], &f1) == -1) { perror(argv[1]); exit(2); } if (stat(argv[2], &f2) == -1) { perror(argv[2]); exit(2); } return (f1.st_mtime <= f2.st_mtime); } $ # those with "test file1 -nt file2" can use that instead $ _ ++Brandon -- Me: Brandon S. Allbery VHF/UHF: KB8JRR on 220, 2m, 440 Internet: allbery@NCoast.ORG Packet: KB8JRR @ WA8BXN America OnLine: KB8JRR AMPR: KB8JRR.AmPR.ORG [44.70.4.88] uunet!usenet.ins.cwru.edu!ncoast!allbery Delphi: ALLBERY