<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>mathz.nu</title>
	<atom:link href="http://mathz.nu/feed/" rel="self" type="application/rss+xml" />
	<link>http://mathz.nu</link>
	<description>Asterisk Blacklist Hobby webbhotell</description>
	<lastBuildDate>Tue, 24 Jan 2012 18:15:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>TapeWare in Ububtu</title>
		<link>http://mathz.nu/tapeware-in-ububtu/</link>
		<comments>http://mathz.nu/tapeware-in-ububtu/#comments</comments>
		<pubDate>Tue, 24 Jan 2012 10:55:11 +0000</pubDate>
		<dc:creator>Mathz</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://mathz.nu/?p=228</guid>
		<description><![CDATA[To install TapeWare v7.0 Master and Server Enterprise (SP5C) you need to install xterm sudo apt-get install xterm sudo apt-get install ncurses-term start xming server on Windows start sudo xterm start the install of TapeWare &#160; SUN DLT7000 drive in TapeWare in file twtapdev.ini add &#8220;SUN     DLT7000=DLT 7000&#8243; in my case there was 5 spaces. [...]]]></description>
			<content:encoded><![CDATA[<p>To install TapeWare v7.0 Master and Server Enterprise (SP5C) you need to install xterm</p>
<p>sudo apt-get install xterm</p>
<p>sudo apt-get install ncurses-term</p>
<p>start xming server on Windows</p>
<p>start sudo xterm</p>
<p>start the install of TapeWare</p>
<p>&nbsp;</p>
<p>SUN DLT7000 drive in TapeWare<br />
in file twtapdev.ini add &#8220;SUN     DLT7000=DLT 7000&#8243; in my case there was 5 spaces.<br />
restartservice:<br />
sudo ./twunxsvc -x<br />
sudo ./twunxsvc -s</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://mathz.nu/tapeware-in-ububtu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Diff directories in Linux</title>
		<link>http://mathz.nu/diff-directories-in-linux/</link>
		<comments>http://mathz.nu/diff-directories-in-linux/#comments</comments>
		<pubDate>Tue, 17 Jan 2012 16:37:02 +0000</pubDate>
		<dc:creator>Mathz</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://mathz.nu/?p=226</guid>
		<description><![CDATA[diff --recursive --brief /tmp/dir1 /tmp/dir2 &#124;grep Only]]></description>
			<content:encoded><![CDATA[<pre><strong>diff --recursive --brief /tmp/dir1 /tmp/dir2</strong> |grep Only</pre>
]]></content:encoded>
			<wfw:commentRss>http://mathz.nu/diff-directories-in-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Convert an Addon Domain to its Own cPanel and Vice Versa</title>
		<link>http://mathz.nu/convert-an-addon-domain-to-its-own-cpanel-and-vice-versa/</link>
		<comments>http://mathz.nu/convert-an-addon-domain-to-its-own-cpanel-and-vice-versa/#comments</comments>
		<pubDate>Fri, 13 Jan 2012 17:59:14 +0000</pubDate>
		<dc:creator>Mathz</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://mathz.nu/?p=223</guid>
		<description><![CDATA[These steps assume that the domain will remain on the same server. Addon domain turned into a separate cPanel Download the content of your addon domain to your local PC. Backup any associated database(s). Go into the original cPanel and remove the addon domain from under the Addon Domains icon. (You do not need to [...]]]></description>
			<content:encoded><![CDATA[<p>These steps assume that the domain will remain on the same server.</p>
<h2>Addon domain turned into a separate cPanel</h2>
<ol>
<li>Download the content of your addon domain to your local PC.</li>
<li>Backup any associated database(s).</li>
<li>Go into the original cPanel and remove the addon domain from under the Addon Domains icon. (You do not need to delete the original content or original databases.)</li>
<li>Create a New Account inside your WHM. Fill out the form, using the old addon domain name as the Domain. Click the Create button.</li>
<li>Once the new cPanel is ready, upload the content of your old addon domain to this new cPanel, in the public_html folder. (When using FTP to upload, connect to the cPanel&#8217;s IP address and login with the new cPanel&#8217;s username and password.)</li>
<li>Login to the new cPanel and restore the database backup(s).</li>
<li>Reconfigure any database connections. (The database name and username have likely changed.)</li>
</ol>
<p>Your site will only be down as long as it takes to complete these steps. No need to change your name servers.</p>
]]></content:encoded>
			<wfw:commentRss>http://mathz.nu/convert-an-addon-domain-to-its-own-cpanel-and-vice-versa/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>xml2array</title>
		<link>http://mathz.nu/xml2array/</link>
		<comments>http://mathz.nu/xml2array/#comments</comments>
		<pubDate>Tue, 10 Jan 2012 21:51:10 +0000</pubDate>
		<dc:creator>Mathz</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://mathz.nu/?p=217</guid>
		<description><![CDATA[This code is not written by me! /** * xml2array() will convert the given XML text to an array in the XML structure. * Link: http://www.bin-co.com/php/scripts/xml2array/ * Arguments : $contents - The XML text * $get_attributes - 1 or 0. If this is 1 the function will get the attributes as well as the tag [...]]]></description>
			<content:encoded><![CDATA[<p>This code is not written by me!</p>
<p><code><br />
/**<br />
* xml2array() will convert the given XML text to an array in the XML structure.<br />
* Link: http://www.bin-co.com/php/scripts/xml2array/<br />
* Arguments : $contents - The XML text<br />
* $get_attributes - 1 or 0. If this is 1 the function will get the attributes as well as the tag values - this results in a different array structure in the return value.<br />
* $priority - Can be 'tag' or 'attribute'. This will change the way the resulting array sturcture. For 'tag', the tags are given more importance.<br />
* Return: The parsed XML in an array form. Use print_r() to see the resulting array structure.<br />
* Examples: $array = xml2array(file_get_contents('feed.xml'));<br />
* $array = xml2array(file_get_contents('feed.xml', 1, 'attribute'));<br />
*/<br />
function xml2array($contents, $get_attributes=1, $priority = 'tag') {<br />
if(!$contents) return array();</code></p>
<p>if(!function_exists(&#8216;xml_parser_create&#8217;)) {<br />
//print &#8220;&#8216;xml_parser_create()&#8217; function not found!&#8221;;<br />
return array();<br />
}</p>
<p>//Get the XML parser of PHP &#8211; PHP must have this module for the parser to work<br />
$parser = xml_parser_create(&#8221;);<br />
xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, &#8220;UTF-8&#8243;); # http://minutillo.com/steve/weblog/2004/6/17/php-xml-and-character-encodings-a-tale-of-sadness-rage-and-data-loss<br />
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);<br />
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);<br />
xml_parse_into_struct($parser, trim($contents), $xml_values);<br />
xml_parser_free($parser);</p>
<p>if(!$xml_values) return;//Hmm&#8230;</p>
<p>//Initializations<br />
$xml_array = array();<br />
$parents = array();<br />
$opened_tags = array();<br />
$arr = array();</p>
<p>$current = &amp;$xml_array; //Refference</p>
<p>//Go through the tags.<br />
$repeated_tag_index = array();//Multiple tags with same name will be turned into an array<br />
foreach($xml_values as $data) {<br />
unset($attributes,$value);//Remove existing values, or there will be trouble</p>
<p>//This command will extract these variables into the foreach scope<br />
// tag(string), type(string), level(int), attributes(array).<br />
extract($data);//We could use the array by itself, but this cooler.</p>
<p>$result = array();<br />
$attributes_data = array();</p>
<p>if(isset($value)) {<br />
if($priority == &#8216;tag&#8217;) $result = $value;<br />
else $result['value'] = $value; //Put the value in a assoc array if we are in the &#8216;Attribute&#8217; mode<br />
}</p>
<p>//Set the attributes too.<br />
if(isset($attributes) and $get_attributes) {<br />
foreach($attributes as $attr =&gt; $val) {<br />
if($priority == &#8216;tag&#8217;) $attributes_data[$attr] = $val;<br />
else $result['attr'][$attr] = $val; //Set all the attributes in a array called &#8216;attr&#8217;<br />
}<br />
}</p>
<p>//See tag status and do the needed.<br />
if($type == &#8220;open&#8221;) {//The starting of the tag &#8221;<br />
$parent[$level-1] = &amp;$current;<br />
if(!is_array($current) or (!in_array($tag, array_keys($current)))) { //Insert New tag<br />
$current[$tag] = $result;<br />
if($attributes_data) $current[$tag. '_attr'] = $attributes_data;<br />
$repeated_tag_index[$tag.'_'.$level] = 1;</p>
<p>$current = &amp;$current[$tag];</p>
<p>} else { //There was another element with the same tag name</p>
<p>if(isset($current[$tag][0])) {//If there is a 0th element it is already an array<br />
$current[$tag][$repeated_tag_index[$tag.'_'.$level]] = $result;<br />
$repeated_tag_index[$tag.'_'.$level]++;<br />
} else {//This section will make the value an array if multiple tags with the same name appear together<br />
$current[$tag] = array($current[$tag],$result);//This will combine the existing item and the new item together to make an array<br />
$repeated_tag_index[$tag.'_'.$level] = 2;</p>
<p>if(isset($current[$tag.'_attr'])) { //The attribute of the last(0th) tag must be moved as well<br />
$current[$tag]['0_attr'] = $current[$tag.'_attr'];<br />
unset($current[$tag.'_attr']);<br />
}</p>
<p>}<br />
$last_item_index = $repeated_tag_index[$tag.'_'.$level]-1;<br />
$current = &amp;$current[$tag][$last_item_index];<br />
}</p>
<p>} elseif($type == &#8220;complete&#8221;) { //Tags that ends in 1 line &#8221;<br />
//See if the key is already taken.<br />
if(!isset($current[$tag])) { //New Key<br />
$current[$tag] = $result;<br />
$repeated_tag_index[$tag.'_'.$level] = 1;<br />
if($priority == &#8216;tag&#8217; and $attributes_data) $current[$tag. '_attr'] = $attributes_data;</p>
<p>} else { //If taken, put all things inside a list(array)<br />
if(isset($current[$tag][0]) and is_array($current[$tag])) {//If it is already an array&#8230;</p>
<p>// &#8230;push the new element into that array.<br />
$current[$tag][$repeated_tag_index[$tag.'_'.$level]] = $result;</p>
<p>if($priority == &#8216;tag&#8217; and $get_attributes and $attributes_data) {<br />
$current[$tag][$repeated_tag_index[$tag.'_'.$level] . &#8216;_attr&#8217;] = $attributes_data;<br />
}<br />
$repeated_tag_index[$tag.'_'.$level]++;</p>
<p>} else { //If it is not an array&#8230;<br />
$current[$tag] = array($current[$tag],$result); //&#8230;Make it an array using using the existing value and the new value<br />
$repeated_tag_index[$tag.'_'.$level] = 1;<br />
if($priority == &#8216;tag&#8217; and $get_attributes) {<br />
if(isset($current[$tag.'_attr'])) { //The attribute of the last(0th) tag must be moved as well</p>
<p>$current[$tag]['0_attr'] = $current[$tag.'_attr'];<br />
unset($current[$tag.'_attr']);<br />
}</p>
<p>if($attributes_data) {<br />
$current[$tag][$repeated_tag_index[$tag.'_'.$level] . &#8216;_attr&#8217;] = $attributes_data;<br />
}<br />
}<br />
$repeated_tag_index[$tag.'_'.$level]++; //0 and 1 index is already taken<br />
}<br />
}</p>
<p>} elseif($type == &#8216;close&#8217;) { //End of tag &#8221;<br />
$current = &amp;$parent[$level-1];<br />
}<br />
}</p>
<p>return($xml_array);<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>http://mathz.nu/xml2array/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dump mysql tables with mysqldump</title>
		<link>http://mathz.nu/dump-mysql-tables-with-mysqldump/</link>
		<comments>http://mathz.nu/dump-mysql-tables-with-mysqldump/#comments</comments>
		<pubDate>Thu, 22 Dec 2011 08:10:08 +0000</pubDate>
		<dc:creator>Mathz</dc:creator>
				<category><![CDATA[Server]]></category>

		<guid isPermaLink="false">http://mathz.nu/?p=210</guid>
		<description><![CDATA[Here is a script for dumping tables from all databases in MySql. #!/bin/bash # ************************************************************* # file: mysqldump.sh # date: 2011-12-22 00:22 # author: (c) by Mats Ahlbom - mats@ahlbom.nu # description: Get a mysqldump-file for eath table in all databases # ************************************************************* # name of database user ( must have LOCK_TABLES rights )&#8230; dbUsername=&#8221;mythtv&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a script for dumping tables from all databases in MySql.</p>
<p><code><br />
#!/bin/bash<br />
# *************************************************************<br />
# file: mysqldump.sh<br />
# date: 2011-12-22 00:22<br />
# author: (c) by Mats Ahlbom - mats@ahlbom.nu<br />
# description: Get a mysqldump-file for eath table in all databases<br />
# *************************************************************</code></p>
<p># name of database user ( must have LOCK_TABLES rights )&#8230;<br />
dbUsername=&#8221;mythtv&#8221;</p>
<p># password of database user&#8230;<br />
dbPassword=&#8221;mythtv&#8221;</p>
<p># path to backup directory&#8230;<br />
dbBackup=&#8221;/home/mathz/mysqldump&#8221;</p>
<p># Delete old dumped tables true/false<br />
delete_old=&#8221;flase&#8221;</p>
<p># *************************************************************<br />
# Do not edit below this line!<br />
# get current date ( YYYY-MM-DD )&#8230;<br />
date=$( date +%Y-%m-%d )</p>
<p># create backup directory if not exists&#8230;<br />
[ ! -d "$dbBackup" ] &amp;&amp; mkdir -p $dbBackup</p>
<p>if [ $delete_old = "true" ]; then<br />
find $dbBackup/ -type f -name &#8216;*.sql.gz&#8217; -exec rm -rf {} &#8216;;&#8217; &gt;/dev/null 2&gt;&amp;1<br />
fi</p>
<p># loop all databases&#8230;</p>
<p>for db in $( mysql -u $dbUsername &#8211;password=$dbPassword -Bse &#8220;show databases&#8221; ); do<br />
# loop all tables in database<br />
for tables in $( mysql -u $dbUsername &#8211;password=$dbPassword -Bse &#8220;show tables&#8221; ${db} ); do<br />
# get mysqldump of current tavble&#8230;<br />
mysqldump -u $dbUsername &#8211;password=$dbPassword &#8211;opt &#8211;databases $db &#8211;tables $tables | gzip -9 &gt;${dbBackup}/${db}-${tables}-${dat<br />
e}.sql.gz<br />
done<br />
done</p>
<p># *************************************************************<br />
# EOF</p>
]]></content:encoded>
			<wfw:commentRss>http://mathz.nu/dump-mysql-tables-with-mysqldump/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mythubuntu not open port 6543</title>
		<link>http://mathz.nu/mythubuntu-not-open-port-6543/</link>
		<comments>http://mathz.nu/mythubuntu-not-open-port-6543/#comments</comments>
		<pubDate>Thu, 13 Oct 2011 20:14:00 +0000</pubDate>
		<dc:creator>Mathz</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://mathz.nu/?p=206</guid>
		<description><![CDATA[After upgrade of MythBuntu the system do not open port 6543. After running: sudo dpkg-reconfigure mythtv-common sudo dpkg-reconfigure mythtv-database the port is open and MythBuntu are working!]]></description>
			<content:encoded><![CDATA[<p>After upgrade of MythBuntu the system do not open port 6543. After running:</p>
<p><code>sudo dpkg-reconfigure mythtv-common</code><br />
<code>sudo dpkg-reconfigure mythtv-database</code></p>
<p>the port is open and MythBuntu are working!</p>
]]></content:encoded>
			<wfw:commentRss>http://mathz.nu/mythubuntu-not-open-port-6543/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Find string and remove file</title>
		<link>http://mathz.nu/find-string-and-remove-file/</link>
		<comments>http://mathz.nu/find-string-and-remove-file/#comments</comments>
		<pubDate>Mon, 10 Oct 2011 10:37:59 +0000</pubDate>
		<dc:creator>Mathz</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://mathz.nu/?p=201</guid>
		<description><![CDATA[You can use this to find a string in a file and remove the file. find . &#124; xargs grep -l youemail@email.com &#124; awk '{print "rm "$1}' &#62; doit.sh Look in file doit.sh for errors. Execute the file: bash doit.sh]]></description>
			<content:encoded><![CDATA[<p>You can use this to find a string in a file and remove the file.<br />
<code>find . | xargs grep -l youemail@email.com | awk '{print "rm "$1}' &gt; doit.sh</code><br />
Look in file doit.sh for errors.<br />
Execute the file:<code><br />
bash doit.sh</code></p>
]]></content:encoded>
			<wfw:commentRss>http://mathz.nu/find-string-and-remove-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Copy partition table using dd</title>
		<link>http://mathz.nu/copy-partition-table-using-dd/</link>
		<comments>http://mathz.nu/copy-partition-table-using-dd/#comments</comments>
		<pubDate>Tue, 04 Oct 2011 05:29:15 +0000</pubDate>
		<dc:creator>Mathz</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://mathz.nu/?p=198</guid>
		<description><![CDATA[dd if=/dev/source of=/dev/dest bs=512 count=1]]></description>
			<content:encoded><![CDATA[<pre><code>dd if=/dev/source of=/dev/dest bs=512 count=1</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://mathz.nu/copy-partition-table-using-dd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mdadmin</title>
		<link>http://mathz.nu/mdadmin/</link>
		<comments>http://mathz.nu/mdadmin/#comments</comments>
		<pubDate>Wed, 28 Sep 2011 06:51:11 +0000</pubDate>
		<dc:creator>Mathz</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://mathz.nu/?p=192</guid>
		<description><![CDATA[Rescan md-device mdadm --assemble --scan Stop md-device Stop all service using device, samba, nfs mdadm --manage --stop /dev/md0 Readd md-device mdadm --manage --add /dev/md0 /dev/sdc2 &#160;]]></description>
			<content:encoded><![CDATA[<p>Rescan md-device<br />
<code>mdadm --assemble --scan</code></p>
<p>Stop md-device<br />
Stop all service using device, samba, nfs<br />
<code>mdadm --manage --stop /dev/md0</code></p>
<p>Readd md-device<br />
<code>mdadm --manage --add /dev/md0 /dev/sdc2</code></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://mathz.nu/mdadmin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Software RAID monitoring in Zabbix</title>
		<link>http://mathz.nu/software-raid-monitoring-in-zabbix/</link>
		<comments>http://mathz.nu/software-raid-monitoring-in-zabbix/#comments</comments>
		<pubDate>Tue, 18 Jan 2011 21:25:57 +0000</pubDate>
		<dc:creator>Mathz</dc:creator>
				<category><![CDATA[Server]]></category>

		<guid isPermaLink="false">http://mathz.nu/?p=177</guid>
		<description><![CDATA[To monitor software RAID in Zabbix 1.8 you need to make following changes in Zabbix: in /etc/zabbix/zabbix-agent*.conf on client add in the end of the file: #CONTROLLO RAID UserParameter=custom.mdstat,/bin/cat /proc/mdstat &#124; grep -c _ You need to restart zabbix Agent sudo /etc/init.d/zabbix-agent restart On the Zabbix server add to the Linux Template: Items: Host: Template_Linux [...]]]></description>
			<content:encoded><![CDATA[<p>To monitor software RAID in Zabbix 1.8 you need to make following changes in Zabbix:</p>
<p>in /etc/zabbix/zabbix-agent*.conf on client</p>
<blockquote><p>add in the end of the file:<br />
#CONTROLLO RAID<br />
UserParameter=custom.mdstat,/bin/cat /proc/mdstat | grep -c _</p></blockquote>
<blockquote><p>You need to restart zabbix Agent<br />
sudo /etc/init.d/zabbix-agent restart</p></blockquote>
<p>On the Zabbix server add to the Linux Template:</p>
<blockquote><p>Items:<br />
Host: Template_Linux<br />
Description: MDStat<br />
Type: Zabbix_agent<br />
Key: custom.mdstat<br />
Applications: Availability, Filesystem</p>
<p>Trigger:<br />
Name: RAID on {HOSTNAME}<br />
Expression: {Template_Linux:custom.mdstat.last(0)}#0</p></blockquote>
<p>This is tested on Ubuntu servers with:<br />
RAID 1 with 2 disks<br />
RAID 5 with 4 and 6 disks<br />
RAID 6 with 8 disks</p>
]]></content:encoded>
			<wfw:commentRss>http://mathz.nu/software-raid-monitoring-in-zabbix/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

