PtokaX forum

Lua 5.3/5.2/5.1 Scripts (for PtokaX 0.4.0.0 and newer) => HOW-TO's => Topic started by: satya on 05 May, 2009, 19:06:32

Title: Shut down computer using lua computer
Post by: satya on 05 May, 2009, 19:06:32
Is it possible to shut down the pc using lua scripting?
Title: Re: Shut down computer using lua computer
Post by: ?StIfFLEr?? 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.
Title: Re: Shut down computer using lua computer
Post by: TTB 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.
Title: Re: Shut down computer using lua computer
Post by: satya 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
QuoteLua scripts are made for working of Ptokax. Not for PC.

so m sorry for such a silly Ques ;D

thanks for reply once again :)
Title: Re: Shut down computer using lua computer
Post by: ?StIfFLEr?? on 06 May, 2009, 21:45:14
Well thanks for that but i got negative karma for no reason....
Title: Re: Shut down computer using lua computer
Post by: satya 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 Mutor Bro?
Title: Re: Shut down computer using lua computer
Post by: TTB on 07 May, 2009, 10:20:19
Quote from: ?StIfFLEr?? on 06 May, 2009, 21:45:14
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.
Title: Re: Shut down computer using lua computer
Post by: ?StIfFLEr?? on 07 May, 2009, 10:46:35
I got one again....
-ve
Title: Re: Shut down computer using lua computer
Post by: PPK 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:

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

Shutdown on Linux:

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


And as TTB points out, is good idea to save settings before that 8)
Title: Re: Shut down computer using lua computer
Post by: satya on 07 May, 2009, 18:37:07
Thank you every one for the help

QuoteBut, 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.

QuoteOmg, 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  ;)