1
0
mirror of https://github.com/mbirth/wiki.git synced 2024-12-25 23:04:06 +00:00

Added various pages.

This commit is contained in:
Markus Birth 2015-03-29 21:32:35 +02:00
parent 8c54b83913
commit a0eaf2d41f
9 changed files with 364 additions and 0 deletions

View File

@ -0,0 +1,124 @@
---
title: event.d/init.d script
layout: default
created: 2008-07-15 23:49:48 +0200
updated: 2008-07-15 23:49:48 +0200
toc: false
tags:
- know-how
- software
- linux
- system
- initd
- boot
---
event.d script
==============
This is an event.d-script for the new Ubuntu [Upstart](http://upstart.ubuntu.com/).
The event gets started/respawned on runlevels 2-5. If you change to level 0, 1 or 6, the process gets stopped/killed.
Manual start/stop works through the same commands ˋstartˋ and ˋstopˋ. With ˋstatusˋ you can check the status.
{{{
# manages Solr search engine
start on runlevel [2345]
stop on runlevel [016]
kill timeout 30
respawn
script
cd /home/sysadmin/extension/ezfind/java
exec /usr/bin/java -jar start.jar
end script
}}}
init.d script
=============
This does the same using the traditional init.d-way.
After creation of the script in ˋ/etc/init.dˋ you also have to make the symlinks in the ˋrc.2ˋ..ˋrc.5ˋ-directories.
{% highlight bash %}
#!/bin/sh
### BEGIN INIT INFO
# Provides: solr
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start Solr daemon
### END INIT INFO
# Defaults
RUN_MODE="daemons"
JAVA=/usr/bin/java
DAEMONDIR=/home/sysadmin/extension/ezfind/java
DAEMON=start.jar
PIDDIR=/var/run
SOLRPID=$PIDDIR/solr.pid
# See if the daemon is there
test -x $JAVA -a -x $DAEMONDIR/$DAEMON || exit 0
. /lib/lsb/init-functions
case "$1" in
start)
log_daemon_msg "Starting Solr daemon"
log_progress_msg "solr"
# Make sure we have our PIDDIR, even if it's on a tmpfs
install -o root -g root -m 755 -d $PIDDIR
if ! start-stop-daemon --start --chdir $DAEMONDIR --quiet --pidfile $SOLRPID --make-pidfile --background --exec $JAVA -- -jar $DAEMON; then
log_end_msg 1
exit 1
fi
log_end_msg 0
;;
stop)
log_daemon_msg "Stopping Solr daemon"
log_progress_msg "solr"
start-stop-daemon --stop --quiet --pidfile $SOLRPID
# Wait a little and remove stale PID file
sleep 1
if [ -f $SOLRPID ] && ! ps h `cat $SOLRPID` > /dev/null
then
# Stale PID file (solr was succesfully stopped),
# remove it
rm -f $SOLRPID
fi
log_end_msg 0
;;
restart|force-reload)
$0 stop
sleep 1
$0 start
;;
status)
pidofproc -p $SOLRPID $JAVA >/dev/null
status=$?
if [ $status -eq 0 ]; then
log_success_msg "SOLR is running"
else
log_failure_msg "SOLR is not running"
fi
exit $status
;;
*)
echo "Usage: /etc/init.d/solr {start|stop|restart|force-reload|status}"
exit 1
;;
esac
exit 0
{% endhighlight %}

View File

@ -0,0 +1,22 @@
---
title: Partition Numbering
layout: default
created: 2008-08-07 22:13:23 +0200
updated: 2008-08-07 22:13:23 +0200
toc: false
tags:
- know-how
- software
- linux
- hdd
- partitioning
---
After removal of the first primary partition, you might notice, that the names of the remaining partitions didn't
change. ˋ/dev/sda2ˋ stays ˋ/dev/sda2ˋ. To renumber the partition, use ˋfdiskˋ and create a new primary partition no. 1
which is located behind ˋsda2ˋ. You might want to delete your swap partition, create a new one in partition slot no. 1.
Now enter the expert menu of fdisk and type <kbd>f</kbd> to fix the partition table. The partitions will be renumbered
according to their position on disk. After that delete the temporary partition and re-create your swap. Don't forget to
write the new partition table to disk.
Afterwards, update your ˋ/boot/grub/menu.lstˋ, maybe ˋ/etc/fstabˋ and do a ˋgrub-installˋ.

View File

