Starting a Vagrant Box on Host Startup

  1. Create the file /etc/init.d/vboxes
#! /bin/bash
# chkconfig: - 99 01
# description: Vagrant Box Loader

cd /path-to-box

DATE=$(date +%Y%m%d%H%M%S)
case "$1" in
  start)
    echo "$DATE start" >> /vboxes.log
    (su root vagrant up >> /vboxes.log) &
    ;;
  stop)
    echo "$DATE stop" >> /vboxes.log
    (su root vagrant halt >> /vboxes.log) &
    ;;
  restart)
    echo "$DATE restart" >> /vboxes.log
    (su root vagrant reload >> /vboxes.log) &
    ;;
esac

exit 0
  1. Install the file by running chkconfig --add vboxes
  2. Test the file by running service vboxes start
  3. Activate the file by running chkconfig vboxes on

You shoudl get a log of activity placed into the /vboxes.log file.