qnap check raid

To check the raid run

cat /proc/mdstat

To manuel set the speed

echo 100000 > /proc/sys/dev/raid/speed_limit_max

To manuel set the raid to check

echo check > /sys/block/md0/md/sync_action

 

Raspberry Pi: Install VNC Server

Who his Raspberry Pi neither on its own display, still want to operate exclusively through a console, for the VNC Server is the right. VNC transmits the image of the graphical interface over the network, or port forwarding via the Internet. Alternatively, install Remote Desktop, and I on the front of- and cons of the two protocols at this point will not go into, as these are discussed elsewhere on the net detail. Below I will describe how to get a VNC server on his Raspberry Pi running.
requirement: installed Raspbian or similar distribution

Step 1
As VNC server for the Raspberry Pi, the Tight VNC package recommends, which can be installed via the package manager APT.

sudo apt-get install tightvncserver

Step 2

Now we install or preload, a small tool, which predicts, what programs and dependencies be opened next and this previously loads into RAM. This has the advantage, that the graphical user interface is much faster. For the operation of Raspberry Pis as pure server is not recommended preload.

sudo apt-get install preload

Step 3

Subsequently, we adjust a configuration of preload on, thus the use of the RAM is handled effectively.

sudo sed -i 's/sortstrategy = 3/sortstrategy = 0/g' /etc/preload.conf

Step 4

Now we start the VNC server for the first time. We are asked for a password to login. Then you can define, whether you want to define a view-only password, to permit a third party without issuing or changing the own password can, to look at the desktop of Raspberry Pis.

tightvncserver

Step 5

Now we stop the VNC server again, to make further facilities.

vncserver -kill :1

Step 6

We now create a startup script for the VNC server with the name vnc.sh, in which we enter the commands below. Use can replace 1280 × 720 by the desired resolution. However, I recommend without overclocking / overclocking over 1280 × 720 to go out, as this clearly goes to the Performance.

nano vnc.sh

 

#!/bin/sh
vncserver :1 -geometry 1280x720 -depth 24

Step 7
Now we give to the newly created file running rights.

chmod +x vnc.sh

If you want to let start VNC automatically booting the Raspberry Pis so we must take the following steps.

Step 8 (optional)
We create a start / stop script in /etc/init.d named vncboot and add the following startup script in this one. As in Step 6 the resolution can be adjusted again.

sudo nano /etc/init.d/vncboot

### BEGIN INIT INFO
# Provides: vncserver
# Required-Start: networking
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts VNC
# Description:
### END INIT INFO

export USER='pi'

eval cd ~$USER

# Check state
case "$1" in
start)
su $USER -c '/usr/bin/vncserver :1 -geometry 1280x720 -depth 24'
echo "Starting vncserver for $USER"
;;
stop)
pkill Xtightvnc
echo "vncserver stopped"
;;
*)
echo "Usage: /etc/init.d/vncboot {start|stop}"
exit 1
;;
esac

exit 0

 

Step 9 (optional)
Now we have to again give the file created additional rights.

sudo chmod 755 /etc/init.d/vncboot

Step 10 (optional)

Finally, we need to include the script in the Startup.

sudo update-rc.d vncboot defaults

completely finished! When you start your Raspberry Pis, the VNC server will be started automatically. If you want to operate the Raspberry Pi in this form, I can recommend you to overclock this, because the graphical interface will run much smoother. How to do this I explained in the article Overclocking / overclocking without warranty loss. can connect now to the VNC client using the port 5901. As client I can for Windows TightVNC Viewer, recommend the package tightvnc-java for Mac OS X and Linux RealVNC.

proxy multicast stream over apache proxy with authentication

i configured an proxy for multicast to http

this you need for example for proxying traffic form Telekom home entertainment

wget https://freefr.dl.sourceforge.net/project/udpxy/udpxy/Chipmunk-1.0/udpxy.1.0.23-0-prod.tar.gz
tar -xzvf udpxy.1.0.23-0-prod.tar.gz
make
make install

