Excited for Drupalcamp Romania in Timisoara

I am excited for the upcoming Drupalcamp in Timisoara, Romania. My team and I are going to showcase some of the newest Drupal modules we developed for our latest project, Urbo – a business directory focused on Romania.

Part of the project is our new login system, called OpenForis. It will allows users to keep a single identity across our growing network of sites. We are also leveraging OpenLayers to give us the best of OpenStreetMaps, Bing, Yahoo and Google Maps. Urbo is currently in beta as we are tweaking the last few details for an official launch. We are hoping to post some Drupal training videos about these modules on our Drupal training videos page soon.

  • Share/Bookmark

Find the largest image file within a directory structure (e.g. largest jpeg on disc)

For our latest project, Urbo.ro, I needed to find the largest image file (.jpg) in a big directory structure with 50,000+ images but also other files in it. Manually searching it would have been impossible. I turned to our Linux ninja, Alexandru Ionica, who came up with the following that I wanted to share:

find /directory/ -iname "*.extension" -printf "%s " -print | sort -n -r | head -n1

This Linux snippet give you the largest file that ends with .extension inside of whichever directory structure you specify. To search the whole file system, just specify /.

  • Share/Bookmark

‘Shutdown’ versus ‘poweroff’ versus ‘halt’ on Ubuntu server

There seems to be a lot of confusion around how to properly restart or shut down your server under Ubuntu. The are several commands out there: halt, shutdown, poweroff and reboot. Which are the right ones to use and what are the differences?

Historically, halt, poweroff and reboot were fairly low-level commands that would do exactly what their command name implies. However, they would not gracefully take down your server – it was presumed that the server administrator would do that him- or herself before invoking these commands. Many newer Linux users were not familiar with the right usage scenarios and, as a result, the commands were changed to invoke shutdown, a gentler command that gracefully terminates any open processes by giving them an opportunity to complete tasks before exiting.

Since these commands now invoke shutdown, the following are equivalent:

Restarting your server
reboot is the same as
shutdown -r 0

Turning off your server
halt is the same as
poweroff is the same as
shutdown -P 0

Note that these commands need to be invoked as root or via the sudo command, e.g.
sudo halt.

The original usage of these commands is also available via the -f switch. So to invoke halt directly without going through shutdown, use sudo halt -f. This is not recommended unless you are sure all other processes have finished their work. Similarly, sudo shutdown 0 by itself is not very useful – in Ubuntu it drops the server into the Recovery Menu since all processes are terminated but the server is not asked to power down or restart. It can certainly be manually powered down or restarted from there, though. Also, instead of the 0 after shutdown you can use now or specify some other time (either in minutes from now or absolute time) for the server to shut down.

  • Share/Bookmark