# Script/server script

**URL:** <https://www.ruby-forum.com/t/script-server-script/88406>\
**Category:** Rails\
**Created:** [March 10, 2007, 4:51pm UTC](https://www.ruby-forum.com/t/script-server-script/88406 "2007-03-10T16:51:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![seb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/8edcca/32.png) [@seb](https://www.ruby-forum.com/u/seb)\
**Post date:** [March 10, 2007, 4:51pm UTC](https://www.ruby-forum.com/t/script-server-script/88406/1 "2007-03-10T16:51:04Z")

</div>

Hi all,

I’m new to rails (and ruby) so bear with me.

I’ve analysed script/server (and subsequent scripts) and as far as I  
can tell, the actions performed in a newly created rails app (on my  
GNU/Linux box running lighttpd) when

$ script/server lighttpd

is called, can be summarised thus (ignoring the ‘requires’):

```
RAILS_ROOT = '/home/<your_home>/rails/<your_app>'

Rails::Initializer.run(:set_load_path)

FileUtils.mkdir_p(%w( tmp/sessions tmp/cache tmp/sockets ))

server = 'lighttpd'
configuration = 

```

Rails::Initializer.run(:initialize\_logger).configuration  
detach = false  
config\_file = “#{RAILS\_ROOT}/config/lighttpd.conf’  
config = IO.read(config\_file)  
default\_port, default\_ip = 3000, ‘0.0.0.0’  
port = config.scan(/^\s_server.port\s_=\s\*(\d+)/).first rescue  
default\_port  
ip = config.scan(/^\s_server.bind\s_=\s\*”([^"]+)"/).first rescue  
default\_ip

```
puts "=> Rails application started on http://#{ip || 

```

default\_ip}:#{port || default\_port}"

Having saved some ‘state’ in these local variables, it then ‘rakes’  
the tmp/sockets directory and fires up lighttpd.

My question is why save this state in the local variables? How is  
this information useful, and to what processes?

Any help much appreciated.

Sebastian

---

<div class="post-metadata">

**Author:** ![seb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/8edcca/32.png) [@seb](https://www.ruby-forum.com/u/seb)\
**Post date:** [March 14, 2007, 5:02pm UTC](https://www.ruby-forum.com/t/script-server-script/88406/2 "2007-03-14T17:02:18Z")

</div>

Sebastian,

I’m fairly new here too, but my impression is that questions like  
these (design/architecture questions) are better directed to the  
rails-core list. I think this list is more for usage questions.

Gordon

---

<div class="post-metadata">

**Author:** ![seb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/8edcca/32.png) [@seb](https://www.ruby-forum.com/u/seb)\
**Post date:** [March 14, 2007, 7:21pm UTC](https://www.ruby-forum.com/t/script-server-script/88406/3 "2007-03-14T19:21:37Z")

</div>

I agree with Gordon… mostly because this is a user list, and I don’'t  
think many of the rails core members read the list on a regular basis,  
so your point, as valid as it could be, would go unnoticed by the core  
members Seb.

Cheers.
