2 years later - First I want to say this has been an excellent series. I learned so much and your teaching style and pacing are perfect. If I were to change one (or add) one thing, it would be to assign a problem/exercise after each new concept, each exercise building upon what's been learned up to that point. Example: _Create a script that does x. Now create a script that does xy. Now create a script that does xyz._ I've found information sticks a lot better when you're forced to exercise your brain to solve a problem rather than just playing around with commands. Again, thanks. This course has been great.
In implementing this script, some will notice that incremental backups start to become recursive, i.e. the files in the dated folders will be created one inside the other in a recursive pattern, which is not what we want. I was utterly confused by this until I found this sentence in the manual: > Note that if you specify a relative path, the backup directory will be relative to the destination directory, so you probably want to specify either an absolute path or a path that starts with "../". If an rsync daemon is the receiver, the backup dir cannot go outside the module's path hierarchy, so take extra care not to delete it or copy into it. which then made total perfect sense
Great series, I did a couple of Udemy classes for this. But I liked the way you broke down each line and explained it. Making it simple is the hardest job for a teacher. You nailed it!! Thank you.
Thanks jay. This is a well put together series. I learned Python about 1 year ago and now I can see why Bash is powerful while needing to script in the Linux environment.
Same! Somehow I was bothered by Python and it did not excite me, even though the syntax is fairly simple, but once things get complicated, I just couldn't get myself to write in Python 😂. Bash on the other hand is smooth, fun, and I easily understand even the complex scripting.
Great series - thanks Jay 👍 An extra test you could include in the backup script is the validity of the directory being backed up in $1 i.e. bomb out with a exit code in case the input directory doesn't exist.
Great stuff Jay! I would like for you to include storing the backups remotely; I have succeeded in doing this but had some difficulty. Also, it seems that rsync will only process files that the user owns - maybe that goes without saying.
*rsync -b and --backup-dir flags* (6:03) . . . Cool! Thank you, Jay/LLTV 👍 I may update my rsync scripts to use those flags. Kindest regards, neighbours and friends. P.S. The / slash (or no slash) at the end of the destination's directory can be tricky. Your rsync script handles it nicely.
Great lessons. Thank you! I would like to see a bit more lessons with shifting arguments in bash and background jobs. Apart from that I think great idea would be to have some kind of recap video just to refresh your knowledge around bash scripting.
Great series. Unless the "backup" directory exist before running the rsync command, rsyncs call to mkdir fails. It seems mkdir have a problem creating the parent folder "backup" to "current", unless receiving the option "-p".
Thank you so much JAY...I would like to ask the seniors or expersts..after learning to this extent can we apply for a scripting job or what level is this which we can claim?
To apply for a job relevant with scripting, I think you need plenty of examples that you can apply your knowledge to real life scenarios. Create automation scripts and present them on git or maybe write a blog that will present your work. Employers are not interested in which course or training you chose and went through but what you can make out of it and give them a proof.
Possibly naive question, but isn't $(which rsync) interchangeable with rsync? If it's not found in PATH, which rsync shouldn't give anything anyway, right?
Hello! I have a couple of questions, If I may. 1. We turned on the -v option of rsync, but I didn't got any output of the command, neither did you. 2. In the argument to for rsync, we specified the "current_date" variable to name the subfolder of "current" folder, but I think it not did it... I'm sorry, if I'm wrong, feel free to correct me. Great videos though, I've learned and still learning a lot from you! Thanks! P.S. For question 2: I watched the video again and now it makes sense :) Sorry!
Could you, please, explain what does 2>&1 mean? I guess we're redirecting standard error to standard output, but why are we writing it like this? Looks weird. In one of the previous classes of this series you told that we can address both standard error and standard output and send them to the null device like this: if ! command -v rsync >& /dev/null My question is what's the difference? Is my syntax also correct?
Is there any way to return to a particular directory after execution of a perl script? Eg: I am running perl script in bin/a/ directory. After completion of the script ,when returning to terminal it should automatically reach bin/a/b/c/d/ directory
Everything worked, except this backup script - which worked the first time, but kept getting rsync error: error in file IO (code 11) at rsync.c(739) the second time I ran it. Never could figure out what the problem was, but a clue is that, if I touched any file, then the error began (acting like the file is still open?).
Once you follow command touch Picture\theimage.png that you want tell that been modified You need to type: ./backup.sh Pictures/ backup Not : ./backup.sh Pictures/ backup/
I tried to make an rsync backup script previously but couldn't figure out how to exclude all hidden folders/files as nothing worked for me. The reason I don't use it is because it tries to back up all my steam games and every other thing in hidden folders when all I want is to backup my damned home directly that is NOT hidden. So it takes up a lot of space it shouldn't, takes a lot more time to backup, and taxes my system while backing up stuff I don't need backed up. Would be nice to be able to finally figure out how to do a backup, have it compressed (tar.gz) and not include all the hidden files so I could have it scheduled, but until then I manually do my backups.
There is less risk that way, because which command will give you the exact path of the command in your system. In other words, it won't run a different script or command with the same name.
@@LinuxEssentials79 I don't think that this is right. According to the man page of "which" it prints to stdout the full path of the executables that would have been executed when this argument had been entered at the shell prompt. It does this by searching for an executable or script in the directories listed in the environment variable PATH using the same algorithm as bash. So I would agree with Henrique Vitol. P.S. I just tested it: I created a script called /usr/local/bin/rsync and made it executable. "/usr/local/bin" comes before "/usr/bin" in my $PATH. "which rsync" printed "/usr/local/bin/rsync".
@@deprimarvin5382 OK I don't believe that it's so easy to exist so many possibilities e.g. to exist a third-party script with the same name in path included in PATH variable. But if you want to be sure, I believe you can make a control statement in your script to run the specific binary or include always the correct full path of each binary.
"> /dev/null" that redirects standard output to /dev/null (as it doesn't refer 1 or 2, it's going to include only standard output which is the default). "2>&1" this will redirect standard error to be included into standard output, but standard output was redirected to /dev/null. So both (standard output and standard error) redirected to /dev/null, which can be done more clearly by "&> /dev/null", as Jay describes it in Data Streams video in bash scripting series.
2 years later - First I want to say this has been an excellent series. I learned so much and your teaching style and pacing are perfect. If I were to change one (or add) one thing, it would be to assign a problem/exercise after each new concept, each exercise building upon what's been learned up to that point.
Example: _Create a script that does x. Now create a script that does xy. Now create a script that does xyz._
I've found information sticks a lot better when you're forced to exercise your brain to solve a problem rather than just playing around with commands.
Again, thanks. This course has been great.
In implementing this script, some will notice that incremental backups start to become recursive, i.e. the files in the dated folders will be created one inside the other in a recursive pattern, which is not what we want. I was utterly confused by this until I found this sentence in the manual:
> Note that if you specify a relative path, the backup directory will be relative to the destination directory, so you probably want to specify either an absolute path or a path that starts with
"../". If an rsync daemon is the receiver, the backup dir cannot go outside the module's path hierarchy, so take extra care not to delete it or copy into it.
which then made total perfect sense
Great series, I did a couple of Udemy classes for this. But I liked the way you broke down each line and explained it. Making it simple is the hardest job for a teacher. You nailed it!! Thank you.
completed the series. Very well done, and the length of each video made it very easy to find things that I needed to refresh on. Great job and thanks!
Thanks jay. This is a well put together series. I learned Python about 1 year ago and now I can see why Bash is powerful while needing to script in the Linux environment.
Same! Somehow I was bothered by Python and it did not excite me, even though the syntax is fairly simple, but once things get complicated, I just couldn't get myself to write in Python 😂. Bash on the other hand is smooth, fun, and I easily understand even the complex scripting.
With this I have done with linux series, Thank you so much Sir 🙏 Regards from India 🇮🇳.
Great series - thanks Jay 👍
An extra test you could include in the backup script is the validity of the directory being backed up in $1 i.e. bomb out with a exit code in case the input directory doesn't exist.
Thanks
just now i finished the course and it was really really helpful for me i learned a lot about bash scripting
thanks for all the effort and sevrices❤
Thanks!
I have completed the series, it was really helpful. Thanks a lot Jay!
Nice series!! Thank you so much Jat for sharing your knowlogy
Thank you so much, been speed running this and it's been very very helpful !!!
Great stuff Jay! I would like for you to include storing the backups remotely; I have succeeded in doing this but had some difficulty. Also, it seems that rsync will only process files that the user owns - maybe that goes without saying.
*rsync -b and --backup-dir flags* (6:03) . . . Cool! Thank you, Jay/LLTV 👍
I may update my rsync scripts to use those flags.
Kindest regards, neighbours and friends.
P.S. The / slash (or no slash) at the end of the destination's directory can be tricky. Your rsync script handles it nicely.
Thank you for the videos , those are a great source of knowledge
Love these episodes.
Superb tutorial videos. Please continue your great work.
that is a great course , Thank you.
Thanks Jay. You have been very helpful
Excellent series, thanks you so much sir.
thank you very much ! great series :)
Great lessons. Thank you! I would like to see a bit more lessons with shifting arguments in bash and background jobs. Apart from that I think great idea would be to have some kind of recap video just to refresh your knowledge around bash scripting.
Why do you only have 2 dad jokes in your picture folder?
Thank you.
You are great Jay, Thank you
thank you
Up to this point, it was so nice and easy.....😂 Great course though: 10/10. Thanks!
Amazing series
Great video, very informative.
Great series.
Unless the "backup" directory exist before running the rsync command, rsyncs call to mkdir fails. It seems mkdir have a problem creating the parent folder "backup" to "current", unless receiving the option "-p".
Thank you
VERY GOOD! Excellent!!
Very nice guy.
The date is the ISO date format. I wish everyone uses this format for date one day.
👍👍Thanks!
Super great
Thank you so much JAY...I would like to ask the seniors or expersts..after learning to this extent can we apply for a scripting job or what level is this which we can claim?
To apply for a job relevant with scripting, I think you need plenty of examples that you can apply your knowledge to real life scenarios. Create automation scripts and present them on git or maybe write a blog that will present your work. Employers are not interested in which course or training you chose and went through but what you can make out of it and give them a proof.
It would have been great if you had also included the pre requisites for this video or the course video somewhere so I can look them once
ruclips.net/p/PLT98CRl2KxKGj-VKtApD8-zCqSaN2mD4w
Possibly naive question, but isn't $(which rsync) interchangeable with rsync? If it's not found in PATH, which rsync shouldn't give anything anyway, right?
he said it is best practice to include the full path to commands used
A good starting script, would have been helpful to include subdirectories, and append the directory been backed up so /current/pictures etc.
Hello! I have a couple of questions, If I may. 1. We turned on the -v option of rsync, but I didn't got any output of the command, neither did you. 2. In the argument to for rsync, we specified the "current_date" variable to name the subfolder of "current" folder, but I think it not did it... I'm sorry, if I'm wrong, feel free to correct me. Great videos though, I've learned and still learning a lot from you! Thanks!
P.S. For question 2: I watched the video again and now it makes sense :) Sorry!
The output is redirected to a file with the ">>" operator.
Could you, please, explain what does 2>&1 mean? I guess we're redirecting standard error to standard output, but why are we writing it like this? Looks weird. In one of the previous classes of this series you told that we can address both standard error and standard output and send them to the null device like this:
if ! command -v rsync >& /dev/null
My question is what's the difference? Is my syntax also correct?
2>&1 redirects stderr to the same destination as stdout. I hope that helps!
Both methods perform the same thing. It's a matter of preference.
It would be good to add some compression options in here too
Is there any way to return to a particular directory after execution of a perl script?
Eg:
I am running perl script in bin/a/ directory.
After completion of the script ,when returning to terminal it should automatically reach bin/a/b/c/d/ directory
Everything worked, except this backup script - which worked the first time, but kept getting rsync error: error in file IO (code 11) at rsync.c(739) the second time I ran it. Never could figure out what the problem was, but a clue is that, if I touched any file, then the error began (acting like the file is still open?).
Once you follow command touch Picture\theimage.png that you want tell that been modified
You need to type:
./backup.sh Pictures/ backup
Not :
./backup.sh Pictures/ backup/
I tried to make an rsync backup script previously but couldn't figure out how to exclude all hidden folders/files as nothing worked for me. The reason I don't use it is because it tries to back up all my steam games and every other thing in hidden folders when all I want is to backup my damned home directly that is NOT hidden. So it takes up a lot of space it shouldn't, takes a lot more time to backup, and taxes my system while backing up stuff I don't need backed up. Would be nice to be able to finally figure out how to do a backup, have it compressed (tar.gz) and not include all the hidden files so I could have it scheduled, but until then I manually do my backups.
Anyone knows what command -v stands for ?
Verbose
With `$(which rsync)` you still have the same security risk of potentially running a malicious command, right?
There is less risk that way, because which command will give you the exact path of the command in your system. In other words, it won't run a different script or command with the same name.
@@LinuxEssentials79 I don't think that this is right.
According to the man page of "which" it prints to stdout the full path of the executables that would have been executed when this argument had been entered at the shell prompt. It does this by searching for an executable or script in the directories listed in the environment variable PATH using the same algorithm as bash.
So I would agree with Henrique Vitol.
P.S. I just tested it:
I created a script called /usr/local/bin/rsync and made it executable.
"/usr/local/bin" comes before "/usr/bin" in my $PATH.
"which rsync" printed "/usr/local/bin/rsync".
@@deprimarvin5382 OK I don't believe that it's so easy to exist so many possibilities e.g. to exist a third-party script with the same name in path included in PATH variable. But if you want to be sure, I believe you can make a control statement in your script to run the specific binary or include always the correct full path of each binary.
☯🙏
Backup.
%F would be a simple way to get that same date format.
or `date -I`
My bash script created this for u ---> 💋
Any reason for using `> file 2>&1` instead of `&> file` ?
"> /dev/null" that redirects standard output to /dev/null (as it doesn't refer 1 or 2, it's going to include only standard output which is the default). "2>&1" this will redirect standard error to be included into standard output, but standard output was redirected to /dev/null. So both (standard output and standard error) redirected to /dev/null, which can be done more clearly by "&> /dev/null", as Jay describes it in Data Streams video in bash scripting series.
This is the appropriate expression to combine standard output with standard error.
@@LinuxEssentials79 what command -v stands for ?
some not good problems😂😂😂