Search for text in files on Linux

Searching for a certain text in mulitple files? Just run:

grep -lir "word" *

And you’re all set. It will return you the name of the files containing “word” in the current folders and subfolders.
E.g.:

~/projects/xap $ grep -lir "header" *
hub.c

If you then need the lines that contain the search term, just omit the ‘l’:

~/projects/xap $ grep -ir "header" *
hub.c:  // Set xap-header.instance name for heartbeat
hub.c:  // If ordinary header then pass to all known listeners

Continue reading Search for text in files on Linux

Recovering from a RAID ‘Degraded Array’ event

OK, so you have that nice and shiny server up and running with a RAID array, and all of a sudden you start getting ‘Degraded Array’ messages…

Assuming the error is not hardware-related (i.e. one drive of the array that is failing) you can easily recover from this message.

Continue reading Recovering from a RAID ‘Degraded Array’ event

Tracing a signal in ModelSim

To log a specific signal in a ModelSim simulation, make  a script like this:

view list
add list -hex /tb_name/dut/signalname
configure list -usestrobe 1
configure list -strobestart {<time> ns} -strobeperiod {<period> ns}
configure list -usesignaltrigger 0
configure list -delta none
configure list -usegating 1
configure list -gateexpr { /tb_name/dut/rst_n=='1' }
write list -window .list <output_filename .log>


Continue reading Tracing a signal in ModelSim

Adding MGE UPS support to SME server

MGE UPS support

Enable the monitor service

  • config set nut service status enabled
  • config setprop nut Model mge-shut
  • config setprop nut Device /dev/ttyS0
  • signal-event post-upgrade
  • /etc/init.d/ups start

Verify if the UPS was detected

  • upsc ups@localhost | grep mfr

should show something like

ups.mfr: MGE UPS SYSTEMS

Continue reading Adding MGE UPS support to SME server

Adding the smartd service to SME server

It is interesting to monitor the hard drives of your Linux server for possible problems.

The smartd package allows you to monitor the SMART parameters of any drive attached to your system. In case things are going wrong, smartd will warn you by email and chances are that you will be able to gracefully shut down the system.

Enabling the smartd service on SME Server (tested on 7.0pre3) is easy, since the package is already installed by default.

You only need to configure it, and to add it to the list of known services.

Continue reading Adding the smartd service to SME server

Creating gerber output files from Eagle PCB

A short description on creating gerber files from Eagle PCB  for the processing of your PCB.

1. Design the PCB, obviously… Run both ERC and DRC with parameters as defined by your manufacturer.

2. Create the drill rack using ‘File’ -> ‘run’ -> ‘drillcfg.ulp’. Select ‘mm’ for the dimensions and click OK.

3. Create the Excellon drill data files. Open the ‘CAM processor’
window and select the Excellon job. Click the ‘process job’ button.

4. Open the ‘gerb274X.cam’ job in the ‘CAM processor’. Verify that the
correct layers are selected for output. The ‘mirror’
option should be deselected on all layers! Click ‘process job’.

5. Verify the generated files using a gerber file viewer, e.g. gc-prevue or gerbv. The output formats are

*.drl = drill list, import this first in gc-prevue (file type will be unrecognised, select ‘drill rack’)
*.drd = drill data, location of the drill holes
*.cmp = component side metal
*.sol = solder side metal
*.stc = mask stop for component side
*.sts = mask stop for solder side
*.plc = silkscreen for component side.

That’s it.
Continue reading Creating gerber output files from Eagle PCB