|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Vamsi Krishna wrote:
> Hi all, > > well, i thaught differently and want to know can any body 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/. |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On 31 Mar 2008, at 12:45, Damjan Rems wrote: > Vamsi Krishna wrote: >> Hi all, >> >> well, i thaught differently and want to know can any body 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... > by > TheR > -- > Posted via http://www.ruby-forum.com/. > |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
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/. |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
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/. |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
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/. |
|
![]() |
| Outils de la discussion | |
|
|