@ -0,0 +1,17 @@
---
title: MC Startup Delay
layout: default
created: 2008-08-13 22:36:06 +0200
updated: 2008-08-13 22:36:06 +0200
toc: false
tags:
- know-how
- software
- linux
- mc
---
If Midnight Commander needs several seconds to startup, check the ˋinterfacesˋ line in your ˋsmb.confˋ. According to [this page](http://osdir.com/ml/gnome.apps.mc.general/2006-09/msg00057.html),
the built-in Samba code of *mc* is outdated and doesn't recognize device names like ˋeth0ˋ or ˋloˋ as the newer
*smbclient* does. So it tries to resolve those into IPs which takes ages until they time out.
Replace the devices by their respective netmasks (e.g. ˋ192.168.1.0/24ˋ) and *mc* will startup instantly.

View File

@ -0,0 +1,65 @@
---
title: Wake-on-LAN
layout: default
created: 2008-08-13 22:18:28 +0200
updated: 2008-08-13 22:18:28 +0200
toc: false
tags:
- know-how
- software
- linux
- networking
---
Preparing to go asleep
======================
To make Linux not shut down the network interface upon *halt*, edit the file ˋ/etc/init.d/haltˋ, find the line with the
ˋhaltˋ command and remove the parameter ˋ-iˋ if there. This parameter does ˋifdownˋ on all networking interfaces. As the
manpage for *halt* states, this is unneccessary for newer kernels - also it disables WOL.
The second step is to make sure, your card supports WOL. To find out, issue the ˋsudo ethtool eth0ˋ command. You should
get something like this:
{{{
Settings for eth0:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Advertised auto-negotiation: Yes
Speed: 10Mb/s
Duplex: Half
Port: MII
PHYAD: 1
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: g
Wake-on: g
Current message level: 0x00000007 (7)
Link detected: no
}}}
The important lines are the ˋSupports Wake-onˋ and ˋWake-onˋ ones. The "ˋgˋ" means it is enabled for MagicPacket™.
If not, you should manually call the command:
ethtool -s eth0 wol g
This should enable WOL for the card. If this works, you have to issue this command after every bootup as the state will
be back to disabled then. You might want to create a startup script.
Waking remote PCs
=================
The simple way is to use ˋwakeonlanˋ which only supports MagicPacket™.
For a PC in a Class C network, use a call like this:
wakeonlan -i 192.168.1.255 de:ad:be:ef:ca:fe
This would send the packet to the 192.168.1.x subnet and the PC with the specified MAC address should wake up.
**Note:** Some nVidia chipsets require the MAC address to be specified in reverse order. In the example this would
be ˋfe:ca:ef:be:ad:deˋ.

View File

@ -0,0 +1,16 @@
---
title: Updating X11 Fontcache
layout: default
created: 2008-08-15 11:14:03 +0200
updated: 2008-08-15 11:14:03 +0200
toc: false
tags:
- know-how
- software
- linux
- fonts
---
After adding some fonts to the ˋ/usr/share/fontsˋ directories, you have to re-login to see the added fonts. To update
the fontcache without a log-cycle, use the following command:
sudo fc-cache -fv

View File

@ -0,0 +1,20 @@
---
title: SyslogD for LAN
layout: default
created: 2008-08-21 10:39:59 +0200
updated: 2008-08-21 10:39:59 +0200
toc: false
tags:
- know-how
- software
- linux
- syslog
- monitoring
- networking
---
To let the *syslogd* also receive messages from your local network, edit the file ˋ/etc/default/syslogdˋ and modify the
last line so that it looks like this:
SYSLOGD="-r"
Restart the *sysklogd* and watch your ˋ/var/log/messagesˋ.

View File

@ -0,0 +1,23 @@
---
title: NetBIOS/WINS support
layout: default
created: 2008-08-21 10:36:55 +0200
updated: 2008-08-21 10:45:41 +0200
toc: false
tags:
- know-how
- software
- linux
- networking
- netbios
- wins
---
To enable lookup of WINS-names in Ubuntu, edit the file ˋ/etc/nsswitch.confˋ and find the line:
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
Append ˋwinsˋ to the end of the line so that it looks like this:
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4 wins
From now on you can also use NetBIOS names to address PCs in your LAN.

View File

@ -0,0 +1,50 @@
---
title: Evolution/ClamAV integration
layout: default
created: 2008-08-23 18:46:33 +0200
updated: 2008-08-23 18:46:33 +0200
toc: false
tags:
- know-how
- software
- linux
- security
- evolution
- clamav
- antivirus
---
To scan incoming mails for viruses, create to following script somewhere in your system:
{% highlight bash %}
#!/bin/bash
# Fred Blaise <chapeaurouge AT madpenguin DOT org>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
FILE=/tmp/$$_outclam.tmp
clamdscan - 1>$FILE
if [ $? -eq 1 ]; then
STRING=$(grep "FOUND" $FILE |cut -d: -f2)
zenity --warning --title="Evolution: Virus detected" --text="$STRING" &
exit 1
fi
exit 0
{% endhighlight %}
Now setup Evolution's Incoming mail filters to pipe mails through your newly created script. If the return value is not
zero, a virus was detected and you might want to move the mail to *Trash* or a special folder.

View File

@ -0,0 +1,27 @@
---
title: Optimizing Linux
layout: default
created: 2008-08-05 16:45:57 +0200
updated: 2008-08-23 18:48:33 +0200
toc: false
tags:
- know-how
- software
- linux
---
At [Ubuntu Unleashed](http://www.ubuntu-unleashed.com/2008/04/tweak-and-optimize-ubuntu-linux-boot.html) you can find a
document about different settings to optimize startup times of the system and applications itself.
The ˋnoatimeˋ and ˋnodiratimeˋ settings are unneccessary in Hardy as the default option ˋrelatimeˋ only updates the
*access time* if the file has been modified after the last access timestamp.
You can enable the full power of the [upstart](https://launchpad.net/upstart) manager by enabling multi-threading.
In ˋ/etc/init.d/rcˋ at line 24, set ˋCONCURRENCY=shellˋ. But beware of slight problems upon booting. Some services might
be started before depending services are. Also some lines upon startup are printed twice. If you have problems
getting your machine up and running, change it back to ˋnoneˋ.
Another nice feature is adding the ˋprofileˋ option to the kernel line upon boot. The bootup will take longer than
usual but the readahead-daemon will catalog all needed files and on the next boot (without that parameter), all needed
files will be preloaded before boot.
On Desktops with much RAM, the ˋ[preload](http://sf.net/projects/preload)ˋ daemon also speeds up working.