How to write shell script to execute rsync each time I plug in my external ssd?How to execute a shellscript...
Any advice on creating fictional locations in real places when writing historical fiction?
In general, would I need to season a meat when making a sauce?
What are the mechanical differences between the uncommon Medallion of Thoughts and the rare Potion of Mind Reading?
Why didn't Thanos use the Time Stone to stop the Avengers' plan?
Statue View: Tetrominoes
Compaq Portable vs IBM 5155 Portable PC
Looking for a soft substance that doesn't dissolve underwater
what kind of chord progession is this?
Externally monitoring CPU/SSD activity without software access
Boss wants me to falsify a report. How should I document this unethical demand?
using Leibniz rule to solve definite integral
Count rotary dial pulses in a phone number (including letters)
How to Pin Point Large File eating space in Fedora 18
Where is the logic in castrating fighters?
Inconsistent results from Wolfram Could
Is the Indo-European language family made up?
Is it possible to play as a necromancer skeleton?
Do photons bend spacetime or not?
Why does Mjolnir fall down in Age of Ultron but not in Endgame?
How to illustrate the Mean Value theorem?
Did 20% of US soldiers in Vietnam use heroin, 95% of whom quit afterwards?
What are the real benefits of using Salesforce DX?
C++ forcing function parameter evalution order
Where can I find visible/radio telescopic observations of the center of the Milky Way galaxy?
How to write shell script to execute rsync each time I plug in my external ssd?
How to execute a shellscript when I plug-in a USB-deviceHow to execute a shellscript when I plug-in a USB-deviceExecuting backup script on external HDD plug using udevWrite permissions inside shell scriptrsync over ssh without typing the password each timeUsing a shell script with jstest, how can I get a gamepad to interact with my script?rsync gives an error in shell scriptRunning script through udev rule on Chrome OSExecute script on external keyboard connectionDynamic Drive HotSwappingUdev Rules Not Running
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I want to execute rsync command which syncs my local directory with the external ssd. I followed the instructions given in this link. to execute some command based on udev rules. This shows how to run the command for specific udb drive based on idVendor and idProduct. Here is the command I have in my /etc/udev/rules.d/test.rules:
ATTRS{idVendor}=="0781", ATTRS{idProduct}=="558c", RUN+="/temp/auto_back.sh"
and in /tmp/auto_back.sh
I just have
#!/bin/bash
# auto backup command
rsync -avzh /home/abhishek/Dropbox /media/abhishek/Hachiko
I don't have much insight about this. I just thought it might work. But it doesn't. I read that sometimes the command gets executed before the drive is even mounted. Can you give me some insight on what I am doing wrong, and how this thing works? Also, is there any way to make the command in script to wait for some time before it executes?
linux bash shell-script rsync udev
New contributor
add a comment |
I want to execute rsync command which syncs my local directory with the external ssd. I followed the instructions given in this link. to execute some command based on udev rules. This shows how to run the command for specific udb drive based on idVendor and idProduct. Here is the command I have in my /etc/udev/rules.d/test.rules:
ATTRS{idVendor}=="0781", ATTRS{idProduct}=="558c", RUN+="/temp/auto_back.sh"
and in /tmp/auto_back.sh
I just have
#!/bin/bash
# auto backup command
rsync -avzh /home/abhishek/Dropbox /media/abhishek/Hachiko
I don't have much insight about this. I just thought it might work. But it doesn't. I read that sometimes the command gets executed before the drive is even mounted. Can you give me some insight on what I am doing wrong, and how this thing works? Also, is there any way to make the command in script to wait for some time before it executes?
linux bash shell-script rsync udev
New contributor
add a comment |
I want to execute rsync command which syncs my local directory with the external ssd. I followed the instructions given in this link. to execute some command based on udev rules. This shows how to run the command for specific udb drive based on idVendor and idProduct. Here is the command I have in my /etc/udev/rules.d/test.rules:
ATTRS{idVendor}=="0781", ATTRS{idProduct}=="558c", RUN+="/temp/auto_back.sh"
and in /tmp/auto_back.sh
I just have
#!/bin/bash
# auto backup command
rsync -avzh /home/abhishek/Dropbox /media/abhishek/Hachiko
I don't have much insight about this. I just thought it might work. But it doesn't. I read that sometimes the command gets executed before the drive is even mounted. Can you give me some insight on what I am doing wrong, and how this thing works? Also, is there any way to make the command in script to wait for some time before it executes?
linux bash shell-script rsync udev
New contributor
I want to execute rsync command which syncs my local directory with the external ssd. I followed the instructions given in this link. to execute some command based on udev rules. This shows how to run the command for specific udb drive based on idVendor and idProduct. Here is the command I have in my /etc/udev/rules.d/test.rules:
ATTRS{idVendor}=="0781", ATTRS{idProduct}=="558c", RUN+="/temp/auto_back.sh"
and in /tmp/auto_back.sh
I just have
#!/bin/bash
# auto backup command
rsync -avzh /home/abhishek/Dropbox /media/abhishek/Hachiko
I don't have much insight about this. I just thought it might work. But it doesn't. I read that sometimes the command gets executed before the drive is even mounted. Can you give me some insight on what I am doing wrong, and how this thing works? Also, is there any way to make the command in script to wait for some time before it executes?
linux bash shell-script rsync udev
linux bash shell-script rsync udev
New contributor
New contributor
edited 25 mins ago
Jeff Schaller♦
45.8k1165150
45.8k1165150
New contributor
asked 40 mins ago
Abhishek AnandAbhishek Anand
11
11
New contributor
New contributor
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Abhishek Anand is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f520981%2fhow-to-write-shell-script-to-execute-rsync-each-time-i-plug-in-my-external-ssd%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Abhishek Anand is a new contributor. Be nice, and check out our Code of Conduct.
Abhishek Anand is a new contributor. Be nice, and check out our Code of Conduct.
Abhishek Anand is a new contributor. Be nice, and check out our Code of Conduct.
Abhishek Anand is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f520981%2fhow-to-write-shell-script-to-execute-rsync-each-time-i-plug-in-my-external-ssd%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
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
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown