Bannière Linux personnalisée

Dans le fichier de profile /etc/profile de connexion au terminal il est possible de:

  • Definer les paths
  • Executer un script au demarrage de la session en précisant simplement son chemin: /usr/local/bin/welcome.sh par exemple

 

let upSeconds="$(/usr/bin/cut -d. -f1 /proc/uptime)"
let secs=$((${upSeconds}%60))
let mins=$((${upSeconds}/60%60))
let hours=$((${upSeconds}/3600%24))
let days=$((${upSeconds}/86400))
UPTIME=`printf "%d days, %02dh%02dm%02ds" "$days" "$hours" "$mins" "$secs"`

# get the load averages
read one five fifteen rest < /proc/loadavg

echo "$(tput setaf 2)
.~~. .~~. `date +"%A, %e %B %Y, %r"`
'. \ ' ' / .' `uname -srmo`$(tput setaf 1)
.~ .~~~..~.
: .~.'~'.~. : Uptime.............: ${UPTIME}
~ ( ) ( ) ~ Memory.............: `cat /proc/meminfo | grep MemFree | awk {'print $2'}`kB (Free) / `cat /proc/meminfo | grep MemTotal | awk {'print $2'}`kB (Total)
( : '~'.~.'~' : ) Load Averages......: ${one}, ${five}, ${fifteen} (1, 5, 15 min)
~ .~ ( ) ~. ~ Running Processes..: `ps ax | wc -l | tr -d " "`
( : '~' : ) Domoticz status....: `ps ax | grep domotics | wc -l | tr -d " "`
'~ .~~~. ~' SSH failure attempt: `cat /var/log/auth.log | grep sshd | grep -a Failed | grep -va "for pi" | wc -l`
'~'
$(tput sgr0)"

Resultat

Linux domoticzpi 3.12.35+ #730 PREEMPT Fri Dec 19 18:31:24 GMT 2014 armv6l
Last login: Tue Jul 28 15:18:50 2015 from 80.215.228.135

   .~~.   .~~.    Friday, 31 July 2015, 08:11:39 PM
  '. \ ' ' / .'   Linux 3.12.35+ armv6l GNU/Linux
   .~ .~~~..~.    
  : .~.'~'.~. :   Uptime.............: 0 days, 05h05m04s
 ~ (   ) (   ) ~  Memory.............: 267528kB (Free) / 382800kB (Total)
( : '~'.~.'~' : ) Load Averages......: 0.01, 0.03, 0.05 (1, 5, 15 min)
 ~ .~ (   ) ~. ~  Running Processes..: 69
  (  : '~' :  )   Domoticz status....: 1
   '~ .~~~. ~'    SSH failure attempt: 0 

Leave a Reply

Your email address will not be published. Required fields are marked *