Linux

2-way rsync

I’m working on a project where I need copies of files both at my laptop and at my home dir somewhere else.
I’ve setup an rsync script to do 2-way synchronization between my laptop and the home dir like this:

#!/bin/sh

remote="joar@remote.server.address"
rdir="remote_sync_dir/"
ldir="/home/joar/local_syncdir/"

rsync -e ssh -vaurP $ldir $remote:$rdir
rsync -e ssh -vaurP $remote:$rdir $ldir

Note: to avoid having to type your password for each sync one should setup ssh-keys.

My snd-intel-hda was eating 30% cpu constantly

The alsa module snd-intel-hda was constantly eating up about 30% of my cpu.
Google pointed me in direction of blaming pulseaudio:
linux.debian.bugs.dist
tycheent.wordpress.com

But pulseaudio.org gave me a hint about snd-intel-hda being buggy.

I’m using OpenSuse 11.1 and came over this:
en.opensuse.org
which help you upgrade your alsa base and driver packages to 1.0.21 and problem solved !

There is no such thing as ‘build-essential’ in CentOS

One thing I’ve done for a long time right after installing debian or ubuntu is issuing

# apt-get install build-essential

It’s great because it pulls down the most common stuff needed for ‘everyday’ compiling and meddling with compiling sources and so on.
In CentOS I can’t find any similar package group, but according to centos.org one may achieve pretty much the same with

# install gcc gcc-c++ kernel-devel

Ntp and networkmanager aren’t friends

On my Opensuse box I’ve setup ntp to synchronize time, but because I’m using networkmanager and since Knetworkmanager doesn’t log me on to the network until KDE is up and running, ntp end up not finding any servers during boot and just goes to sleep.
A really easy / lazy fix to the problem is to simply restart the ntp service after logging on to Kde, but then again I need to be root to restart ntp.
I decided giving myself sudo rights with no password to the ntp service and put a script in Kde’s autostart folder.

Setup sudo rights in /etc/sudoers by issuing:

# visudo /etc/sudoers

Add the line:

 [your_username]    ALL = (ALL) NOPASSWD: /etc/init.d/ntp restart

Now your user can run the command:

$ sudo /etc/init.d/ntp restart

which you could but in a script in ~.kde4/Autostart/restart_ntp.sh and the problem is solved 🙂

Note: sudo is quite picky about the command specified. In the line above my user can run the command as specified, but if I try to run for instance

 
$ sudo service ntp restart

which basically is the same command, sudo won’t let me because that’s not the command I specified.

noip2 client init script for opensuse

In opensuse I couldn’t find any noip2 packages in the default repositories (like I’m used to from debian/ubuntu).
I didn’t really search around for any yum repos or rpm’s, but decided I wanted to have a go at the code available at no-ip.com .

Compiling the source was straight forward, but the init script wasn’t really tailored for opensuse, so I wrote my own.
The script is available here for those interested :p