Linux Tip | How To Automate Tasks using Cron

  Рет қаралды 48,984

Joe Collins

Joe Collins

Күн бұрын

A look at the Cron utility and how you can use it to automate commands.
Check out www.ezeelinux.com for more about Linux.
To learn more about cron on Ubuntu:
help.ubuntu.com/community/Cro...

Пікірлер: 50
@plutesknee5129
@plutesknee5129 5 жыл бұрын
Some people are just amazing teachers, but you are one of the best! thankyou for you videos Joe.
@user-ts2wi7cq1n
@user-ts2wi7cq1n 10 ай бұрын
Automation ensures that tasks are executed uniformly across different systems and environments, promoting consistency and standardization. This is crucial for compliance, security, and troubleshooting.
@notes_at_dusk
@notes_at_dusk 5 жыл бұрын
I love your chilled-out style of tuition - keep it up!
@djsensacion7
@djsensacion7 8 жыл бұрын
What a treat, Cron Jobs and Bash scripting all in one video ! I see you have syntax coloring in your nano editor...
@Phoenixts
@Phoenixts 8 жыл бұрын
Thanks for the great video. We shared it on our blog as a good way for readers to learn about cron and automation.
@EzeeLinux
@EzeeLinux 8 жыл бұрын
+Phoenix TS Thank you very much! :)
@webhunter2989
@webhunter2989 6 жыл бұрын
Your efforts are appreciated man
@pewlivepie5006
@pewlivepie5006 8 жыл бұрын
Thanks for the videos Joe. Very useful!
@hh3130
@hh3130 8 жыл бұрын
Thanks for the great video. Very useful information.
@cthedosboss5113
@cthedosboss5113 6 жыл бұрын
we need more people like you sir :)
@cbrash9
@cbrash9 8 жыл бұрын
Great Video, very informative !!
@MasterArtMason
@MasterArtMason 4 жыл бұрын
Fantastic Joe! Thank you!
@cbrash9
@cbrash9 8 жыл бұрын
A while ago I had my son using Manjaro, however being a rolling release he was not consistently updating which was concerning for me, so I switched him to Mint. Having watched this video I can see a huge advantage in using Cron to update any rolling release distro!!
@EzeeLinux
@EzeeLinux 8 жыл бұрын
+Colin Brash You could do that for sure. :)
@EzeeLinux
@EzeeLinux 8 жыл бұрын
+Colin Brash One more thought, the only problem I could foresee with setting auto updates up for Manjaro would be when it asks for confirmation to build updates from the AUR. It usually needs you to put your password in for that. Something to ponder. :)
@cbrash9
@cbrash9 8 жыл бұрын
Yes good point!, I suppose that means the update would just fail?, and need to be done manually, that's acceptable, I may install arch with Architect linux on a separate hard drive and give it a try,I enjoy messing with installs :)
@cbrash9
@cbrash9 8 жыл бұрын
I was also watching your CinnUbu vids, have you ever considered Architect linux for a minimal install for Cinnamon? have not been subscribed to your channel for long, but I'm thinking your base maybe Ubuntu and Mint which stands to reason for keeping it simple and stable.
@ayoob999
@ayoob999 7 жыл бұрын
excellent video ..and very useful.... .thanks
@JPRuehmann
@JPRuehmann 7 жыл бұрын
You should put an exit 0 at the end of your Scripts to gracefully close them.
@VidShoe13
@VidShoe13 6 жыл бұрын
You're a legend!!
@JPRuehmann
@JPRuehmann 7 жыл бұрын
Commands that run via skript on Cron did not have to run in the Background. They do it anyways at runtime. This only make it difficult to debug the script and to control the execution including clean up.
@onesandzeroes
@onesandzeroes 8 жыл бұрын
I tried to use the command "nmcli radio wifi off" in gnome-schedule, but it doesn't have any effect (it works fine in the terminal). I outputted it to a file, but it doesn't show any errors. The command also fails to work when I manually add a crontab. Other commands such as "ls > file" do work.
@tpasi2020UG
@tpasi2020UG 3 жыл бұрын
Just amazing!
@dedelifestyles7836
@dedelifestyles7836 6 жыл бұрын
Very informative
@50_Pence
@50_Pence 6 жыл бұрын
to add a date to that log add: date -R >> /home/joe/update.log
@mr_fallout3169
@mr_fallout3169 7 жыл бұрын
Really good
@bennasrghazi9323
@bennasrghazi9323 2 жыл бұрын
I m a complete beginner... I have an error message telling me that (chmod :impossible d accéder a 'update. Sh' there s no file or directory.... I have written the file with sh extension using nano....
@jamesbaxter2812
@jamesbaxter2812 Жыл бұрын
As I am watching you with Cron. I have a problem. I am using Linux Mint. across the top there is GNU NANO 4.8 you are showing the same thing but the number are differance. GNU as I know, stands for Gnucash. that is for keeking your bank account working. Also if you have stock/ticker in the same program. the help in the Gnucash is talking about the Cron. and I have to have an address for the Cron to go to as what you are saying. The Gnucash program is to take to a web site (not known to me) to where it gets updates. so if you understand, can you help me with this. Thanks
@VictorGallagherCarvings
@VictorGallagherCarvings 6 жыл бұрын
It looks like gnome-schedule is no longer in the Ubuntu repositories.
@spencerreppe7558
@spencerreppe7558 4 жыл бұрын
ok thanks I trying installing it, I got the "E: Unable to locate package gnome-schedule"
@kellingc
@kellingc 3 жыл бұрын
I always have stderr append to the log files that I create. So, the apt-get command you had would look something like: apt-get dist-upgrade -y >> /home/joe/update.log 2>> /home/joe/update.log && This is a little more informative than just appending "All done". There isn't any reason why you can't point the error output to it's own file, either. That way, when you do an ls on your home directory, you can tell if there is an error or not without having to cat the log file. There are other things I do (like put the date in the file name) to allow for better troubleshooting, but this is a video about cron, not scripting. I won't go into a huge thing about logs , file naming, etc. I just wanted to let people know how to capture an error when running scripts and automated jobs.
@Khyree_Holmes
@Khyree_Holmes 8 жыл бұрын
What can I do with Cron Jobs? hmm.... i don't know.
@sablesanctum
@sablesanctum 7 жыл бұрын
So... Since the cron job was made by root it's not going to ask for the password before running the script? It will all just run transparently in the background. Is that a correct assessment?
@EzeeLinux
@EzeeLinux 7 жыл бұрын
Yes. Cron runs as root. :)
@Ryan-vw8sq
@Ryan-vw8sq 8 жыл бұрын
Hello, what is the "-e" after crontab for?
@ngomapa
@ngomapa 7 жыл бұрын
'e' is an option to edit. it will open an editor where you can manually schedule your task
@df3yt
@df3yt 8 жыл бұрын
when does weekly run? if my pc is on on Monday off for a couple days and then on for a couple when will it run...?
@EzeeLinux
@EzeeLinux 8 жыл бұрын
+df3yt Not sure... If you have something critical that absolutely has to run weekly I'd set it manually for a specific time or run it manually. :)
@NicolaFrancica
@NicolaFrancica 8 жыл бұрын
+df3yt Use anacrontab to avoid this kind of problems, Cron is more usefull for servers that are up and running all the time. Anacron does the same job but avoid the "system off" problem executing the 1st time it can after the supposed time you scheduled the task at. Google it for more infos :) P.S. Sorry for my english, I don't use it much, I'm a little bit rusted
@Classic.Car.Restorations.
@Classic.Car.Restorations. 7 жыл бұрын
16.04 does not incude this gnome-schedule I found a deb file here askubuntu.com/questions/785657/i-cant-install-gnome-schedule-on-ubuntu-16-04
@hkme4525
@hkme4525 7 жыл бұрын
what if i want to run a task every time my computer reboots ???
@spectralberserker
@spectralberserker 7 жыл бұрын
you use a different script system like "rc.local" for example askubuntu.com/questions/9853/how-can-i-make-rc-local-run-on-startup
@SotoJeleb
@SotoJeleb 8 жыл бұрын
What hapens if youre computer is off when it is suposed to run a comand/script? If it skips the comand can you set it up that it runs the comand when you boot next time. p.s. Awesome chanel!
@EzeeLinux
@EzeeLinux 8 жыл бұрын
+SotoJeleb As far as I know, the system will just skip that cron job if it is not up and running at the appointed time. Pick times when you know the system will be up and running or just do it manually. Cron was designed for servers and mini computers that run all the time. :)
@cl9826
@cl9826 7 жыл бұрын
Use anacron in that case. Anacron is cron for desktops and laptops. That is, it doesn't expect the system to be on 24/7 and will run the command on next boot if it misses the scheduled backup time.
@nloomans
@nloomans 8 жыл бұрын
why did you use `more` instead of `less`?
@ironnerd2511
@ironnerd2511 4 жыл бұрын
He mentioned in other videos that he may use more if the text file is small enough so no scrolling is necessary (expected to fit in one screen). And maybe more being older than less, for backwards compatibility. ¿Perhaps? My guess...
@MO-hq4iz
@MO-hq4iz 8 жыл бұрын
Sunday is zero in the USA, not in is most of Europe. We have Monday as zero.
Linux Tip | How to Customize Your BASH Environment
35:31
Joe Collins
Рет қаралды 78 М.
Linux Tip | 10 Useful Linux Commands
34:35
Joe Collins
Рет қаралды 662 М.
What it feels like cleaning up after a toddler.
00:40
Daniel LaBelle
Рет қаралды 82 МЛН
A little girl was shy at her first ballet lesson #shorts
00:35
Fabiosa Animated
Рет қаралды 14 МЛН
Red❤️+Green💚=
00:38
ISSEI / いっせい
Рет қаралды 84 МЛН
Linux Crash Course - Scheduling Tasks with Cron
19:25
Learn Linux TV
Рет қаралды 104 М.
Linux Tip | Moving to a New /home
30:35
Joe Collins
Рет қаралды 29 М.
Learning Awk Is Essential For Linux Users
20:02
DistroTube
Рет қаралды 291 М.
Vim Tips I Wish I Knew Earlier
23:00
Sebastian Daschner
Рет қаралды 46 М.
Useful Linux Applications | What You'll Need To Get Things Done
34:33
Anti-Virus and Firewall Software for Linux
26:12
Joe Collins
Рет қаралды 111 М.
18 Commands That Will Change The Way You Use Linux Forever
29:50
Akamai Developer
Рет қаралды 1,2 МЛН
Syncthing Made EASY
28:30
Tech Craft
Рет қаралды 142 М.
Nature's Incredible ROTATING MOTOR (It’s Electric!) - Smarter Every Day 300
29:37
Молилась за сына🙏
0:25
НАИЗНАНКУ
Рет қаралды 3,6 МЛН
Опасность фирменной зарядки Apple
0:57
SuperCrastan
Рет қаралды 10 МЛН
Quem vai assustar mais meninos ou meninas?!😱 #shorts #challenge
0:10
Gabrielmiranda_ofc
Рет қаралды 42 МЛН
😳 Это ПРЕВРАЩАЕТ всё в ПИЦЦУ !
0:28
Настя, это где?
Рет қаралды 2 МЛН
🎀 strong challenge with @RezoHulk #challenge #funny #foryou #gym
0:30