OVH Community, your new community space.

rc.local de debian jessie


janus57
11/01/2016, 19h58
Citation Envoyé par nowwhat
Idem chez moi : Debian 8.2

Après le

"Debian" ajoute plus rien, sauf la partie que janus57 a montré, qui est d'origine "OVH".
Bonjour,

c'est ça, par défaut c'est vide.

Cordialement, janus57

nowwhat
11/01/2016, 00h24
Idem chez moi : Debian 8.2

Après le
# By default this script does nothing.
"Debian" ajoute plus rien, sauf la partie que janus57 a montré, qui est d'origine "OVH".

danyel
10/01/2016, 22h30
Merci janus, c'est bien celui la

janus57
10/01/2016, 21h15
Bonjour,

voici celui d'un debian 8 :
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

true > /etc/motd
if [ -e /etc/lsb-release ]
then
. /etc/lsb-release
[ -n "${DISTRIB_DESCRIPTION}" ] && echo "${DISTRIB_DESCRIPTION}" > /etc/motd
fi
uname -a >> /etc/motd
echo >> /etc/motd
echo "server : `cat /root/.mdg 2>/dev/null`" >> /etc/motd
echo "ip : `cat /etc/network/interfaces | grep "address" | head -n 1 | cut -f 2 -d " "`" >> /etc/motd
echo "hostname : `hostname`" >> /etc/motd
echo >> /etc/motd
/bin/cp /etc/motd /etc/issue
root@srv1:# cat /etc/debian_version
8.2

Cordialement, janus57

Freemaster
10/01/2016, 18h24
l'original de la v8, sans rien rajouter, ni enlever

Code:
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

exit 0

danyel
10/01/2016, 18h01
Merci nowwhat, mais le fichier que tu me donnes (et que j'avais) c'est la version debian v7 du rc.local
Je cherche la v8 car, de tete, j'ai souvenir qu'il y a pour l'affichage des interfaces ipv4/ipv6, une seule ligne de commande (plutot que le bloc do)
Et mes recherches et google ne m'ont pas donne resultat
Je suis tjrs preneur.
Encore merci

nowwhat
09/01/2016, 15h50
Hi,

Par défaut, ce fichier existe, mais il ne fait rien ....

De mémoire, OVH (l'outil qui installe sur ton serveur un OS) change ce ficher un petit peu, pour qu'il change le "prompt".

Voici le mien :
Code:
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
J'ai ajouté ceci:

Code:
true > /etc/motd

echo "Debian GNU/Linux $(cat /etc/debian_version)">  /etc/motd
echo                                              >> /etc/motd
uname -a                                          >> /etc/motd
echo                                              >> /etc/motd
echo "server    : `cat /root/.mdg 2>/dev/null`"   >> /etc/motd
echo "hostname  : `hostname`"                     >> /etc/motd
#
# search interfaces that are connected
#

for net_interface in `ip link show | grep eth | grep UP | awk {'print $2'} | sed 's/://g'`
do
        # IPv4
	for IPV4 in `ip addr show ${net_interface} | grep 'inet .*\/' | awk {'print $2'}| grep -Eo '[[:digit:]]{1,3}(\.[[:digit:]]{1,3}){3}'`
	do
	        echo "${net_interface} IPv4 : ${IPV4}" >> /etc/motd
	done
        #IPv6
        for IPV6 in `ip -6 addr show ${net_interface} | grep 'inet6' | awk {'print $2'}`
        do
                if [[ "${IPV6}" =~ ^fe80.* ]]; then
                        echo "   ... Link-Local-Adresse IPv6"
                else
                        echo "${net_interface} IPv6 : ${IPV6}" >> /etc/motd
                fi
        done
done
Sinon, sache que Debian est open source ... donc, il me semble que le fichier "original", on le trouve sur le net

Astuce : http://unix.stackexchange.com/questi...f-etc-rc-local

DeeJay
09/01/2016, 07h50
Salut,

Si c'est bien /etc/rc.local voici:

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

true > /etc/motd
if [ -e /etc/lsb-release ]
then
. /etc/lsb-release
[ -n "${DISTRIB_DESCRIPTION}" ] && echo "${DISTRIB_DESCRIPTION}" > /etc/motd
fi
uname -a >> /etc/motd
echo >> /etc/motd
echo "server : `cat /root/.mdg 2>/dev/null`" >> /etc/motd
echo "ip : `cat /etc/network/interfaces | grep "address" | head -n 1 | cut -f 2 -d " "`" >> /etc/motd
echo "hostname : `hostname`" >> /etc/motd
echo >> /etc/motd
/bin/cp /etc/motd /etc/issue

exit 0

danyel
09/01/2016, 01h30
Salut all,
ayant effacer par erreur le fichier rc.local, qq saurait ou je peux telecharger l'original du fichier pour jessie.
(eventuellement un petit c/c)
Merci pour votre aide.