Author Topic: Shut down computer using lua computer  (Read 4883 times)

0 Members and 1 Guest are viewing this topic.

Offline satya

  • Fulll Member
  • ****
  • Posts: 64
  • Karma: +3/-5
Shut down computer using lua computer
« on: 05 May, 2009, 19:06:32 »
Is it possible to shut down the pc using lua scripting?

Eyes says everything,
Its on you how u read em...

PtokaX forum

Shut down computer using lua computer
« on: 05 May, 2009, 19:06:32 »

Offline ?StIfFLEr??

  • Triple Ace
  • **
  • Posts: 241
  • Karma: +17/-63
Re: Shut down computer using lua computer
« Reply #1 on: 05 May, 2009, 20:57:05 »
Nice thought.
But i thought Lua scripts are made for working of Ptokax. Not for PC.
You can have better shut down softwares than making a script for it.
It would have been better if the script would have been such that it would stop ptokax at a desired time and resume it back on a desired time. and addition to it will be saving config when it shut downs or say hibernates.

Offline TTB

  • Lord
  • ***
  • Posts: 436
  • Karma: +17/-1
Re: Shut down computer using lua computer
« Reply #2 on: 06 May, 2009, 14:53:53 »
You can create (DOS) batch files and put them into the Task Schedular of Windows.

Just a tip.
TTB

(? ?.??.-> Admin @ Surfnet hubs <-.??.???)

Offline satya

  • Fulll Member
  • ****
  • Posts: 64
  • Karma: +3/-5
Re: Shut down computer using lua computer
« Reply #3 on: 06 May, 2009, 20:16:11 »
thanks guys for the help
wat i wanted to do is!

wen we have users less than 3 hub shud stop n PC shud shut down!


neways i got the point dat stifler bro said
Quote
Lua scripts are made for working of Ptokax. Not for PC.

so m sorry for such a silly Ques ;D

thanks for reply once again :)

Eyes says everything,
Its on you how u read em...

Offline ?StIfFLEr??

  • Triple Ace
  • **
  • Posts: 241
  • Karma: +17/-63
Re: Shut down computer using lua computer
« Reply #4 on: 06 May, 2009, 21:45:14 »
Well thanks for that but i got negative karma for no reason....

Offline satya

  • Fulll Member
  • ****
  • Posts: 64
  • Karma: +3/-5
Re: Shut down computer using lua computer
« Reply #5 on: 07 May, 2009, 09:23:57 »
Well i run a hub on my LAN network bt not in INTERNET.

Its a time bound hub where its only runs in evenin through out the nite till mornin.
Sometime i only keep the comp on for the hub, bt many times we have very less users in the hub and this happns only late in night.
So wat i was thinkin to have a script wich checks the user count at regular intervals and wen we have very less users in the hub we can stop the hub and shut down the computer!

i can script for checking the user count at regular intervals bt shutting down the computer was not possible for me. so came up here for help ;D

ne more Queries American Idiot Bro?

Eyes says everything,
Its on you how u read em...

Offline TTB

  • Lord
  • ***
  • Posts: 436
  • Karma: +17/-1
Re: Shut down computer using lua computer
« Reply #6 on: 07 May, 2009, 10:20:19 »
Well thanks for that but i got negative karma for no reason....
Hm.... Now I've got that too... Should I reply to help ppl?

Satya: I think it is possible to shutdown your windows by using a os.execute() command. But, settings in your hub might be unsaved this way. And, when having a *hick* in the network, you might loose your users anyway for a short time. Be aware if this.
TTB

(? ?.??.-> Admin @ Surfnet hubs <-.??.???)

Offline ?StIfFLEr??

  • Triple Ace
  • **
  • Posts: 241
  • Karma: +17/-63
Re: Shut down computer using lua computer
« Reply #7 on: 07 May, 2009, 10:46:35 »
I got one again....
-ve

Offline PPK

  • Administrator
  • Emperor
  • *****
  • Posts: 1 475
  • Karma: +209/-22
  • PtokaX developer
Re: Shut down computer using lua computer
« Reply #8 on: 07 May, 2009, 14:44:37 »
Omg, too much posts and nobody is able to help with something that easy :-X

Shudown on Windoze:
Code: [Select]
os.execute("shutdown %-s %-t 01")
Shutdown on Linux:
Code: [Select]
os.execute("shutdown %-h now")

And as TTB points out, is good idea to save settings before that 8)
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

Offline satya

  • Fulll Member
  • ****
  • Posts: 64
  • Karma: +3/-5
Re: Shut down computer using lua computer
« Reply #9 on: 07 May, 2009, 18:37:07 »
Thank you every one for the help

Quote
But, settings in your hub might be unsaved this way. And, when having a *hick* in the network, you might loose your users anyway for a short time. Be aware if this.

Ya TTB, i totally understand dat hence i wd save the settings b4 shuttin down the comp and ya the hick in the network is there, bt at late night we rarely have ne prob with the network hence we have taken this step.


Stifler bro trust me i have no idea abt the -ve karma i do applaud every guys who helps me out.

Quote
Omg, too much posts and nobody is able to help with something that easy Lips Sealed

Shudown on Windoze:
Code:

os.execute("shutdown %-s %-t 01")

Shutdown on Linux:
Code:

os.execute("shutdown %-h now")


And as TTB points out, is good idea to save settings before that Cool

And last bt by no means least ;D thanks PPK for the solution  ;)

Eyes says everything,
Its on you how u read em...

PtokaX forum

Re: Shut down computer using lua computer
« Reply #9 on: 07 May, 2009, 18:37:07 »