Timeout on a script or program in Linux is easy! Did you ever have the need to kill a process if it takes too long to run for any reason? Then this post will show you how you do just that.
This could be used to prevent a cronjob for running too long or prevent cronjobs from overlapping if a lock-file is not the optimal solution in your case. It could also be used in a case where a process freezes for unknown reasons, and you need to force a restart of it based on a how long it has been running for.
This is not just useful for cronjobs, it can set a timeout on any process, script or program you run!
You may have experienced it before, you create a cronjob to change some data every X hour or minutes and one day this job takes longer than it usually does and cron spawns another job before the first one is finished.
This can result in data corruption or deletion of data that should not have been deleted, all depending on what the cronjob is set up to do
To prevent bad things from happening, a good rule of thumb is to always use a lockfile
A lockfile is a small file, it virtually takes up no space, at least so little you won’t care (The actual size depends on your filesystem). Sometimes it contains a PID, sometimes a timestamp or just plain empty. Depending on how the lockfile is managed Continue reading →
We only use HP servers and we get more and more every week. Someone has to keep track of all those servers and be able to configure them using iLO in case of a disaster
Installation almost runs automatically, except for iLO configuration.
I have to first find the iLO ip, then login to the web interface, create users, set static IP and what not. It takes time, a lot of it.
If only there was some way to automate it without having to use HP’s software.. but wait, THERE IS!
I already posted how to scan for all HP ILO devices in your subnet, but the basics in the following post on how to configure iLO from your guest Linux OS might make everything a little easier for the sysadmins out there
How to configure HP iLO in Linux
First I will show you the useful commands and an example output for each, and then how to automate the configuration of your HP iLO interface using bash scripting
The script for configuring iLO automatically will be included at the end of this post
OpenIPMI OpenIPMI-libs OpenIPMI-tools
These packages can be installed through your favorite package manager, below you’ll see the defaults in Debian and CentOS/RHEL
Are you like me, who want to listen to music while you work? But then your boss comes over and you quickly have to pause it? Or maybe you just want some key bindings on your linux workstation to make life a lot easier, then look no further! xbindkeys is the solution, and I will show you how in this post! it’s really easy to configure and extremely helpful.
In my example, I will use it to pause/unpause my music when i press CTRL+space no matter what desktop I’m on and even if I’m not in the terminal where MOC (the music player I use) is running.
What you need
xbindkeys is the name of the only package you need for this. It should be in the official repository for your distro. Install examples below:
I needed to make a bash script for work that got the ip address of all new leases in the dhcp server, but only the new ones.
I spend some time looking for something useful, and therefore I decided to write a short post here to help others since i had a hard time finding it (maybe my google-fu is not as good as it should be)
The script had to do the following:
1. Get all new lines from a log file since last run
2. Get the ip addresses of the new leases
3. Do some stuff with the new ip addresses. This will not be part of this post
4. Run every minute in cron. This will also not be part of this post
In this post I will only cover how i did 1 and 2. Continue reading →
With CentOS 7 just released, I thought it would be a great time to make a CentOS 7 64Bit server installation step-by-step guide, with pictures and everything just like the old CentOS 6.5 64Bit server installation guide.
Requirements for installing a CentOS 7 64Bit server
This might be basics for some, but it’s a good thing to have bookmarked for the day you might need it. It helped me a lot.
Why can I only use 2 TB (TeraByte) of my 2+ TB drive in linux?
The answer is really simple. I guess you formatted the drive using “fdisk” which use a ms-dos partition table.
MS-dos partition table (MBR) is 32 bit, and thereby it can’t handle anything above 2 TeraBytes
How to create a partition above 2TB in linux
To fully use your 2+TB harddrive, you have to use a partition table that supports it. We now know that the MS-DOS partition table (MBR) does not, so what should you use instead? GPT.
GPT supports up to 9.4 ZB (ZetaByte). That’s 9895604649984 GB (GigaByte)!. It’s pretty safe to say, that you will not hit this limit in the near future. Continue reading →
By default, HP’s ILO interfaces are set to DHCP.
Yes you could go into your router to see which DHCP lease it got, but here is a much more easy solution that you can use anywhere, even though you don’t have access to the router/DHCP server.
You don’t need much. What you need on your Linux computer for this to work is:
sudo (You only need this if you are not logged in as root)
Why would you want to install a package from testing when running on stable?
The reason is simple. Sometimes you just need a later version of a package than is in the Debian Stable repository. You could of course compile it from source, but this was not good enough for me since if you compile it from source, you have to keep it updated manually, and i’m sure i will forget to.
I wanted to do it through apt like the normal packages, But at the same time still keep running on Debian stable but having the option to install a later version of a package.
In this post, i will show you how you can make that possible, and it’s really easy! Continue reading →
If someone would like to take pictures and screenshots of the process for me that I can put into the guide, that would be great. Since I do not have a running Windows computer at the moment I can’t make them myself. (post a comment and I will contact you). This line will be removed once I have the pictures i need.
Some guys a reddit.com requested that I made a quick guide on how to flash a LSI Megaraid M1015 SAS/SATA controller for pass-through firmware.
This guide will be on how to flash it for pass-through OR raid functions, since it’s the same method but with two different files.
I will supply you with the files needed as well.
What you need to flash the Megaraid M1015
You will need the following:
A Windows XP/vista/7 computer (I have only tested on Windows 7)
Package containing the firmware and tools for flashing, you can download it here
A USB stick (I Think 256MB is more than enough), it should not contain any data, since we need to format it!
This program (hp flashing utility, easy way to make bootable usb DOS usb stick)