You are not logged in.
Pages: 1
Hi everyone! Hope you're all having a nice life! ![]()
I wrote a very simple script to copy files from one dir into another one, I want to create a cronjob so it runs once a week - on Sundays - but I'm not sure whether if it's correct or not. Can you take a look and tell me so?
this is the cronjob:
0 1 * 1-12 SUN /home/myusername/dir/cp.sh
or
0 1 * 1-12 SUN /bin/bash /home/myusername/dir/cp.sh
I've read quite a few posts from here as well as over the web but I'm still confused. Thanks in advance for your answers.
Last edited by Moltke (2018-09-18 23:52:08)
Judges have decimated, meanings of our laws, already guilt? something has a flow, wrongly accused, blindly confused, open your eyes, wake up realize!
Offline
Looks okay I guess, but why not wildcard the 1-12 months too?
Anyway, you don't need /bin/bash if the script itself is executable and has a #!/bin/bash shebang.
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline
Looks okay I guess, but why not wildcard the 1-12 months too?
Anyway, you don't need /bin/bash if the script itself is executable and has a #!/bin/bash shebang.
So, just to be perfectly clear, would this 0 1 * * SUN /home/myusername/dir/cp.sh be ok and would have the same effect as 0 1 * 1-12 SUN /home/myusername/dir/cp.sh? And yes, you're right. Script has a #!/bin/bash shebang and it's exceutable.
Thanks for your answer!
Judges have decimated, meanings of our laws, already guilt? something has a flow, wrongly accused, blindly confused, open your eyes, wake up realize!
Offline
If you use `crontab -e` to edit your cron files, crond will syntax check the file before saving it.... Thereby avoiding you having to wait for the community to tell you.
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
If you use `crontab -e` to edit your cron files, crond will syntax check the file before saving it.... Thereby avoiding you having to wait for the community to tell you.
Good to know! I've already succesfully created the cronjob
It's a very simple task. I used this site https://crontab.guru/ which I read was useful when it comes to using cron and indeed it is. Thanks for your answer!
Judges have decimated, meanings of our laws, already guilt? something has a flow, wrongly accused, blindly confused, open your eyes, wake up realize!
Offline
Pages: 1