Paul Sutton

Schedule

Bash scripting 21 – cron

One of the important things you need to do as a system admin is run tasks that perform specific tasks on the system. This is fine when you are sitting in front of the computer, or logged in remotely, but what happens if you need to run a task when you are not there, or you just want to automate the running of these tasks.

You can schedule tasks using the cron command. There is an easy-to-use tutorial for this at [1]. I am not going to reproduce this here, but may include some of my own specific use cases in a later post.

According to [1] the following

*/5  * * * * /home/paul/crontest.sh

runs every 5 minutes, where as

*/10  * * * * /home/paul/crontest.sh

So putting ls -l in crontest.sh will run that command every 5 or 10 minutes.

However, I am logged into my pi (where I am running this) so the script will run, but I don't see any output.

If I add in ls -l > dirlist.txt

It will produce a directory listing text file when run, by running ls manually you can see it in the listing.

I have a post on Ansiweather scheduled fora few days, in the meantime

putting this in the crontest.sh file

echo $(date), $(ansiweather -l Paignton -a false) >> weather.csv

It will run at the specified time and append the information to weather.csv which could be a good way to monitor weather over time.

This can be examined with

cat weather.csv 

if you use the watch command

watch cat weather.csv

the contents of weather.csv will be displayed and updated in real time as the file is appended with new information.

References

  1. https://stackoverflow.com/questions/12786410/run-cron-job-every-n-minutes-plus-offset

Tags

#Bash,#Bashscripting,#Task,#Schedule,#cron,#crontab,#Admin, #Automation


Mastodon ShellLabs Join Mastodon
AI statement : Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity. Consent CANNOT be assumed, it has to be granted.

Donate using Liberapay

Confy – Conferences schedule viewer

This was mentioned at the South Devon Tech Jam in May 2021, so thank you to Seabass for this. It is a conference schedule viewer, has been used as events such as Fosdem, so looks really good. I think Noisytoot was trying to compile this, so hopefully get an update over the next month and perhaps at the next Jam on June 12th. Or perhaps next week at the DCGLUG meet, Saturday 15th May 2021 @ 12:00 on jit.si.

I am also at a Debian Conference 2021 planning meeting on Monday 10th May, so will give this a mention too. Could be useful.

REFERENCES

TAGS

#FreeSoftware,#Conference,#Schedule,#Viewer,#Gtk3, #libhandy,#Python3,#python-gobjects,#Meson,#Ninja

Donate using Liberapay

Creative Commons Licence
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License


Mastodon ShellLabs Join Mastodon
AI statement : Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity. Consent CANNOT be assumed, it has to be granted.

Donate using Liberapay

LibrePlanet 2021 – Schedule

March 20th & 21 2021

The Libreplanet schedule has now been released and can be found here

TAGS

#LibrePlanet,#FSF,#FreeSoftware,#Conference,#Virtual, #Talks,#Workshop,#Help,#Advocacy,#Schedule

Creative Commons Licence
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License


Mastodon ShellLabs Join Mastodon
AI statement : Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity. Consent CANNOT be assumed, it has to be granted.

Donate using Liberapay