<?xml version="1.0" encoding="iso-8859-1"?>
<rss version="2.0">
<channel>
  <title>Linux Format forums</title>
  <link>http://www.linuxformat.com/forums/index.php</link>
  <description>Help, discussion, magazine feedback and more</description>
  <language>english</language>
  <copyright>(c) Copyright Wed Jun 19, 2013 4:53 pm by Linux Format forums</copyright>
  <managingEditor>webmaster@linuxformat.com</managingEditor>
  <webMaster>webmaster@linuxformat.com</webMaster>
  <pubDate>Wed Jun 19, 2013 4:53 pm</pubDate>
  <lastBuildDate>Wed Jun 19, 2013 4:53 pm</lastBuildDate>
  <docs>http://backend.userland.com/rss</docs>
  <generator>phpBB2 RSS Syndication Mod by Lucas</generator>
  <ttl>1</ttl>

  <image>
    <title>Linux Format forums</title>
    <url></url>
    <link>http://www.linuxformat.com/forums/</link>
    <description>Help, discussion, magazine feedback and more</description>
  </image>

                                      <item>
                                        <title>RE: usb autolaunch</title>
                                        <link>http://www.linuxformat.com/forums/viewtopic.php?p=478#478</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=231'&gt;wyliecoyoteuk&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Tue Apr 12, 2005 11:19 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Got it working:)&lt;br /&gt;
&lt;br /&gt;
script as follows :&lt;br /&gt;
&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
if [ &quot;$DEVNAME&quot; == &quot;/dev/sda1&quot;  -a &quot;$ACTION&quot; == &quot;add&quot; ] ; then&lt;br /&gt;
   rsync -av /home  /media/usb-DEF1098C08E5:0:0:0p1 &lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
I had to add:&lt;br /&gt;
 export $ACTION&lt;br /&gt;
to the end of  /etc/dev.d/51-subfs.dev&lt;br /&gt;
to make sure it passed the variable.&lt;br /&gt;
&lt;br /&gt;
(and I decided to use rsync , much tidier)&lt;br /&gt;
&lt;br /&gt;
Suse9,2 assigns fixed names including the serial number of the device  by default, and I only want to use one device on this machine (it is a headless scan storage server), just want to be able to plug in a big USB drive and automatically copy the directory tree under /home/scanroute.&lt;br /&gt;
&lt;br /&gt;
Thanks, nelz!</description>
                                        <comments>http://www.linuxformat.com/forums/viewtopic.php?p=478#478</comments>
                                        <author>wyliecoyoteuk</author>
                                        <pubDate>Tue Apr 12, 2005 11:19 pm</pubDate>
                                        <guid isPermaLink="true">http://www.linuxformat.com/forums/viewtopic.php?p=478#478</guid>
                                      </item>
                                      <item>
                                        <title>RE: usb autolaunch</title>
                                        <link>http://www.linuxformat.com/forums/viewtopic.php?p=423#423</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=5'&gt;nelz&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Tue Apr 12, 2005 2:55 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      udev aslo sets ACTION to add* or remove*&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;if &amp;#91; &amp;quot;$DEVNAME&amp;quot; == &amp;quot;backup&amp;quot; -a &amp;quot;$ACTION=&amp;quot;add*&amp;quot; &amp;#93;; then&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt; &lt;br /&gt;
&lt;br /&gt;
should do it. If not, read the udev man page for more details.</description>
                                        <comments>http://www.linuxformat.com/forums/viewtopic.php?p=423#423</comments>
                                        <author>nelz</author>
                                        <pubDate>Tue Apr 12, 2005 2:55 pm</pubDate>
                                        <guid isPermaLink="true">http://www.linuxformat.com/forums/viewtopic.php?p=423#423</guid>
                                      </item>
                                      <item>
                                        <title>RE: usb autolaunch</title>
                                        <link>http://www.linuxformat.com/forums/viewtopic.php?p=420#420</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=-1'&gt;Anonymous&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Tue Apr 12, 2005 2:38 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      well that worked:)&lt;br /&gt;
