<?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>script &#8211; Everything is Broken</title>
	<atom:link href="https://play.datalude.com/blog/tag/script/feed/" rel="self" type="application/rss+xml" />
	<link>https://play.datalude.com/blog</link>
	<description>Efficiency vs. Inefficiency, in a no-holds barred fight.</description>
	<lastBuildDate>Wed, 19 Nov 2025 03:11:32 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>Advanced Bash logging to handle errors.</title>
		<link>https://play.datalude.com/blog/2025/09/advanced-bash-logging-to-handle-errors/</link>
					<comments>https://play.datalude.com/blog/2025/09/advanced-bash-logging-to-handle-errors/#comments</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Mon, 01 Sep 2025 07:27:41 +0000</pubDate>
				<category><![CDATA[Bash Script]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[script]]></category>
		<guid isPermaLink="false">https://play.datalude.com/blog/?p=759</guid>

					<description><![CDATA[So we've all done a quick log from a bash script, which looks like this That's great for small scripts. But sometimes you find that its not logging errors, which are also helpful, and you need to add those: And different commands behave differently, so it all starts to become complicated. But there's an easier ... <a title="Advanced Bash logging to handle errors." class="read-more" href="https://play.datalude.com/blog/2025/09/advanced-bash-logging-to-handle-errors/" aria-label="Read more about Advanced Bash logging to handle errors.">Read more</a>]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">So we've all done a quick log from a bash script, which looks like this </p>



<pre class="wp-block-code"><code>LOGFILE="logs/$(date +%F)_backup.log"
# Append to the file
restic backup /etc/ &gt;&gt; $LOGFILE
find /root/scripts/ -type f -name "restic*.log" -mtime +14 -delete -print &gt;&gt; $LOGFILE</code></pre>



<p class="wp-block-paragraph">That's great for small scripts. But sometimes you find that its not logging errors, which are also helpful, and you need to add those:</p>



<pre class="wp-block-code"><code>LOGFILE="logs/$(date +%F)_backup.log"
# Append to the file
restic backup /etc/ 2&gt;&amp;1 &gt;&gt; $LOGFILE
find /root/scripts/ -type f -name "restic*.log" -mtime +14 -delete -print 2&gt;&amp;1 &gt;&gt; $LOGFILE</code></pre>



<p class="wp-block-paragraph">And different commands behave differently, so it all starts to become complicated. But there's an easier way. Two actually. The first is to use curly brackets to contain all the commands you want to log, and then pipe it through tee at the end. Commands after that block won't be logged. </p>



<span id="more-759"></span>



<pre class="wp-block-code"><code>LOGFILE="logs/$(date +%F)_backup.log"
{
echo "Starting Restic backup at $(date)"
restic backup /etc/
find /root/scripts/ -type f -name "restic*.log" -mtime +14 -delete -print
echo "Restic backup and maintenance completed"
} 2>&amp;1 | tee -a "${LOGFILE}"</code></pre>



<p class="wp-block-paragraph">And then there's the slightly less readable command substitution method. </p>



<pre class="wp-block-code"><code>exec &gt; &gt;(tee -a "${LOGFILE}") 2&gt;&amp;1
echo "Starting Restic backup at $(date)"
$RESTIC backup /etc/
find /root/scripts/ -type f -name "restic*.log" -mtime +14 -delete -print
echo "Restic backup and maintenance completed"</code></pre>



<h3 class="wp-block-heading">Comparison</h3>



<p class="wp-block-paragraph">Both methods will log all output of all commands, including errors. I find the curly brackets way slightly easier to read. It also allows you to select which commands are logged, but putting them inside the brackets or not. On the other hand, the exec method will log everything until the end of the script, which may or may not be desirable. Curly braces also seems to be more widely compatible. </p>



<p class="wp-block-paragraph">There may be other considerations, different performance considerations and buffering for heavy duty scripts, but that's beyond my regular use cases. </p>



<p class="wp-block-paragraph">Will just add a poor-man's log rotation trick for compleness, and so I can copy and paste it. </p>



<pre class="wp-block-code"><code># Start logging to rolling logfile
LOGFILE=/path/to.log
KEEPLINES=5000
{
            ### commands
} 2>&amp;1 | tee -a "${LOGFILE}"

# Keep last XXXX lines of rolling logfile, defined above in KEEPLINES
tail -n $KEEPLINES "$LOGFILE" > "$LOGFILE".tmp
mv -f "$LOGFILE".tmp "$LOGFILE"</code></pre>



<p class="wp-block-paragraph"></p>
]]></content:encoded>
					
					<wfw:commentRss>https://play.datalude.com/blog/2025/09/advanced-bash-logging-to-handle-errors/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>php-fpm monitoring for single domain</title>
		<link>https://play.datalude.com/blog/2023/06/php-fpm-monitoring-for-single-domain/</link>
					<comments>https://play.datalude.com/blog/2023/06/php-fpm-monitoring-for-single-domain/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Wed, 14 Jun 2023 10:05:35 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[script]]></category>
		<guid isPermaLink="false">https://play.datalude.com/blog/?p=709</guid>

					<description><![CDATA[Ran into this one recently and the solution came out of left field, so I thought I'd throw it out to the internet at large. I've got a server which is running php-fpm and nginx. However it has several websites running on it, each of which has its own php-fpm/pool.d/ profile. We were having a ... <a title="php-fpm monitoring for single domain" class="read-more" href="https://play.datalude.com/blog/2023/06/php-fpm-monitoring-for-single-domain/" aria-label="Read more about php-fpm monitoring for single domain">Read more</a>]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Ran into this one recently and the solution came out of left field, so I thought I'd throw it out to the internet at large. I've got a server which is running php-fpm and nginx. However it has several websites running on it, each of which has its own php-fpm/pool.d/ profile. We were having a problem with one of the websites, which got a lot more traffic than the others, so we needed a way to monitor its php-fpm performance.<br><br>Setting up php monitoring is not hard. There are many guides around the internet. You put the line </p>



<pre class="wp-block-code"><code>pm.status_path = /status</code></pre>



<p class="wp-block-paragraph">in your fpm pool file, then add a block to your nginx config so that it can only be accessed by certain IP addresses. </p>



<span id="more-709"></span>



<pre class="wp-block-code"><code>        location ~ ^/status {
         access_log off;
         allow 127.0.0.1;    # localhost
         allow 12.23.34.45;   # my remote IP
         deny all;  
         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
         fastcgi_index index.php;
         include fastcgi_params;
         fastcgi_pass unix:/run/php/php-fpm-mysite.sock;
        }
</code></pre>



<p class="wp-block-paragraph">You access the URL mysite.com/status and all is good. </p>



<p class="wp-block-paragraph">Things get more complicated when you have a server where each domain has its own fpm pool file. The /status line in this case is just referring to that domain. If you access the mydomain.com/status URL from an external browser, the domain name resolves and nginx picks the correct php-fpm pool file, and you see the stats. </p>



<p class="wp-block-paragraph">Now consider using curl from localhost. </p>



<pre class="wp-block-code"><code> # On a server where there's only one pool file, this works. But when there are multiple pool files it doesn't know which one to use
curl http://127.0.0.1/status
# Can we resolve it with a Host header? No
 curl -H "Host: mysite.com" http://127.0.0.1/status
# Resolve looks hopeful, but actually it doesn't work with SSL
 curl --resolve 'mysite.com:443:127.0.0.1' https://127.0.0.1/status
# Maybe --insecure will help? No
 curl --resolve 'mysite.com:443:127.0.0.1' https://127.0.0.1/status --insecure
# Wait, maybe we can connect directly to the socket, and target the website that way! Nope.
curl --unix-socket /var/run/php/php-fpm-mysite.sock http://status/</code></pre>



<p class="wp-block-paragraph">After exhausting the Internet's wisdom on this, there didn't seem to be a way to get curl to fetch the information. It was needed locally so that it could be incorporated into a monitoring script, so allowing a remote IP to gather the info was not a desirable solution, although rapidly looking like the only option. </p>



<p class="wp-block-paragraph">Salvation came in the form of a program called cgi-fcgi which talks pure cgi-ese to the fpm socket. Or something like that. (apt install libfcgi-bin or yum install fcgi). Once installed, we can ask it for the information like this:</p>



<pre class="wp-block-code"><code>SCRIPT_NAME=/status SCRIPT_FILENAME=/status REQUEST_METHOD=GET cgi-fcgi -bind -connect /var/run/php/php-fpm-mysite.sock</code></pre>



<p class="wp-block-paragraph">So, incorporating that into a script we can monitor our website's fpm usage. I guess this could also be used in telegraf, zabbix and other monitoring solutions. And you can have a different status URL for each site/pool on the server. </p>
]]></content:encoded>
					
					<wfw:commentRss>https://play.datalude.com/blog/2023/06/php-fpm-monitoring-for-single-domain/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Digital Ocean spaces vs restic</title>
		<link>https://play.datalude.com/blog/2022/04/digital-ocean-spaces-vs-restic/</link>
					<comments>https://play.datalude.com/blog/2022/04/digital-ocean-spaces-vs-restic/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Wed, 27 Apr 2022 05:38:16 +0000</pubDate>
				<category><![CDATA[General IT]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[script]]></category>
		<guid isPermaLink="false">https://play.datalude.com/blog/?p=659</guid>

					<description><![CDATA[Very easy answer to a problem that's probably had you cursing for ages. When you set up a DO Spaces instance, you get a URL like https://myspace.eur3.digitaloceanspaces.com/, where eur3 is the datacenter you're in and myspace is the space name you supplied. So you just take that and append s3: to it in your restic ... <a title="Digital Ocean spaces vs restic" class="read-more" href="https://play.datalude.com/blog/2022/04/digital-ocean-spaces-vs-restic/" aria-label="Read more about Digital Ocean spaces vs restic">Read more</a>]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Very easy answer to a problem that's probably had you cursing for ages. When you set up a DO Spaces instance, you get a URL like https://myspace.eur3.digitaloceanspaces.com/, where eur3 is the datacenter you're in and myspace is the space name you supplied. </p>



<p class="wp-block-paragraph">So you just take that and append s3: to it in your restic config, don't you? Of course you do. Except you don't. That will just give you a weird client.BucketExists error. </p>



<p class="wp-block-paragraph">So what it actually wants is this: </p>



<pre class="wp-block-code"><code>s3:eur3.digitaloceanspaces.com/myspace/</code></pre>



<p class="wp-block-paragraph">Or if you have created a subfolder, then use </p>



<pre class="wp-block-code"><code>s3:eur3.digitaloceanspaces.com/myspace/subfolder</code></pre>



<p class="wp-block-paragraph">If you're scripting this and using environment variables,  your whole thing will look like this:</p>



<pre class="wp-block-code"><code># Digital Ocean API Key
export AWS_ACCESS_KEY_ID=THESHORTCAPSANDNUMBERSTRING
# Digital Ocean API SECRET
export AWS_SECRET_ACCESS_KEY=Th3LongMix3dC4seString123213jkadfadsfasdadf
export RESTIC_REPOSITORY="s3:eur3.digitaloceanspaces.com/myspace/subfolder"
export RESTIC_PASSWORD="SecretEncryptionPW"
</code></pre>



<p class="wp-block-paragraph">I hope this saved you some time, because I just spent a couple of hours trying to figure it out.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://play.datalude.com/blog/2022/04/digital-ocean-spaces-vs-restic/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>One Line Guitar Tuner</title>
		<link>https://play.datalude.com/blog/2010/03/one-line-guitar-tuner/</link>
					<comments>https://play.datalude.com/blog/2010/03/one-line-guitar-tuner/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Tue, 16 Mar 2010 01:23:07 +0000</pubDate>
				<category><![CDATA[General IT]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[guitar tuner]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[shell]]></category>
		<guid isPermaLink="false">http://play.datalude.com/blog/?p=193</guid>

					<description><![CDATA[Every now and then I come across something which makes me marvel at the flexibility of Linux. This is one of these things. I play guitar, and I'd previously written a small script to act as a guitar tuner. I generated some .ogg files of the correct pitch and then wrote a script to loop ... <a title="One Line Guitar Tuner" class="read-more" href="https://play.datalude.com/blog/2010/03/one-line-guitar-tuner/" aria-label="Read more about One Line Guitar Tuner">Read more</a>]]></description>
										<content:encoded><![CDATA[<p>Every now and then I come across something which makes me marvel at the flexibility of Linux. This is one of these things.</p>
<p>I play guitar, and I'd previously written a small script to act as a guitar tuner. I generated some .ogg files of the correct pitch and then wrote a script to loop through them in sequence. "Pretty good", I thought, "Clever Me."</p>
<p>Then a few days ago I came across this little gem of a script.</p>
<pre>for n in E2 A2 D3 G3 B3 E4;do play -n synth 4 pluck $n repeat 2;done
</pre>
<p>That's it. Sheer brilliance. Of course you'll need to install the sox package first.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://play.datalude.com/blog/2010/03/one-line-guitar-tuner/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Linux Memory Usage Summary Script</title>
		<link>https://play.datalude.com/blog/2008/11/linux-memory-usage-summary-script/</link>
					<comments>https://play.datalude.com/blog/2008/11/linux-memory-usage-summary-script/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Thu, 20 Nov 2008 07:21:46 +0000</pubDate>
				<category><![CDATA[General IT]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[information]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[report troubleshooting]]></category>
		<category><![CDATA[script]]></category>
		<guid isPermaLink="false">http://play.datalude.com/blog/?p=110</guid>

					<description><![CDATA[I was having trouble with a webserver this week, which I'd just set up for a client. When it went live, it seemed OK initially, but when we left it overnight it curled up its toes and died. It was so dead that I couldn't even ssh in to reboot it, so we had to ... <a title="Linux Memory Usage Summary Script" class="read-more" href="https://play.datalude.com/blog/2008/11/linux-memory-usage-summary-script/" aria-label="Read more about Linux Memory Usage Summary Script">Read more</a>]]></description>
										<content:encoded><![CDATA[<p>I was having trouble with a webserver this week, which I'd just set up for a client. When it went live, it seemed OK initially, but when we left it overnight it curled up its toes and died. It was so dead that I couldn't even ssh in to reboot it, so we had to do a remote reboot. Crunch.</p>
<p>Anyway, on getting it back up, I poked around in the logs and found that it was running out of memory, which it really shouldn't do given that it was a fairly low load on the webserver, and only apache, mysql and php were running on it. I looked around the Interwebs and found an excellent resource called <a href="http://rimuhosting.com/howto/memory.jsp" target="_blank">Troubleshooting Memory Usage</a>, which gave me some pointers about how to rein in apache and stop it from eating up memory so quickly. Thanks!</p>
<p>Anyway on the page was a script for summarising memory usage, which I thought was a good idea, so i grabbed that one and adapted it to my own purposes. I thought I'd make the results available here, so feel free to grab it and adapt it to your own needs.<span id="more-110"></span></p>
<pre>#!/bin/bash
# Mem-info.sh. Version 1.5 2008-12-20
# Adapted from various sources around the Internet.
# Requires mutt to be installed to use the email function. 

#################### Functions ####################
function print_help {
	echo "  Usage:"
	echo "    $0 [-a full|summary] -f /tmp/memoryreport.txt"
	echo "    Parameters:"
	echo "    -a              Specify full or summary report"
	echo "    -f              Specify alternate filename "
	echo "    -e &lt;adddr&gt;      Send report to specified email address"             
	echo "    -h | --help     This usage information"
	echo "    Running the script with no parameters writes a summary report to ./output.txt"
}

function summary_report {
	echo "=========================== SUMMARY ============================" &gt; $mem_outputfile
	date &gt;&gt; $mem_outputfile
	echo  &gt;&gt; $mem_outputfile
	echo "=========================== uptime ==============================" &gt;&gt; $mem_outputfile
	uptime &gt;&gt; $mem_outputfile
	echo  &gt;&gt; $mem_outputfile
	echo "========================== free -m ==============================" &gt;&gt; $mem_outputfile
	free -m &gt;&gt; $mem_outputfile
	echo  &gt;&gt; $mem_outputfile
	echo "========================= vmstat 1.5 ============================" &gt;&gt; $mem_outputfile
	vmstat 1 5 &gt;&gt; $mem_outputfile
	echo  &gt;&gt; $mem_outputfile
	echo "================== ps top 20 Processes by CPU ===================" &gt;&gt; $mem_outputfile
	ps -eo user,%mem,%cpu,pid,cmd --sort -%cpu | head -n 20 &gt;&gt; $mem_outputfile
	echo  &gt;&gt; $mem_outputfile

}

function full_report {
	summary_report
	echo "========================= FULL DETAIL ===========================" &gt;&gt; $mem_outputfile
	echo "======================== top raw output =========================" &gt;&gt; $mem_outputfile
	top -b -n 1 &gt;&gt; $mem_outputfile
	echo " " &gt;&gt; $mem_outputfile
	echo "======================= ps auxf raw output ======================" &gt;&gt; $mem_outputfile
	ps auxf --width=200 &gt;&gt; $mem_outputfile
	echo  &gt;&gt; $mem_outputfile
	echo "=========================== end ================================ " &gt;&gt; $mem_outputfile
	echo  &gt;&gt; $mem_outputfile
	echo  &gt;&gt; $mem_outputfile
}

#################### Process Command line ####################

while [ "$1" != "" ]; do
    case $1 in
        -f )           	shift
                                mem_outputfile=$1
                                ;;
        -a )    	shift
				mem_action=$1
                                ;;
        -e )            shift
				email_to=$1
				;;
        -h | --help )           print_help
                                exit
                                ;;
        * )                     print_help
                                exit
				;;
    esac
    shift
done

######################### Set Defaults #########################
if [ -z "${mem_action}" ]; then 
    echo "    No action Specified. Defaulting to summary report"
    mem_action="summary"
fi
if [ -z "${mem_outputfile}" ]; then 
    echo "    No output file specified. Writing to `pwd`/output.txt"
    mem_outputfile="output.txt"
fi

######################### Do Stuff #########################

if [ "$mem_action" = "full" ]; then
		full_report
	else
		summary_report
fi

if [ "$email_to" = "" ]; then
		echo "    No email address specified. Not emailing report."
	else
		mutt -s "Memory Usage Report" $email_to &lt; $mem_outputfile
fi</pre>
<p>Or you can download the file <a href="http://play.datalude.com/blog/wp-content/uploads/2008/11/mem-info1.sh">mem-info1 </a> if the formatting above is all messed up. Make sure you go to the page I linked to above for excellent advice on interpreting the report.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://play.datalude.com/blog/2008/11/linux-memory-usage-summary-script/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Ubuntu Touchpad toggle tweak</title>
		<link>https://play.datalude.com/blog/2008/11/ubuntu-804-tweak-touchpad-toggle/</link>
					<comments>https://play.datalude.com/blog/2008/11/ubuntu-804-tweak-touchpad-toggle/#comments</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Mon, 10 Nov 2008 08:41:16 +0000</pubDate>
				<category><![CDATA[General IT]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[toggle]]></category>
		<category><![CDATA[touchpad]]></category>
		<category><![CDATA[ubuntu]]></category>
		<guid isPermaLink="false">http://play.datalude.com/blog/?p=99</guid>

					<description><![CDATA[I've been getting irritated with the touchpad on this new Dell Vostro 1400. I type for a while, and then my palm touches the touchpad, sending the pointer skimming into the line above, or clicking on buttons I don't want to click on. So, I looked around and figured out a solution. Over the past ... <a title="Ubuntu Touchpad toggle tweak" class="read-more" href="https://play.datalude.com/blog/2008/11/ubuntu-804-tweak-touchpad-toggle/" aria-label="Read more about Ubuntu Touchpad toggle tweak">Read more</a>]]></description>
										<content:encoded><![CDATA[<p>I've been getting irritated with the touchpad on this new Dell Vostro 1400. I type for a while, and then my palm touches the touchpad, sending the pointer skimming into the line above, or clicking on buttons I don't want to click on. So, I looked around and figured out a solution. Over the past two years, I've had to update this post for every single new version of Ubuntu, which has been a pain, so look for the heading below which corresponds to your version of Ubuntu.</p>
<p><strong>Ubuntu Hardy 8.04</strong></p>
<p>First of all, you need to edit your /etc/xorg.conf file, for which you'll need root privileges &#8211; use sudo.You just need to add one line in the input device section, which is the one in bold below. (Intrepid 8.10, see below)</p>
<pre>Section "InputDevice"</pre>
<pre>        Identifier      "Synaptics Touchpad"</pre>
<pre>        Driver          "synaptics"</pre>
<pre>        Option          "SendCoreEvents"        "true"</pre>
<pre>        Option          "Device"                "/dev/psaux"</pre>
<pre>        Option          "Protocol"              "auto-dev"</pre>
<pre>        Option          "HorizEdgeScroll"       "0"</pre>
<pre><strong>        Option          "SHMConfig"</strong></pre>
<pre>EndSection<span id="more-99"></span></pre>
<p>OK, now after you restart X, by logging out and in again, you can turn off the touchpad with</p>
<pre>    synclient TouchpadOff=0</pre>
<p>And on with</p>
<pre>    synclient TouchpadOff=0</pre>
<p>I put this together in a script which will look to see if it is on or off, and toggle it to the opposite.</p>
<pre>if synclient -l | grep TouchpadOff | grep 1</pre>
<pre>then</pre>
<pre>    synclient TouchpadOff=0</pre>
<pre>else</pre>
<pre>    synclient TouchpadOff=1</pre>
<pre>fi</pre>
<p>I attached the script to an icon in my toolbar using the Add to Panel &gt; Launcher route. Now I just have to click to toggle it off and on.</p>
<p><strong>Ubuntu 8.10, Intrepid Whatsit </strong></p>
<p>While the script above still works, editing xorg.conf doesn't work any more, as Ubuntu is moving functionality out of that file. So, instead of that we create a file here.</p>
<pre>sudo nano /etc/hal/fdi/policy/shmconfig.fdi</pre>
<p>and cut and paste the following into it, saving afterwards.</p>
<p>&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;<br />
&lt;deviceinfo version="0.2"&gt;<br />
&lt;device&gt;<br />
&lt;match key="input.x11_driver" string="synaptics"&gt;<br />
&lt;merge key="input.x11_options.SHMConfig" type="string"&gt;True&lt;/merge&gt;<br />
&lt;merge key="input.x11_options.HorizEdgeScroll" type="string"&gt;1&lt;/merge&gt;<br />
&lt;/match&gt;<br />
&lt;/device&gt;<br />
&lt;/deviceinfo&gt;</p>
<p>This file only works with Synaptics Touchpad driver. If you have another touchpad, the filename may be different. There are hundreds of other options which you can activate in this file, but the SHMConfig line is the one you need to allow the script to work.</p>
<p>OK, now you've done that, the commands and script above should work.</p>
<p><strong>Ubuntu 9.04 Jaunty Jackass</strong></p>
<p>&#8230;. it should work unless you upgrade to 9.04 that is. Now neither of those methods work for disabling the touchpad, which is causing me no end of irritation. So now there's a third solution which I discovered after finding the new touchpad control panel under System &gt; Preferences &gt; Mouse &gt; Touchpad. In there there is a switch to turn off the touchpad, so I figured there must be a way to change this setting with gconftool. Here's what  came up with:</p>
<p>gconftool-2 &#8211;toggle /desktop/gnome/peripherals/mouse/touchpad_enabled</p>
<p>This works from the commandline, in a script and even typed directly into a launcher button on your menubar for lightning fast toggling. Which is the only way to toggle.</p>
<p><strong>Ubuntu 9.10 Karmic Koala<br />
</strong></p>
<p>Why do they have to change this every frigging version. OK, so back to a script into which the following is inserted.</p>
<pre>if xinput list-props "SynPS/2 Synaptics TouchPad" | grep "Device Enabled" | grep 1</pre>
<pre>then</pre>
<pre>    xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 8 0</pre>
<pre>else</pre>
<pre>     xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 8 1</pre>
<pre>fi</pre>
<p>Then assign this to a key (in my case F6) using System &gt; Preferences &gt; Keyboard Shortcuts. All seems to work again &#8230; until the next upgrade.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://play.datalude.com/blog/2008/11/ubuntu-804-tweak-touchpad-toggle/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
	</channel>
</rss>