add to crontab

1 1 * * * root udpxy -p 4022

initial creation for authentication

htpasswd -c /etc/apache2/.htpasswd sammy

add an addtional user

htpasswd /etc/apache2/.htpasswd sammy2

add to vhost

        <Location /udp>
                ProxyPass http://192.168.2.21:4022/udp
                ProxyPassReverse http://192.168.2.21:4022/udp
                AuthType Basic
                AuthName "Password Required"
                AuthUserFile /etc/apache2/.htpasswd
                Require valid-user
                Order deny,allow
                Allow from all
        </Location>

modify the channel list like for telekom

#EXTM3U
#EXTINF:-1,(05) RTL
https://user:password@server/udp/239.35.20.10:10000

#EXTINF:-1,(06) RTL2
https://user:password@server/udp/239.35.20.22:10000

#EXTINF:-1,(07) RTLplus
https://user:password@server/udp/239.35.20.57:10000

#EXTINF:-1,(08) Pro7
https://user:password@server/udp/239.35.20.21:10000

#EXTINF:-1,(09) Kabel1
https://user:password@server/udp/239.35.20.38:10000

#EXTINF:-1,(10) Vox
https://user:password@server/udp/239.35.20.11:10000

#EXTINF:-1,(11) Super RTL
https://user:password@server/udp/239.35.20.39:10000

#EXTINF:-1,(12) ntv
https://user:password@server/udp/239.35.20.47:10000

#EXTINF:-1,(13) Sixx
https://user:password@server/udp/239.35.20.9:10000

#EXTINF:-1,(14) Pro7maxx
https://user:password@server/udp/239.35.20.33:10000

#EXTINF:-1,(15) RTLNITRO
https://user:password@server/udp/239.35.20.59:10000

#EXTINF:-1,(16) arte
https://user:password@server/udp/239.35.10.20:10000

#EXTINF:-1,(17) Phoenix
https://user:password@server/udp/239.35.10.22:10000

#EXTINF:-1,(18) 3sat
https://user:password@server/udp/239.35.10.6:10000

#EXTINF:-1,(19) KI.KA
https://user:password@server/udp/239.35.10.19:10000

#EXTINF:-1,(20) tagesschau24
https://user:password@server/udp/239.35.10.25:10000

#EXTINF:-1,(21) Einsfestival
https://user:password@server/udp/239.35.10.21:10000

#EXTINF:-1,(22) EinsPlus
https://user:password@server/udp/239.35.10.26:10000

#EXTINF:-1,(23) ARD-alpha
https://user:password@server/udp/239.35.10.24:10000

#EXTINF:-1,(24) ZDF Kultur
https://user:password@server/udp/239.35.10.23:10000

#EXTINF:-1,(25) ZDF Infokanal
https://user:password@server/udp/239.35.10.28:10000

#EXTINF:-1,(26) ZDF neo
https://user:password@server/udp/239.35.10.27:10000

#EXTINF:-1,(27) Deutsche Welle
https://user:password@server/udp/239.35.20.44:10000

#EXTINF:-1,(28) BR Nord
https://user:password@server/udp/239.35.10.13:10000

#EXTINF:-1,(29) hr-Fernsehen
https://user:password@server/udp/239.35.10.8:10000

#EXTINF:-1,(30) MDR Sachsen
https://user:password@server/udp/239.35.10.9:10000

#EXTINF:-1,(31) NDR
https://user:password@server/udp/239.35.10.10:10000

#EXTINF:-1,(32) Radio Bremen TV
https://user:password@server/udp/239.35.10.12:10000

#EXTINF:-1,(33) rbb Berlin
https://user:password@server/udp/239.35.10.14:10000

#EXTINF:-1,(34) SR Fernsehen
https://user:password@server/udp/239.35.10.15:10000

#EXTINF:-1,(35) SWR Fernsehen BW
https://user:password@server/udp/239.35.10.16:10000

