Back up any and all usb sticks with udev
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO9GURib1T8z7lCwjOGLQaGtrueEthgQ8LO42ZX8cOfTqDK4jvDDpKkLFwf2J49kYCMNW7d4ABih_XCb_2UXdq5fPJDkoyg7-8g_YfRUot-XnaXkNYycsNp7lA5_TW9td0FFpLQ2APzKcZ/s1600/1.jpg)
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQ0N5W1qAOxLP7t7iOM6O6AzbZnkXUy16s7P_CWfOb5UbTQY_aDsc727chyphenhyphen5W4IppVNernMMQeaUFTB_rFzAd95_CDt-tnwN-nBx6JyUp2duGjPaL5-VgNO41AVsA_vu30EJcipdDG409/s400/Clash+Royale+CLAN+TAG%2523URR8PPP.png)
up vote
4
down vote
favorite
I have home server that I use for back up, Iv recently started using multiple shared (as in new one every few days) usb flash drives for some important files. I want to run a script to copy files only from a certain folder on the flash drive. I thought a udev rule would work great, here was what i wrote
KERNEL=="sd?", SUBSYSTEM=="block", ATTRremovable=="1", RUN+="/home/ketterer/usb_mount.sh '%EID_FS_LABEL'"
Then just for testing I wrote this script
#!/bin/bash
LABLE=$1
echo "lable is $LABLE" >> /home/ketterer/prooffile
sleep 15
touch /media/ketterer/$LABLE/test
The idea is that the usb flash drive mounts under ketterer as the label, so i pass the lable to the script and then I can manipulate it, but saddly it doesnt pass the label to the script.
any Ideas?
As funny as it is, I had it work once, I changed KERNEL=="sd?", to KERNEL=="sd?1", this made it work, but only one time and then it would not even do the script after that
usb-drive udev
add a comment |Â
up vote
4
down vote
favorite
I have home server that I use for back up, Iv recently started using multiple shared (as in new one every few days) usb flash drives for some important files. I want to run a script to copy files only from a certain folder on the flash drive. I thought a udev rule would work great, here was what i wrote
KERNEL=="sd?", SUBSYSTEM=="block", ATTRremovable=="1", RUN+="/home/ketterer/usb_mount.sh '%EID_FS_LABEL'"
Then just for testing I wrote this script
#!/bin/bash
LABLE=$1
echo "lable is $LABLE" >> /home/ketterer/prooffile
sleep 15
touch /media/ketterer/$LABLE/test
The idea is that the usb flash drive mounts under ketterer as the label, so i pass the lable to the script and then I can manipulate it, but saddly it doesnt pass the label to the script.
any Ideas?
As funny as it is, I had it work once, I changed KERNEL=="sd?", to KERNEL=="sd?1", this made it work, but only one time and then it would not even do the script after that
usb-drive udev
Have you checked that the folder exists? Maybe you should call/bin/mkdir -p /media/ketterer/$LABLE
before trying to touch the filetest
â Katu
Apr 10 at 10:53
add a comment |Â
up vote
4
down vote
favorite
up vote
4
down vote
favorite
I have home server that I use for back up, Iv recently started using multiple shared (as in new one every few days) usb flash drives for some important files. I want to run a script to copy files only from a certain folder on the flash drive. I thought a udev rule would work great, here was what i wrote
KERNEL=="sd?", SUBSYSTEM=="block", ATTRremovable=="1", RUN+="/home/ketterer/usb_mount.sh '%EID_FS_LABEL'"
Then just for testing I wrote this script
#!/bin/bash
LABLE=$1
echo "lable is $LABLE" >> /home/ketterer/prooffile
sleep 15
touch /media/ketterer/$LABLE/test
The idea is that the usb flash drive mounts under ketterer as the label, so i pass the lable to the script and then I can manipulate it, but saddly it doesnt pass the label to the script.
any Ideas?
As funny as it is, I had it work once, I changed KERNEL=="sd?", to KERNEL=="sd?1", this made it work, but only one time and then it would not even do the script after that
usb-drive udev
I have home server that I use for back up, Iv recently started using multiple shared (as in new one every few days) usb flash drives for some important files. I want to run a script to copy files only from a certain folder on the flash drive. I thought a udev rule would work great, here was what i wrote
KERNEL=="sd?", SUBSYSTEM=="block", ATTRremovable=="1", RUN+="/home/ketterer/usb_mount.sh '%EID_FS_LABEL'"
Then just for testing I wrote this script
#!/bin/bash
LABLE=$1
echo "lable is $LABLE" >> /home/ketterer/prooffile
sleep 15
touch /media/ketterer/$LABLE/test
The idea is that the usb flash drive mounts under ketterer as the label, so i pass the lable to the script and then I can manipulate it, but saddly it doesnt pass the label to the script.
any Ideas?
As funny as it is, I had it work once, I changed KERNEL=="sd?", to KERNEL=="sd?1", this made it work, but only one time and then it would not even do the script after that
usb-drive udev
usb-drive udev
edited Apr 10 at 18:51
qbi
14.7k860117
14.7k860117
asked Apr 9 at 3:48
Jordan Ketterer
10115
10115
Have you checked that the folder exists? Maybe you should call/bin/mkdir -p /media/ketterer/$LABLE
before trying to touch the filetest
â Katu
Apr 10 at 10:53
add a comment |Â
Have you checked that the folder exists? Maybe you should call/bin/mkdir -p /media/ketterer/$LABLE
before trying to touch the filetest
â Katu
Apr 10 at 10:53
Have you checked that the folder exists? Maybe you should call
/bin/mkdir -p /media/ketterer/$LABLE
before trying to touch the file test
â Katu
Apr 10 at 10:53
Have you checked that the folder exists? Maybe you should call
/bin/mkdir -p /media/ketterer/$LABLE
before trying to touch the file test
â Katu
Apr 10 at 10:53
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1023210%2fback-up-any-and-all-usb-sticks-with-udev%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Have you checked that the folder exists? Maybe you should call
/bin/mkdir -p /media/ketterer/$LABLE
before trying to touch the filetest
â Katu
Apr 10 at 10:53