Email de notification démarrage session root

Bonjour,

J'essaie d'avoir une notification de connexion root par mail avec le script suivant :

echo 'Accès Shell Root le ' `date` `who` | mail -s `hostname` Shell Root de `who | cut -d"(" -f2 | cut -d")" -f1` ***@***

mais malheureusement j'ai toujours un message d'erreur qui me dis : cut : une liste d'octets, de caractères ou de champs doit être indiquée....

Et là je sêche :-)

Quelqu'un voit'il l'erreur dans la ligne de commande ?

2 réponses

  • Votes
  • Date
  • Date décroissante
  1. Contributeur
    Salut,

    Quel système ?
    Quel shell ?

    As-tu la même erreur avec juste :
    echo `hostname` Shell Root de `who | cut -d"(" -f2 | cut -d")" -f1`

    dans un terminal ?
    1. Apres avoir configurer ssmtp je recois bien les mails de notification de connection SSH & ROOT

      mais ho surprise le server m'envoi Egalement des mails du type :

      Cron <root@*******> [ -x /usr/lib/php5/sessio​nclean ] && /usr/lib/php5/sessio​nclean

      MIB search path: /root/.snmp/mibs:/usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf:/usr/share/mibs/site:/usr/share/snmp/mibs:/usr/share/mibs/iana:/usr/share/mibs/ietf:/usr/share/mibs/netsnmp
      Cannot find module (SNMPv2-TC): At line 10 in /usr/share/snmp/mibs/UCD-DLMOD-MIB.txt
      Cannot find module (SNMPv2-SMI): At line 34 in /usr/share/snmp/mibs/UCD-SNMP-MIB.txt
      Cannot find module (SNMPv2-TC): At line 37 in /usr/share/snmp/mibs/UCD-SNMP-MIB.txt
      Did not find 'enterprises' in module #-1 (/usr/share/snmp/mibs/UCD-SNMP-MIB.txt)
      Did not find 'DisplayString' in module #-1 (/usr/share/snmp/mibs/UCD-SNMP-MIB.txt)
      Did not find 'TruthValue' in module #-1 (/usr/share/snmp/mibs/UCD-SNMP-MIB.txt)
      Unlinked OID in UCD-SNMP-MIB: ucdavis ::= { enterprises 2021 }
      Undefined identifier: enterprises near line 39 of /usr/share/snmp/mibs/UCD-SNMP-MIB.txt
      Did not find 'DisplayString' in module #-1 (/usr/share/snmp/mibs/UCD-DLMOD-MIB.txt)
      Did not find 'ucdExperimental' in module UCD-SNMP-MIB (/usr/share/snmp/mibs/UCD-DLMOD-MIB.txt)
      Unlinked OID in UCD-DLMOD-MIB: ucdDlmodMIB ::= { ucdExperimental 14 }
      Undefined identifier: ucdExperimental near line 13 of /usr/share/snmp/mibs/UCD-DLMOD-MIB.txt
      Cannot find module (MTA-MIB): At line 0 in (none)
      Cannot find module (NETWORK-SERVICES-MIB): At line 0 in (none)
      Cannot find module (SNMPv2-TC): At line 15 in /usr/share/snmp/mibs/UCD-DISKIO-MIB.txt
      Did not find 'DisplayString' in module #-1 (/usr/share/snmp/mibs/UCD-DISKIO-MIB.txt)
      Did not find 'ucdExperimental' in module UCD-SNMP-MIB (/usr/share/snmp/mibs/UCD-DISKIO-MIB.txt)
      Unlinked OID in UCD-DISKIO-MIB: ucdDiskIOMIB ::= { ucdExperimental 15 }
      Undefined identifier: ucdExperimental near line 19 of /usr/share/snmp/mibs/UCD-DISKIO-MIB.txt
      Cannot find module (SNMPv2-TC): At line 15 in /usr/share/snmp/mibs/LM-SENSORS-MIB.txt
      Did not find 'DisplayString' in module #-1 (/usr/share/snmp/mibs/LM-SENSORS-MIB.txt)

      !!!!!!!!!!!!!!!!!!!!!