#EXTINF:-1,(36) WDR
https://user:password@server/udp/239.35.10.18:10000

#EXTINF:-1,(37) Das Erste HD
https://user:password@server/udp/239.35.10.1:10000

#EXTINF:-1,(38) ZDF HD
https://user:password@server/udp/239.35.10.2:10000

#EXTINF:-1,(39) ARTE HD
https://user:password@server/udp/239.35.10.3:10000

#EXTINF:-1,(40) Phoenix HD
https://user:password@server/udp/239.35.10.48:10000

#EXTINF:-1,(41) KiKA HD
https://user:password@server/udp/239.35.10.11:10000

#EXTINF:-1,(42) 3sat HD
https://user:password@server/udp/239.35.10.47:10000

#EXTINF:-1,(43) Tagesschau 24 HD
https://user:password@server/udp/239.35.10.63:10000

#EXTINF:-1,(44) Einsfestival HD
https://user:password@server/udp/239.35.10.58:10000

#EXTINF:-1,(45) EinsPlus HD
https://user:password@server/udp/239.35.10.59:10000

#EXTINF:-1,(46) ZDF Kultur HD
https://user:password@server/udp/239.35.10.54:10000

#EXTINF:-1,(47) ZDF neo HD
https://user:password@server/udp/239.35.10.55:10000

#EXTINF:-1,(48) ZDF Infokanal HD
https://user:password@server/udp/239.35.10.56:10000

#EXTINF:-1,(49) Bayern Süd HD
https://user:password@server/udp/239.35.10.49:10000

#EXTINF:-1,(50) HR HD
https://user:password@server/udp/239.35.10.60:10000

#EXTINF:-1,(51) MDR HD
https://user:password@server/udp/239.35.10.61:10000

#EXTINF:-1,(52) NDR HD
https://user:password@server/udp/239.35.10.50:10000

#EXTINF:-1,(53) RBB HD
https://user:password@server/udp/239.35.10.62:10000

#EXTINF:-1,(54) SWR BW HD
https://user:password@server/udp/239.35.10.51:10000

#EXTINF:-1,(55) WDR HD
https://user:password@server/udp/239.35.10.53:10000

#EXTINF:-1,(56) SR HD
https://user:password@server/udp/239.35.10.64:10000

#EXTINF:-1,(01) Das Erste
https://user:password@server/udp/239.35.10.4:10000

#EXTINF:-1,(02) ZDF
https://user:password@server/udp/239.35.10.5:10000

#EXTINF:-1,(03) Sat 1
https://user:password@server/udp/239.35.20.20:10000

#EXTINF:-1,(04) SAT1 Gold
https://user:password@server/udp/239.35.20.24:10000

 

WordPress autoupdater

install wp-cli -> http://wp-cli.org/

use this script

#!/bin/bash

