thorko.deLinux / Unix systems administrator

Latest SysadminDB entries


Debian - build a deb package

Install some packages required to build the package

apt-get install dh-make autotools-dev fakeroot devscripts

Download the source and extract it

tar -xzvf httpd-2.4.1.tar.gz && cd httpd-2.4.1
dh_make -n -s -e yourmail@thorko.de

edit debian/control file

fakeroot debian/rules clean
dch -i local 'Your Version'
cp ../httpd-2.4.1.tar.gz ./
sudo debuild -us -uc



Oneliner

Test webserver with telnet

(echo -e "GET / HTTP/1.0\n\n"; sleep 1;) | telnet www.thorko.de 80



CentOS 7 virtual network interfaces

Howto setup a virtual network interface in CentOS 7

To use the old style network interface naming convention you have to append "biosdevname=0 net.ifnames=0" to your kernel line in your grub config.

Create a ifcfg-eth0:0 file under /etc/sysconfig/network-scripts

DEVICE="eth0:0"
IPADDR=192.168.1.12
NETMASK=255.255.255.0
ONPARENT=yes
TYPE=Ethernet

Now start your device with nmcli

nmcli dev connect eth0

To check if your virtual interface is up run "ip a" and check for eth0:0




Systemd - Howto

start, stop, restart service

systemctl <start|stop|restart> rsyslog

list all services

systemctl list-units -t service

disable, enable service - enable service in target (runlevel)

systemctl disable rsyslog

check unit files - like init files in sysv

# in debian
/lib/systemd/system
# in centos
/usr/lib/systemd/system

read logfile of service

journalctl -u ntp

follow logfile

journalctl -u ntp -f

show the last recent loglines

journalctl -xn 20

enable remote logging with systemd

in /etc/systemd/journald.conf enable "ForwardToSyslog=yes"

configure your rsyslog daemon

$ModLoad imudp
$UDPServerAddress 127.0.0.1
$UDPServerRun 514
[..]
$ActionQueueFileName fwdRule1
$ActionQueueMaxDiskSpace 1g
$ActionQueueSaveOnShutdown on
$ActionQueueType LinkedList
$ActionResumeRetryCount -1
*.* @@central-syslog-server.de:514

In /lib/systemd/system/rsyslog.service or /usr/lib/systemd/system/rsyslog.service

[Uint]
Requires=syslog.socket
After=NetworkManager-wait-online.service

Now start your rsyslog service

systemctl restart rsyslog

If it gets into \"failed\" state check if you have selinux enabled




KDE - control applications via dbus

dbus-send is a great way to control KDE applications by script or global shortcut. You can use d-feet to browse the methods the application supports.

Once you found the method run it with

~$ dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 
org.mpris.MediaPlayer2.Player.PlayPause 1>/dev/null

This example sends Play/Pause to the spotify player




(c) 2014 by thorko.de