Vamsi Krishna wrote:
Hi all,
well, i thaught differently and want to know can any body help me to
restart or shutdown an operating system with ruby code?
if possible please reply, i think it may be possible...
system 'any cmd' # comes to mind.
by
TheR
···
--
Posted via http://www.ruby-forum.com/\.
Vamsi Krishna wrote:
Hi all,
well, i thaught differently and want to know can any body help me to
restart or shutdown an operating system with ruby code?
if possible please reply, i think it may be possible...
system 'any cmd' # comes to mind.
win = RUBY_PLATFORM =~ /(ms|cyg)win|mingw/
flags = ' -h now'
flags = ' -t 0' if win
system "#{'sudo' unless win} shutdown #{flags}"
or something like that...
···
On 31 Mar 2008, at 12:45, Damjan Rems wrote:
by
TheR
--
Posted via http://www.ruby-forum.com/\.
well i'll clearly tell about this
through my ruby code i,e; when i run my ruby program the operating
system 've to be shutdown i'm using ubuntu
so how to do....
···
--
Posted via http://www.ruby-forum.com/.
Vamsi Krishna wrote:
well i'll clearly tell about this
through my ruby code i,e; when i run my ruby program the operating
system 've to be shutdown i'm using ubuntu
so how to do....
system 'shutdown -h now'
And you need to be sudo which might be a problem. But that is Ubuntu
problem now.
by
TheR
···
--
Posted via http://www.ruby-forum.com/\.
Vamsi Krishna,
Any command/combination you use in your shell, you can use from ruby too
system "the command"
or
return_value = `the_command`
There are more ways, but system is the easiest one.
···
--
Posted via http://www.ruby-forum.com/.