Unfortunately, it looks like it runs the script on both mount and umount!&lt;br /&gt;
&lt;br /&gt;
shown as guest `cos on work PC</description>
                                        <comments>http://www.linuxformat.com/forums/viewtopic.php?p=420#420</comments>
                                        <author>Anonymous</author>
                                        <pubDate>Tue Apr 12, 2005 2:38 pm</pubDate>
                                        <guid isPermaLink="true">http://www.linuxformat.com/forums/viewtopic.php?p=420#420</guid>
                                      </item>
                                      <item>
                                        <title>RE: usb autolaunch</title>
                                        <link>http://www.linuxformat.com/forums/viewtopic.php?p=380#380</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=5'&gt;nelz&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Mon Apr 11, 2005 11:33 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      DEVNAME is set to the name of the device before the script is called.&lt;br /&gt;
&lt;br /&gt;
That name is the mount point, not the device name, which will start with /dev/ $DEVNAME is relative to /dev. You need to set up a rule in /etc/udev/rules/ to ensure the device always has the same device name. If you don't it will be sda if you plug it in first but sdb if you connect another USB storage device first.&lt;br /&gt;
&lt;br /&gt;
All scripts in /etc/dev.d are run when a device is connected, so it shouldn't matter what you call it.</description>
                                        <comments>http://www.linuxformat.com/forums/viewtopic.php?p=380#380</comments>
                                        <author>nelz</author>
                                        <pubDate>Mon Apr 11, 2005 11:33 pm</pubDate>
                                        <guid isPermaLink="true">http://www.linuxformat.com/forums/viewtopic.php?p=380#380</guid>
                                      </item>
                                      <item>
                                        <title>RE: usb autolaunch</title>
                                        <link>http://www.linuxformat.com/forums/viewtopic.php?p=370#370</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=-1'&gt;Anonymous&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Mon Apr 11, 2005 10:36 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      makes sense, but how is the $DEVNAME parsed?&lt;br /&gt;
&lt;br /&gt;
Suse 9.2 assigns persistent names by default, my usb drive is file:/media/usb-DEF1098C08E5:0:0:0p1&lt;br /&gt;
&lt;br /&gt;
whatever port I plug it in.&lt;br /&gt;
&lt;br /&gt;
unfortunately, it is not obvious where the script should be.&lt;br /&gt;
&lt;br /&gt;
there are 2 scripts in /etc/dev.d/block/&lt;br /&gt;
&lt;br /&gt;
they are 50-hwscan.dev and 51-subfs.dev&lt;br /&gt;
&lt;br /&gt;
i tried adding usbhdd.dev, but no result.&lt;br /&gt;
the script works if excecuted, but it seems to be a problem launching it automatically.&lt;br /&gt;
I might use a cron job to run it, but the auto option would be better</description>
                                        <comments>http://www.linuxformat.com/forums/viewtopic.php?p=370#370</comments>
                                        <author>Anonymous</author>
                                        <pubDate>Mon Apr 11, 2005 10:36 pm</pubDate>
                                        <guid isPermaLink="true">http://www.linuxformat.com/forums/viewtopic.php?p=370#370</guid>
                                      </item>
                                      <item>
                                        <title>RE: usb autolaunch</title>
                                        <link>http://www.linuxformat.com/forums/viewtopic.php?p=308#308</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=4'&gt;evilnick&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Mon Apr 11, 2005 12:17 am&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      You can also set up a custom Hotplug script to do this, but udev is better</description>
                                        <comments>http://www.linuxformat.com/forums/viewtopic.php?p=308#308</comments>
                                        <author>evilnick</author>
                                        <pubDate>Mon Apr 11, 2005 12:17 am</pubDate>
                                        <guid isPermaLink="true">http://www.linuxformat.com/forums/viewtopic.php?p=308#308</guid>
                                      </item>
                                      <item>
                                        <title>RE: usb autolaunch</title>
                                        <link>http://www.linuxformat.com/forums/viewtopic.php?p=307#307</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=5'&gt;nelz&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Mon Apr 11, 2005 12:15 am&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      You can do this is you use udev. First set up a rule to give the device a unique, persistent name (see this month's mag for details). Then put a script in /etc/dev.d. the script must have the suffix .dev and could be somethng like&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
if &amp;#91; &amp;quot;$DEVNAME&amp;quot; == &amp;quot;backup&amp;quot; &amp;#93;; then&lt;br /&gt;
&amp;nbsp; &amp;nbsp; tar -cf -. |&amp;#40;cd /media/&amp;lt;usbbdrive&amp;gt;&amp;#58; tar xvf-&amp;#41;&lt;br /&gt;
fi&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;</description>
                                        <comments>http://www.linuxformat.com/forums/viewtopic.php?p=307#307</comments>
                                        <author>nelz</author>
                                        <pubDate>Mon Apr 11, 2005 12:15 am</pubDate>
                                        <guid isPermaLink="true">http://www.linuxformat.com/forums/viewtopic.php?p=307#307</guid>
                                      </item>
                                      <item>
                                        <title>usb autolaunch</title>
                                        <link>http://www.linuxformat.com/forums/viewtopic.php?p=301#301</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=231'&gt;wyliecoyoteuk&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Sun Apr 10, 2005 11:50 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Hi, y`all I`m back!&lt;br /&gt;
The new website is excellent so far, I stopped droppingin because it was soooo slow.&lt;br /&gt;
&lt;br /&gt;
Anyway, is it possible to launch a script when a USB device is connected?&lt;br /&gt;
&lt;br /&gt;
I have an external USB HDD that Suse9.2 recognises and automounts, but I would like to automate backups to it.&lt;br /&gt;
i.e. I would like to run a script like :&lt;br /&gt;
cd /home&lt;br /&gt;
tar -cf  -. |(cd /media/&amp;lt;usbbdrive&amp;gt;: tar xvf-)&lt;br /&gt;
to copy the contents of my home directory when I plug it in to a particular USB port.</description>
                                        <comments>http://www.linuxformat.com/forums/viewtopic.php?p=301#301</comments>
                                        <author>wyliecoyoteuk</author>
                                        <pubDate>Sun Apr 10, 2005 11:50 pm</pubDate>
                                        <guid isPermaLink="true">http://www.linuxformat.com/forums/viewtopic.php?p=301#301</guid>
                                      </item></channel></rss>