Get your computer to remind you to go to sleep (Mac or Linux)

in sleep •  7 years ago 

Whether you’re a workaholic, a binge watcher or just the average internet user, chances are you often get sucked in your computer screen so badly that you forget it’s past your bedtime. And you should respect your bedtime.

Here’s a fun solution that will at least make you smile for a couple of weeks (and probably impress your lover).

A MACHINE THAT SPEAKS!?

Getting a computer to say whatever you want is funny. Even as an adult in 2018. Trust me. Let's fire up Terminal to get going.

spaceBarTrick.gif
Terminal is under "/Applications/Utilities", but cool kids don't use their mouse to open an app.

Start by typing the following and then pressing enter (in Terminal).

say You should tip this author.

Did your computer just suggest you tip me? It should've. Because it's a nice computer.

If you want more voices (a voice that speaks your native language, for instance) check out this little guide by Apple.

Next step is to get your computer to say the thing you want it to say at the right time.

INTRODUCING CRONJOBS

Put simply, a cronjob is something your computer will do at a given time and they're easy to set up.

First, we need to open the file which contains your cronjobs. Let's do that with everybody's favorite text editor: Nano. Just copy paste the following line in Terminal.

env EDITOR=nano crontab -e

This will bring you here:

nano.png

... Or to a blank file since you probably don't have any cronjob set up. Let's set those up!

This image right here explains very well how the syntax of a cron job works. I took it from this neat article by Ole Michelsen.

CronJobexplained.png

In the example above, I'm telling my computer "Hey, machine. Everyday at 11:01 PM, use Audrey's voice to say "whatever is in those quotes"".

What about MAILTO=""? Great question. By default, terminal wants to send a daily report of his cronjobs via email. Thanks, but no thanks, Terminal. MAILTO="" solves the problem. It's not mandatory, but do it.

All that's left to do is save: ctrl + x to quit and then y to save.

savechanges.png

You can list your active cronJobs with this command

crontab -l

To make real sure you got everything right, you can set your cron job to be triggered in the next minute and giggle at your speaking computer like it's 1999.

And that's it! Next time you find yourself looking at deep sea animals when you need to wake up in less than 8 hours, your friendly cronjob will remind you that it's time for bed and you will take the right decision. You're welcome.

Get creative with this and share your modifications in the comments!

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Congratulations @feldev! You received a personal award!

1 Year on Steemit

Click here to view your Board

Support SteemitBoard's project! Vote for its witness and get one more award!

Congratulations @feldev! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!