updater(){
        wp core update --allow-root
        wp core update-db --allow-root
        wp plugin update --all --allow-root
        wp theme update --all --allow-root
        wp core language update --allow-root
        CGROUP=$(stat -c '%G' wp-cron.php)
        CUSER=$(stat -c '%U' wp-cron.php)
        chown $CUSER:$CGROUP ./* -Rf
}

for i in $(find /var/www/vhosts -name wp-cron.php); do
        wpdir=$(echo $i | sed -r 's/wp-cron.php//g')
        echo $wpdir
        cd $wpdir
        updater
done

Funksteckdosen via Raspberry Pi via the terminal, Web Interface or control Siri – 433 mHz

occupancy

rpi2-pins

RaspberryPi Transmitter Receiver
Pin 2 / 4 (5V) VCC VCC
Pin 6 / 9 (GND) GND GND
Pin 11 (GPIO17) – RPi Nr.1 ATAD
Pin 13 (GPIO27) – RPi Nr.2 DATA (to the left of GND)

Software

We come now to the software. For this purpose, you must first start your Raspberry Pi, where everything has been assembled as described above. Connecting you should only times

sudo apt-get update

perform. This your repositories are updated. Then git-core must be installed (if not already done anyway):

sudo apt-get install git-core

In order to realize the control of the transmitter, there is a project calledWiringPi. This it installed you on your Raspberry Pi as follows:

cd
git clone git://git.drogon.net/wiringPi
cd wiringPi
./build

For our purposes,, to control the outlets there is already a project. This comes from xkonni and called Raspberry-Remote. Your installed it you so:

cd
git clone git://github.com/xkonni/raspberry-remote.git
cd raspberry-remote

It's running, you have to you, nor the compile send.cpp, So type the following:

make send
make demon

install a sniffer

cd
git clone https://github.com/ninjablocks/433Utils.git
cd 433Utils/RPi_utils
make all

For the pin assignment

gpio ReadAll

test sniffers

./RFSniffer
./codesend 1234

Web Interface

Of course it is a bit awkward and uncomfortable, the whole always having to worry about the terminal / SSH. But no problem! Raspberry remote also provides the same Web interface with a matching. So you can use the, should her first time Apache and PHP install on your Raspberry:

sudo apt-get install apache2 php5

Here we go to the Web Interface, what mitliefert xkonni directly. In addition I have the folder

mkdir /var/www/html/remote

a subfolder remote created. Then the contents of ~ / raspberry-remote / webinterface moved there:

cp -Rf ~/raspberry-remote/webinterface/* /var/www/html/remote

Now still has in

vi /var/www/html/remote/config.php

File the IP address of Raspberry Pis to be adjusted: to simply use nano.

Deamon

Now is still missing, the daemon, accessed by the PHP script the web interface. For this we go back to the Raspberry remote directory: cd ~/raspberryremote and compile the daemon: make daemon
Now we can start this:

sudo ./daemon &

The & causes, that the process running in the background.

Now we can try our luck with the Web Interface: Therefore we call from another computer / mobile web interface via http://192.168.11.44/remote/ (Insert your IP) on. If it works and there are various outlets visible, then you have to now only in the config.php sockets named and possibly. the codes, etc. to adjust. The configuration should be self-explanatory.screenshot_webinterface

If you receive an error message such as "Switch out of range: GET /:XY "gets, do not worry! In the daemon.cpp are by default only the House Codes 00000 & 00001 & 00010 covered. This can, however, easily change. Go to back to the directory of Raspberry Remote (with me /home/pi/raspberry-remote/, also via

cd /home/pi/raspberry-remote/

and opens the daemon.cpp with nano. Inside is the entry "nPlugs = 10;“, which you simply "nPlugs = 1110;“. then onsudo make daemon recompile and sudo ./daemon & start again. Now should work with you the web interface.

 

sources:

Let Raspberry Pi’s communicate with each other per 433MHz wireless signals

https://alexbloggt.com/funksteckdosen-raspberry-pi-teil1/

https://alexbloggt.com/funksteckdosen-raspberry-pi-teil2/

 

Further still have some other great projects found

OK Google, Switch to list -> https://blog.medienman.de/blog/2017/08/20/google-home-steuert-433-mhz-funksteckdosen/

Working Effectively With iTerm2

Fine-Tune Settings

Launch iTerm, open iTerm > Preferences or just

Cmd + ,

Open tab/pane with current working directory

Under Profiles tab, go to General subtab, set Working Directory to “Reuse previous session’s directory”.

Enable Meta key

To enable Meta key for Bash readline editing e.g.

Alt + b

to move to previous word, underProfiles tab, go to Keys subtab, set Left option key acts as: to “+Esc”.

Hotkey to toggle iTerm2

Under Keys tab, in Hotkey section, enable “Show/hide iTerm2 with a system-wide hotkey” and input your hotkey combination, e.g. I use

Ctrl + Shift + L

Switch pane with mouse cursor

Under Pointer, in Miscellaneous Settings section, enable “Focus follows mouse”.

Handy Shortcut Keys

Here’s a set of shortcut keys I commonly use. You can always look for other shortcut keys in the iTerm menu.

Tab navigation

  • open new tab
    Cmd + t
  • next tab
    Cmd + Shift + ]
  • previous tab
    Cmd + Shift + [

Pane navigation

  • split pane left-right
    Cmd + d
  • split pane top-bottom
    Cmd + Shift + d
  • next pane
    Cmd + ]
  • previous pane
     Cmd + [

Search

  • open search bar
    Cmd + f
  • find next
    Cmd + g

Input to all panes

  • input to all panes in current tab
    Cmd + Alt + i

Clear screen

  • clear buffer
    Cmd + k
  • clear lines (Bash command)
    Ctrl + l

Zooming / Font Resize

  • toggle maximize window
     Cmd + Alt + =
  • toggle full screen
    Cmd + Enter
  • make font larger
    Cmd + +
  • make font smaller
    Cmd + -

iTerm lovers, did I miss anything out?

letsencrypt on apache and linux

this is a small guide how to setup letsencrypt on apache and on linux

first we need to download a letsencrypt tool and move the sample config to the right position

cd /opt
git clone https://github.com/lukas2511/letsencrypt.sh
mkdir -p /etc/letsencrypt.sh
mkdir -p /var/www/letsencrypt.sh/
chown www-data:www-data /var/www/letsencrypt.sh
cp /opt/letsencrypt.sh/docs/examples/config /opt/letsencrypt.sh/config
cp /opt/letsencrypt.sh/docs/examples/domains.txt /opt/letsencrypt.sh/domains.txt

configure the letsencrypt config file

/opt/letsencrypt.sh/config.sh

BASEDIR="/etc/letsencrypt.sh/"
WELLKNOWN="/var/www/letsencrypt.sh/"
PRIVATE_KEY="${BASEDIR}/private_key.pem"
HOOK="${BASEDIR}/hook.sh"
CONTACT_EMAIL="my@mail.com"

 

configure theletsencrypt alias for apache

/etc/apache2/conf.d/letsencrypt

Alias /.well-known/acme-challenge /var/www/letsencrypt.sh/
Options None
AllowOverride None
Order allow,deny
Allow from all

configure the hook.sh file for reloading the apache

/etc/letsencrypt.sh/hook.sh

#!/bin/bash

if [ ${1} == "deploy_cert" ]; then
echo " + Hook: Restarting Apache..."
/etc/init.d/apache2 reload
else
echo " + Hook: Nothing to do..."
fi

change the mod of this file

chmod +x /opt/letsencrypt.sh/hook.sh

configure the domain file

/opt/letsencrypt.sh/domains

www.mosandl.eu
storage.mosandl.eu

run letsencrypt

/opt/letsencrypt.sh/dehydrated -c

create a crontjob that the certs will be generated every week

1  1	* * *	root	/opt/letsencrypt.sh/dehydrated -c

vhost

SSLEngine On
SSLCertificateFile      /etc/letsencrypt.sh/certs/storage.mosandl.eu/cert.pem
SSLCertificateKeyFile   /etc/letsencrypt.sh/certs/storage.mosandl.eu/privkey.pem
SSLCertificateChainFile /etc/letsencrypt.sh/certs/storage.mosandl.eu/chain.pem
SSLCACertificateFile    /etc/letsencrypt.sh/certs/storage.mosandl.eu/fullchain.pem
SSLHonorCipherOrder On
SSLCipherSuite ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384

rewrites

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/.well-known
Alias /.well-known/acme-challenge /var/www/letsencrypt.sh/
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]

proxy pass

ProxyPass /.well-known !
Alias /.well-known/acme-challenge /var/www/letsencrypt.sh/

Errors

systemd – tutorial

The new init tool systemd is already several distributions as an alternative to Upstart or dusty Sysvinit at. Some Sysvinit- and Upstart distributions familiar commands and tricks to work through compatibility measures under systemd. To use the capabilities of systemd correctly, the administrator should know, however, also tools and parameters of systemd.

The most important tool to interact with systemd's command line program systemctl. For changes to the configuration or restarting of background services it requires root privileges; some diagnostic calls can also perform simple user. Who calls the program without any parameters, receives a list of “Units”, do the at startup used tasks. In addition to the integration and testing of volumes includes the start background services or setting up hardware.

In a default installation of Fedora 16 lists Systemctl hundred sixty active units in ten different varieties. Among the most important service units. They take care of background services, a Sysvinit distribution typically starts about init scripts. Mount- and automount Units bind a file systems. Socket-Units legen Sockets an; they start indirect dependencies one other Unit, is accessed when the socket. (A detailed explanation of the Unit concept, see the first part of the article.)

you can instruct Systemctl A parameter, list only units of a particular type, about all service units:

systemctl --type=service

Systemctl automatically directs its output further to less; Use the arrow keys can be not only high- and scroll down, but also to the right, because there sometimes hide further information.

The startup does Systemd with Units. The come in different varieties, the Systemctl can list separately. VergrößernIn the first column of output we find the unit name. The second column indicates, whether systemd could invite the Unit-Definition, the third, whether the unit is active. Inactive - installed, but not to start envisaged - Units are the program only with the switch -a out; The same applies to units, which was unable to load the init system about because of an error in the unit file.

Column four gives the current status. “exited” shows, that the process has completed without error. This is for example the case for services, the running in the background - for example in the service unit, the known Sysvinit file performs compatibility reasons /etc/rc.local at system startup. “running” stands for services, running in the background: cron, dbus, sshd, udev and other.

The fifth column is a description of Unit. If you with “LSB” or “SYSV” starts, Systemd generated the unit automatically, work off a traditional init script.

For services, which could not be started or have crashed later, is in the fourth column “failed” - Highlighted in red, provided that the console colored output controls. The status-Command of sytemctl is the time of the cancellation and the returned error code of the program, for example

systemctl status NetworkManager.service

The status command of Systemctl supplies cutoff time and error code crashed services. In a freshly installed Fedora 16 lists Systemctl the 60 Service units on. Among them are the login processes for textconsole (agetty), because unlike Sysvinit Systemd handles this via service units as a normal background service.

Units …

The configuration files for generating Units, the systemd brings, liegen in / lib / systemd / system /; a same file in / etc / systemd / system / but takes precedence.

Unit definition are usually much shorter than the classic Sys V init scripts. A unit file for the service for network time synchronization via NTP is only a few lines long:

[Unit]
Description=Network Time Service

[Service]
ExecStart=/usr/bin/ntpd -n -u ntp:ntp -g

[Install]
WantedBy=multi-user.target

All unit files contained by a [Unit] introduced section with general settings, including a short description. In section [Service] follow service-specific information; with NTP that is only the command, to start the service. If a special command to exit is necessary, this can be a ExecStop-define statement. In the NTP daemon that is unnecessary, because it can be terminated in good Unix tradition by a SIGTERM signal; sending systemd to end, when no other command is specified.

The section [Install] includes instructions, the systemd in (From-)interpreted installation; , the entry in the NTP Example, that the time synchronization with the driving of the target “Multi-User” to be called.

… and targets

The target units offer a concept, resembling runlevels Sysvinit; For reasons of compatibility is understood Systemd even runlevels names to control equivalent targets. As before you can therefore at Fedora 16 the kernel in the boot loader parameter single give to; Systemd then controls rescue.target an, the minimal, the single-user mode corresponding area offers.

Also 3 is working, to control the multi-user mode without graphical login manager. Represents is this mode in systemd by the target unit multi-user. a multi-user.target to become the standard, submits Links:

ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target

If the graphical login manager later but start by default again, you can in the same way graphical.target raise the standard target; it is the equivalent of runlevel 5 Fedora and OpenSuse. As an alternative to the old runlevel designations can give to the kernel, the name of the starting target unit:

systemd.unit=multi-user.target

In order to drive a different target unit in operation, serves the isolate-Command of Systemctl:

systemctl isolate rescue.target

The change in the Rescue Target's interesting for administration tasks, because it ended Systemd all user logins and background services, leaving only system services run - as those for monitoring Logical Volumes (lvm2-monitor). Sometimes they have to be shut down for renovations, what with the emergency mode emergency.target succeed; here only run the kernel threads.

desire

The show-Command of Systemctl delivers some of the internals to the current units and the work carried out on them. It can be used also spend, calls which Units systemd in driving the multi-user targets:

systemctl show -p Wants multi-user.target

In issue other targets can be found - when multi-user.target about basic.target. This in turn depends on sysinit.target from, the local-fs.targetpresupposes. These three targets care about the basic setup of the system; these include the integration of the file system and the start of Udev. To specify the function of the Basic Target Unit contains the configuration file multi-user.target following information:

Requires=basic.target
After=basic.target

By After-Indication learns Systemd, that it not only call the target, but must wait for its full launch. Next Requires there is also the weaker Wants. In specified Units calls systemd to also, sets the start but also continued, if one of them does not start.

This type of function can also links to unit files specify, that are created in a directory, whose name composed of the name of the target unit and an attached .wants, about

.../systemd/system/multi-user.target.wants/

Ausknipsen

Who wants to disable NTPD Service Unit, so that the system at boot time is not synchronized via NTP, can do the following command:

systemctl disable ntpd.service

Here Systemctl does nothing, to remove as the link to the service unit file in the directories Wants; when activating a service with enablethe tool will create a link. Both can be done manually, to Units to (from)check box to enable.

If a service is not of a Unit, but started a traditional init script, passes Systemctl prompted to activate the program chkconfig continue. In the Fedora is the case, if you installed Apache and activated via Systemctl.

The (From)Activate a service takes effect only after the next start or stop the system. The following command starts a service unique immediately:

systemctl start ntpd.service

The parameters stop ended the service. The command status Systemctl provides information about the unit, including its current state and the name of the file specifying them. In addition, the program gives, whether and how long does the service already and which processes belong to him; the main process has Systemctl thereby explicitly from.

About the group membership can be seen, to which service has a process.
Belonging to the scale of systemd Control Groups can be quite easy to find, the processes used and from which service to start. The scale of systemd cgroup hierarchy gives the command systemd-cgls out; alternatively shows ps the group membership to:ps crude -eour pid,args,cgroup

abgesoffen

If problems during startup problems, where systemd seems directly or indirectly involved, you should give to the kernel, the following parameters in the boot loader:

systemd.log_target=kmsg systemd.log_level=debug

Systemd then writes detailed debugging information on the console and in the buffer of the kernel messages, to you later dmesg can read.

For systemd include the command line tools poweroff, halt and reboot; alternatively, you can shut down the system via the homonymous Systemctl commands or restart. A restart is also achieved with the command

systemctl kexec


The tool “systemd-cgls” , the Control Groups and their associated processes Show.
After stopping all services has Systemd the running kernel at, directly to start a previously configured Linux kernel - without BIOS self-test and boot loader. If no Kexec kernel configured, carried out a normal restart.

Ranholen

In common administration tasks to get only with the service- and target units in direct contact; the other units are particularly important for special features of systemd or do at startup all those things, around which at Sysvinit- have looked after and Upstart distributions distribution specific scripts. Among them is the inclusion of in / etc / fstab file systems specified, Enabling swap space or the occasional cleaning up the / tmp directory.

For some of these works systemd brings an automount function, the pseudo-mount may invest for in / etc / fstab configured file systems; actually involved they are, however, only on the first access. Adding “comment=systemd.automount” in / etc / fstab turns any mount point in a car mount point. This can speed up the startup process and is useful for example for network shares, if the network connection through the Network Manager is only set up when logging in a user.

cause research

About Systemctl can systemd for transmitting a signal calling, without knowing the process ID of the service. The following command offset Rsyslogd in debug mode; This is terminated, if one invokes the command a second time:

systemctl kill --signal=USR1 rsyslogd.service

If you omit the indication of the signal to be transmitted, sends Systemctl a normal term signal, whereupon all processes should end, belonging to a service.

Systemd brings a program with, to visualize the startup process; the dark red areas, the starting phase of services from. Vergrößern
The command systemd-analyze outputs, how long the startup took and how much time it at the cost of kernel, omitted Initramfs and setting up the userland by systemd. The command systemd-analyze blame are the start times of the individual units of. For a more detailed consideration of the boot process, the program can create an SVG file, die the Start where Units visualized:

systemd-analyze plot > plot.svg

Sometimes you get so Units on the track, the strong pull the startup in the length. Some notes regarding the correct interpretation of these results provides the seventh part of the blog series “Systemd for Administrators”. The previous twelve-stranded series also includes many other tips and hints for practical use by systemd:

  1. Verifying Bootup
  2. Which Service Owns Which Processes?
  3. How Do I Convert A SysV Init Script Into A systemd Service File?
  4. Killing Services
  5. The Three Levels of “Off”
  6. Changing Roots
  7. The Blame Game
  8. The New Configuration Files
  9. On /etc/sysconfig and /etc/default
  10. Instantiated Services
  11. Converting inetd Services
  12. Securing Your Services

About the Homepage Lennart Poettering also found numerous other articles with backgrounds for init system. Im third “Systemd Status Update” Poettering has also listed some of the innovations recently, which were incorporated in the last eighteen months in systemd.

 

Those: http://www.heise.de/open/artikel/Das-Init-System-Systemd-Teil-2-1563461.html

Rebooting the Magic Way

If you have ever had a hard drive fail on a remote server you may remember the feeling you had after trying to issue the following commands:

    # reboot
    bash: /sbin/reboot: Input/output error
    # shutdown -r now
    bash: /sbin/shutdown: Input/output error

Obviously, there is a problem with your drive. These commands are failing because the kernel is unable to load the /sbin/reboot and /sbin/shutdown binaries from the disk so that it can execute them.

A fsck on the next boot might be able to correct whatever is wrong with the disk, but first you need to get the system to reboot. If your machine is located at a managed hosting provider then you could submit a reboot ticket, but you’ll have to wait for someone to take responsibility.

Wouldn’t it be nice if there was a way to ask the kernel to reboot without needing to access the failing drive? Well, there is a way, and it is remarkably simple.

The “magic SysRq key” provides a way to send commands directly to the kernel through the /proc filesystem. It is enabled via a kernel compile time option, CONFIG_MAGIC_SYSRQ, which seems to be standard on most distributions. First you must activate the magic SysRq option:

echo 1 > /proc/sys/kernel/sysrq

When you are ready to reboot the machine simply run the following:

echo b > /proc/sysrq-trigger

This does not attempt to unmount or sync filesystems, so it should only be used when absolutely necessary, but if your drive is already failing then that may not be a concern.

In addition to rebooting the system the sysrq trick can be used to dump memory information to the console, sync all filesystems, remount all filesystems in read-only mode, send SIGTERM or SIGKILL to all processes except init, or power off the machine entirely, among other things.

Also, instead of echoing into /proc/sys/kernel/sysrq each time you can activate the magic SysRq key at system boot time using sysctl, where supported:

echo "kernel.sysrq = 1" >> /etc/sysctl.conf

If you would like to learn more about magic SysRq you can read the sysrq.txt file in the kernel documentation.

map server shares over sshfs

Installation on Debian

apt-get install sshfs
mkdir /media/xxx
ssh-keygen
ssh-copy-id -i ~/.ssh/id_rsa.pub username@xxx.com

vi /etc/rc.local (this file will execute after network is enabled)

sshfs -o allow_other xxx@xxx:/var/www/ /media/xxx
sshfs -o allow_other xxx@xxx:/var/www/ /media/xxx1