This script becomes handy when scheduling CPU-/IO-intensive task on a notebook that additionally require Internet access (ex. backups).
Obviously a notebook is not online and not on AC all the time - so why not defer the started jobs until the system is back online and on AC again?
- Download the script and save it to a place of your preference
- Set the variable AC_REFERENCE accordingly (just browse /sys and you will find something to determine the presence of your charger)
- In your [f|ana]crontab, prefix your commands with the script above:
# old: 09 5 * * * ~/backup_server.sh # new: 09 5 * * * ~/notebook_cron_wrapper.sh ~/backup_server.sh