Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

A 'Go to work!' reminder script UNIX
Ok so I wake up and hop right on my mac...I'm sure you are all the same...but I felt a need to have a daily reminder that it's time to leave for work. I launch this shell script from a cron job at my desired departure time:
#!/bin/bash
hour=`date | awk {'print $4'} | cut -d":" -f1`
min=`date | awk {'print $4'} | cut -d":" -f2`

if [ $hour -gt 12 ]; then
    say -v Fred `expr $hour - 12`
else
    say -v Victoria $hour
fi
say -v Victoria $min
say -v Victoria "time to go to work"
exit
Remember to make it executable (chmod 755 script_name)...

[robg adds: Speaking of which, it's about time for me to go to work!]
    •    
  • Currently 2.67 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (3 votes cast)
 
[8,007 views]  

A 'Go to work!' reminder script | 17 comments | Create New Account
Click here to return to the 'A 'Go to work!' reminder script' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Problem sending large group e-mails
Authored by: bwelch on Mar 12, '04 11:20:00AM

Is there a limit to the number of addresses you can include for a group-send message? When I try to send a large (50-plus) message, nothing happens.

Thanks.



[ Reply to This | # ]
simplify using the at facility
Authored by: mervTormel on Mar 12, '04 12:07:17PM
$ echo '/usr/bin/say "get out"' | at 0900

[ Reply to This | # ]
simplify using the at facility
Authored by: hopthrisC on Mar 12, '04 01:31:24PM
You can simplify the shell script itsel (somewhat...)
#!/bin/bash
date "+%I %M %p. get to work" |say -v Victoria
or the non-US version:
#!/bin/bash
date "+%H %M. get to work" |say -v Victoria
Tip 1: The options for the format string of date are listed in the strftime(3) man page (for which you have to install Developer Tools) Tip 2: No need to exit at the end of a shell script! It will exit with the return code of the last command executed.

[ Reply to This | # ]
Or in Jaguar ...
Authored by: mshmgi on Mar 12, '04 04:21:24PM

osascript -e 'say "Time to go to work."'

I must be the oldball here. I actually have a cron job that reminds me that it's time to go home (from work) :)



[ Reply to This | # ]
At facility disabled
Authored by: PeteVerdon on May 15, '04 02:10:00PM

From the at(1) man page on 10.3.3:

NOTE
at, batch, atq, atrm are all disabled by default on Mac OS X. Each of
these commands depend on the execution of atrun(8) which has been
disabled due to power management concerns. Those who would like to
use these commands, must first re-enable /usr/libexec/atrun
<followed by instructions to do that>

I didn't fancy reenabling it just for this little hack.



[ Reply to This | # ]
A 'Go to work!' reminder script
Authored by: Graff on Mar 12, '04 01:24:07PM

Why not just make an event in iCal that puts up a message and plays a sound when you should leave? Make one for each day of the week that you work and then set them all to repeat weekly. Then you will have an alarm that pops up every day. This alarm will pop up even if you don't have iCal running.

If you want it to say stuff then just make an AppleScript applet with the following script:

say "Time to go to work!" using Victoria

Then set the alarm to open this file.



[ Reply to This | # ]
A 'Go to work!' reminder script
Authored by: bithalver on Mar 12, '04 01:48:53PM
Yeah,

You have never seen any kind of Unix, haven't you ?!?
min=`date | awk {'print $4'} | cut -d":" -f2`
hour=`date | awk {'print $4'} | cut -d":" -f1`
looks really awful to any Unix geek. If you want to get the hours and minutes with date, use
min=`date +%M`
hour=`date +%H`
instead.

[ Reply to This | # ]
A 'Go to work!' reminder script
Authored by: macubergeek on Mar 12, '04 07:34:39PM

there's more than one way to do anything ;-)



[ Reply to This | # ]
A 'Go to work!' reminder script
Authored by: Auricchio on Mar 12, '04 07:17:52PM
Why not simply do:

% leave HHMM

It's already there, so just use the existing program!

---
EMOJO: mojo no longer workin'

[ Reply to This | # ]

A 'Go to work!' reminder script
Authored by: macubergeek on Mar 12, '04 07:39:48PM

yeh fine if you happen to be in a terminal session when leave fires off.



[ Reply to This | # ]
A 'Go to work!' reminder script
Authored by: gorkonapple on Mar 12, '04 11:34:54PM

chmod +x filename

This would make it executable and loose one key stroke. I also like 700 (prevents anyone but me using the script).



[ Reply to This | # ]
A 'Go to work!' reminder script
Authored by: phil4u2 on Mar 14, '04 08:00:12AM

stupid question... (or newbie question...)

Now that I got the script, let's say in my home dir...

How do I make it a cron job to be executed every day at, let's say 11.55 am?



[ Reply to This | # ]
A 'Go to work!' reminder script
Authored by: encro on Mar 14, '04 10:41:15AM
To open up your crontab type:
crontab -e
and insert the following text:

#minute   hour   mday   month   wday   command
 55       11     *      *       *      osascript -e 'say "Time to go to work"'

You can replace the osascript command with ~/yourscriptname if you like.

Cheers

[ Reply to This | # ]
A 'Go to work!' reminder script
Authored by: encro on Mar 14, '04 07:19:32PM
Ammendment after a quick test in the terminal:
say "Time to go to work"
executes much quicker than the applescript interpreter using:
osascript -e 'say "Time to go to work"'


[ Reply to This | # ]
A 'Go to work!' reminder script
Authored by: macubergeek on Mar 14, '04 10:20:05PM

I have a directory in my home directory called 'scripts'
I put my scripts there and launch them with:
$HOME/scripts/script_name
or
~/scripts/script_name
see the other comments on how to set up a cron job.



[ Reply to This | # ]
Just a good general purpose reminder
Authored by: Paul Burney on Mar 14, '04 01:38:42PM
Here's something I've done before. Let's say you are basting a chicken or something and need a reminder. You do the following on the command line:

sleep 600 && say -v Vicki 'Go baste the chicken' &

The sleep function takes a time in seconds, in this case 10 minutes = 600 seconds.

The last & puts it in the background so you can close the terminal program and still have it work.

BTW, Vicki is a very nice voice, IMHO. Like Victoria but a little more natural.

[ Reply to This | # ]
Vikki drops the first g
Authored by: macubergeek on Mar 14, '04 10:17:15PM

Tried the command:
say -v Vicki 'Go baste the chicken'
and Vicki dropped the first G as in Go
Victoria didn't
I've found certain weirdnesses in some of the Apple voices just like that.
I guess you have to test each of the voices on the command line to see what you like ;-)



[ Reply to This | # ]