On Sun, Jan 12, 2003 at 06:53:21PM +0100, Pascal Bleser wrote:
> Jean-Francois Dive wrote:
> >Tu as le classique inittab qui te permet de lancer une application vers
> >une console, mais ca sera lancé en tant que root.
> pas si tu lances un script qui fait un su
> 
> >cat <<EOF > /etc/rc.boot/startop
> >#!/bin/sh
> >su -user -c "nice /usr/bin/top > /dev/tty2
> >EOF
> hmm... faut pas un & ?

ah si tiens, est resté dans le bic :)

> 
> su -user -c "nice /usr/bin/top > /dev/tty2 &
> 
> >chmod +x /etc/rc.boot/startop
> >/etc/rc.boot/startop
> 
> Sur SuSE/LSB, ce serait:
> 
> --8<------[/etc/init.d/boot.top]----------------------------
> #!/bin/bash
> ### BEGIN INIT INFO
> # Provides:           boot.top
> # Required-Start:     boot.proc
> # Required-Stop:
> # Default-Start:      B
> # Default-Stop:
> # Description:                Starts a "top" console
> ### END INIT INFO
> . /etc/rc.status
> . /etc/rc.config
> 
> rc_reset
> 
> PIDFILE=/var/run/topconsole.pid
> RUNAS_USER=nobody
> NICE_LEVEL=18
> CONSOLE_DEVICE=/dev/tty2
> 
> case "$1" in
>   start)
>       startproc \
>          -n "$NICE_LEVEL" \
>          -p "$PIDFILE" \
>          -u "$RUNAS_USER" \
>            /usr/bin/top >$CONSOLE_DEVICE
>       rc_status -v
>       ;;
>   stop)
>       killproc -p "$PIDFILE" /usr/bin/top
>       rc_status -v
>       ;;
>   restart)
>       $0 stop
>       $0 start
>   status)
>       checkproc -p "$PIDFILE" /usr/bin/top
>       rc_status -v
>       ;;
>   *)
>       echo "Usage: $0 {start|stop|restart|status}"
>       exit 1
>       ;;
> esac
> --8<------[/etc/init.d/boot.top]----------------------------
> 
> Evidemment:
> chmod +x /etc/init.d/boot.top
> 
> Ensuite, pour activer le service:
> 
> chkconfig -a boot.top
> 
> Je n'ai pas testé ça, mais ça devrait marcher...
> 
> Au moins, c'est conforme à la LSB (Linux Standard Base) ;-)

oulaaa, attention la, ca pourrait vite déraper en flame war ca :)

> 
> -- 
>   -o) Pascal Bleser  http://guru.unixtech.be |
>   /\\              <[EMAIL PROTECTED]> |
>  _\_v <[EMAIL PROTECTED]>                     |
> ---------------------------------------------|
> Jesus saves,Buddha makes incremental backups :
> ---------------------------------------------'
> 
> _______________________________________________________
> Linux Mailing List - http://www.unixtech.be
> Subscribe/Unsubscribe: http://www.unixtech.be/mailman/listinfo/linux
> Archives: http://www.mail-archive.com/linux@lists.unixtech.be
> IRC: efnet.unixtech.be:6667 - #unixtech

-- 

-> Jean-Francois Dive
--> [EMAIL PROTECTED]

  There is no such thing as randomness.  Only order of infinite
  complexity.  - _The Holographic Universe_, Michael Talbot

_______________________________________________________
Linux Mailing List - http://www.unixtech.be
Subscribe/Unsubscribe: http://www.unixtech.be/mailman/listinfo/linux
Archives: http://www.mail-archive.com/linux@lists.unixtech.be
IRC: efnet.unixtech.be:6667 - #unixtech

Répondre à