 Hey guys, welcome back to Daniel Stark World on Medium, YouTube and at DanielRosal.tech. So what I want to do quickly in today's video is just demonstrate, it might seem obvious, but how to get batch scripting running for yourself on Synology DSM. Now be aware of course that Synology is a Linux based file system but it doesn't have, you don't have the ability to manipulate all the packages and add everything out of the box. So you're limited to what it has there but certainly being able to execute scripts is preferable, I'm going to say preferential, is preferable to having to just type commands. So the default way to run stuff on Synology is going into the main menu, going into control panel and I had to go into advanced mode in order to get the option to use task scheduler. You can see that so I found that kind of weird, I would have thought that's a pretty basic thing on an NES but in any event click on advanced and then you'll see this one called task scheduler. As you can see here I have been keeping myself very busy setting up a bunch of different tasks but basically what you can do is schedule task, user defined script and test script. You don't want to run stuff as root. You want to run it under a user with admin basically. You can do it on a schedule. I made the point here before that the schedule was, is a little bit, I don't know, it's not so extensive. You can do it on certain days of the week in this option. Here you can start day for example and then repeat. I think what I just like about this is that it doesn't replicate a cron job. You don't have, I run to run it every 10 days or every two weeks or the third day skipping. There's lots of things that you can do pretty much everything in cron that this isn't the full option basically. Basically the main thing is you can just do a course, you can just put a command in here that will work perfectly and you can confirm to yourself that you're going to get the emails but it's obviously more powerful if you, if you put in bash scripts basically and you can run them like that. In order to demonstrate this really I've just SSHed into the NAS and the important thing is to pay attention to the path. You can see relative to root. If I actually just drop all the way back to the root of the NAS you can see what it looks like. It's kind of a, it's a Linux file system, Linux based file system but the goodies is all within volume one. That's where, that's where basically you'll find all the storage stuff, all your, all your shared folders. It's going to go into, into one. So what I'm going to, what I will do is go into this demos folder and I'm just going to set this up for this demo. I'm just going to actually get rid of all that and just touch one dot text and two dot text. Now we've got two files, one and two dot txt and I kind of done that in one command. If you go into test two just make sure there's nothing. So the job of this very primitive batch script, this demonstration batch script is just going to be to copy the contents of folder one to folder two. So I just opened the text editor. I just created a very, as I said, this test batch script, copying volume one, demos test one, everything, a while card, everything in there into volume one, volume one, demos test two. So it's just, that should move over just those two test files, saving the script. So what I'm going to, what I'm going to do now is I've created a shared folder here called scripts. I'm just going to drop in the test script so we're able to call it. I checked before doing that that it's got the executable permissions and now we can call that. Now here's, here's the trick, trick of the video, click on properties and you'll be able to just get the path of that script and put that into the scheduler. Going back into task scheduler now, I'm going to go into schedule task, user defined script. It's going to put that in quickly and you're just going to call it test script, test script. User as I said is going to be me. Scheduling, this can be a once off job and I'll repeat, we're just going to run it once anyway and I do want to guess the output and I'll just, this will send me an email basically just confirming that it's been run correctly and it'll more, as importantly it will give me the terminal output as well. So I'm just going to go ahead and click OK on this and we should have the test script. Let me just make sure that this is the one at the very top is the guy I've just created. Indeed it is. I'm just going to go run and this will manually initiate the test scripts. So I mean this is going to take a millisecond to move to TXT files with nothing in them into the right folder. So it's a moment of truth. I've just cleared up here, gone into folder test to LS command and as we can see the two guys have moved in and in test one it is, they're both there because we use CP which copies over. So that's basically it. Not hard. I recommend creating a volume called script just so you know where the scripts are going to be and you can basically then just call that from within the task scheduler and that will allow you to execute your bascripts on schedule using Cron and I'm just going to also quickly copy and I just got that email just to say that it went off as expected. So you just need to configure an email for that to happen as well. Thanks for watching for further videos and information or just to get in touch. Always happy to have people get in touch. Daniel Rosehill with 2Ls.co.al there's a contact form on that website and you can reach me there. Thanks for watching.