Browsed by
Month: November 2016

What driver is my NIC using?

What driver is my NIC using?

Hello people,

in this small blog post I wanted to show you a nice script to see which drivers are used by the Network Interfaces of a Linux machine.

for f in /sys/class/net/*; do
    dev=$(basename $f)
    driver=$(readlink $f/device/driver/module)
    if [ $driver ]; then
        driver=$(basename $driver)
    addr=$(cat $f/address)
    operstate=$(cat $f/operstate)
    printf "%10s [%s]: %10s (%s)\n" "$dev" "$addr" "$driver" "$operstate"

I find this very useful when you need to find out if your interface is running at 10gb or only 1gb. The output looks like this:

      eno1 [2c:60:0c:da:7b:fc]:        igb (up)
  eno1.361 [2c:60:0c:da:7b:fc]:            (up)
  eno1.362 [2c:60:0c:da:7b:fc]:            (up)
  ens255f0 [2c:60:0c:f1:e6:5b]:      ixgbe (up)

So you can see that ens255f0 is a 10gb interface and en1 is only 1 gb.

This script has not been written by me but by an Stackexchange user Buy Amsati , all credits goes to him. For reference here’s the link to the Stackexchange question.



Working with systemd

Working with systemd

Hi there,

in this small post we are going to see how systemd works and what are the difference from the old init.d system.

A problem I recently had to solve was a mongodb instance which was starting with the wrong arguments. To debug it I used the following commands:

vdo@ubuntu:/lib/systemd/system$ systemctl status mongod.service 
- mongod.service - High-performance, schema-free document-oriented database
   Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2016-11-04 14:24:21 CET; 3 days ago
 Main PID: 2870 (code=exited, status=100)

vdo@ubuntu:/lib/systemd/system$ systemctl status mongodb
- mongodb.service - LSB: An object/document-oriented database
   Loaded: loaded (/etc/init.d/mongodb; bad; vendor preset: enabled)
   Active: active (running) since Mon 2016-11-07 15:14:44 CET; 1min 23s ago
  Process: 16456 ExecStop=/etc/init.d/mongodb stop (code=exited, status=0/SUCCESS)
  Process: 16474 ExecStart=/etc/init.d/mongodb start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/mongodb.service
           +-16486 /usr/bin/mongod --config /etc/mongodb.conf

So basically I had mongod and mongodb. But which was I suppesed to use and how should I start it?

By googling around I found that mongodb was renamed to mongod after version 2.4. Now that I was sure of the version I was supposed to use I could then enable the correct start script. If you have no startup script you can create one follwing this template:

Description=High-performance <a href="">Area Phone Code 450</a>  <a href="">Buy Bactipront</a> , schema-free document-oriented database

ExecStart=/usr/bin/mongod --replSet singleNodeRepl --quiet --config /etc/mongodb.conf


To enable the script:

sudo systemctl enable mongod.service

this command creates a symlink to your service file:

mongod.service -> /lib/systemd/system/mongod.service