Macbook-Sleep-Mode is a project mainly written in Shell, it's free.
Script to set sleep mode to sleep, hibernate or both, for Macbook and Macbook Pros.
Macs can sleep by maintaining the RAM, saving it to disk, or doing both. Both is the default. Disk saves battery, RAM only makes going to sleep much faster.
This script is a convenince to set the mode.
Tested on