As @TheDarkKnight points out, cron has been deprecated in favor of launchd.
To use launchd, save the following as com.example.volume.plist
in ~/Library/LaunchAgents/
:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.example.volume</string>
<key>ProgramArguments</key>
<array>
<string>sh</string>
<string>-c</string>
<string>set volume 1.7</string>
</array>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>23</integer>
<key>Minute</key>
<integer>45</integer>
</dict>
</dict>
</plist>
then run launchctl load ~/Library/LaunchAgents/com.example.volume
to start. You can force the task to run immediately via launchctl start com.example.volume
.
If you prefer to have it run as root, save to /Library/LaunchDaemons/
instead.