<p>
          It is pretty easy. First, let&#8217;s create a function for the script block. Put following code on the top of the Vagrant file.
        </p>
      </div>
    </div>
  </div>
  
  <div id="panel-1302-0-0-1" class="so-panel widget widget_sow-editor" data-index="1" data-style="{&quot;background_display&quot;:&quot;tile&quot;}" >
    <div class="so-widget-sow-editor so-widget-sow-editor-base">
      <div class="siteorigin-widget-tinymce textwidget">
        <pre>def start_rails_server

<<-SHELL cd /vagrant

start rails server as a daemon

to kill: sudo kill cat tmp/pids/server.pid

rails s -d SHELL end

  <div id="panel-1302-0-0-2" class="so-panel widget widget_sow-editor" data-index="2" data-style="{&quot;background_display&quot;:&quot;tile&quot;}" >
    <div class="so-widget-sow-editor so-widget-sow-editor-base">
      <div class="siteorigin-widget-tinymce textwidget">
        <p>
          Now in the Vagrantfile configuration block, use the script function and set it to run always. 
        </p>
      </div>
    </div>
  </div>
  
  <div id="panel-1302-0-0-3" class="so-panel widget widget_sow-editor panel-last-child" data-index="3" data-style="{&quot;background_display&quot;:&quot;tile&quot;}" >
    <div class="so-widget-sow-editor so-widget-sow-editor-base">
      <div class="siteorigin-widget-tinymce textwidget">
        <pre>Vagrant.configure("2") do |config|<br />...<br />config.vm.provision "shell", inline: start_rails_server, run: 'always'<br />...<br />end</pre>
      </div>
    </div>
  </div>
</div>