Unix and Linux are a lot more powerful for automation than people from other operating systems know, that power is under the hood in Macosx (via the BSD Unix foundations) and that power is making its way into Windows in a big way too. Let's take a look at one simple example ...
You might have seen my Python script for creating thumbnails.
What if I wanted to run it continuously?
Well, Linux has an app for that ;)
Create a new file and call it something like "do-thumbs.sh". Add the following to the file then save:
#!/bin/bash
while [ 1 ];
do
python3 thumb.py
sleep 60s
done
Now enter
chmod +x do-thumbs.sh
This will make your Shell Script executable.
Now if you run the script using
./do-thumbs.sh
It will repeat forever!
Sleep
Note we delay with the sleep command so that we are not pounding the machine.
Sleep can take several time delay options - specify the delay in seconds, minutes, hours or days.
s - seconds
m - minutes
h - hours
d - days
Repeat for a Fixed Count Using For Loops
What if you don't want it to loop forever?
Just replace the while line with
for x in {1..10}
You may also use
watch
command.Eg.
watch -n1 date +'%H:%M:%S:%N'
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Beautiful. But maybe it's better to do it in Python?
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
I think it depends how much you will be using built-in linux commands versus coding, either way works :)
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
nice to know :)
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
You got a 2.14% upvote from @postpromoter courtesy of @makerhacks!
Want to promote your posts too? Check out the Steem Bot Tracker website for more info. If you would like to support the development of @postpromoter and the bot tracker please vote for @yabapmatt for witness!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
what fun and interesting this publication. I did not know the options that linux can give us. thank you and keep informing us
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit