Post Reply 
 
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
starting script from command line
2012-12-04, 01:34 (This post was last modified: 2012-12-04 18:26 by thomil.)
Post: #1
starting script from command line
does ipxe let you run scripts from the default prompt when i press ctrl-b?
if so i cant get it to work when i type helloworld.bat which contains

helloworld.bat

#!ipxe

:loop
echo Hello world
goto loop
Find all posts by this user
Quote this message in a reply
2012-12-04, 18:26
Post: #2
RE: ipxe
Yes you can do that. Simply start the script as you would start a kernel:

dhcp
kernel http://<server>/helloworld.bat
boot

or shorter:

dhcp
chain http://<server>/helloworld.bat

You may want to take a look at http://ipxe.org/docs
Find all posts by this user
Quote this message in a reply
2012-12-06, 15:15
Post: #3
RE: ipxe
im curious, i see alot of people talking about their scripts, is this how they are running their scripts? the same way explained below?


(2012-12-04 18:26)meteger Wrote:  Yes you can do that. Simply start the script as you would start a kernel:

dhcp
kernel http://<server>/helloworld.bat
boot

or shorter:

dhcp
chain http://<server>/helloworld.bat

You may want to take a look at http://ipxe.org/docs
Find all posts by this user
Quote this message in a reply
2012-12-06, 17:53 (This post was last modified: 2012-12-06 17:56 by MultimediaMan.)
Post: #4
RE: starting script from command line
Yes, or they embed them in the ipxe binary (undionly.kpxe/ipxe.pxe or ipxe.lkrn).

For the first time users, it would be safe to say that the CTRL-B command line is where you get your feet wet, but past that, it's all scripts on a webserver or a PHP engine.

That's the beauty of iPXE; you can compile a small embedded script which executes a certain repeatable process as specific or as general as you want; once that process is established, you can expand or leverage it further as you see fit.

Myself, I have an embedded script which attempt to dhcp (three times) and checks for the UUID of a system as the chainload file. If it's not there, then it exits out. If it is there, it executes whatever is in the script.

Example embedded script:

Code:
#!ipxe
#Generic Boot Script

set 0_attempt 1

:0_retry

dhcp ||
isset ${17} && goto 0_next ||
iseq ${0_attempt} 3 && goto 0_end
iseq ${0_attempt} 2 && set 0_attempt 3
iseq ${0_attempt} 1 && set 0_attempt 2

goto 0_retry

:0_next

chain ${17}/ipxe/boot/${uuid}.ipxe ||

:0_end

exit

"Thus far, you have been adrift within the sheltered harbor of my patience..."
Find all posts by this user
Quote this message in a reply
2012-12-06, 19:01
Post: #5
RE: starting script from command line
hehe, thanks, can i have your already compiled ipxe.kpxe file that does this?

(2012-12-06 17:53)MultimediaMan Wrote:  Yes, or they embed them in the ipxe binary (undionly.kpxe/ipxe.pxe or ipxe.lkrn).

For the first time users, it would be safe to say that the CTRL-B command line is where you get your feet wet, but past that, it's all scripts on a webserver or a PHP engine.

That's the beauty of iPXE; you can compile a small embedded script which executes a certain repeatable process as specific or as general as you want; once that process is established, you can expand or leverage it further as you see fit.

Myself, I have an embedded script which attempt to dhcp (three times) and checks for the UUID of a system as the chainload file. If it's not there, then it exits out. If it is there, it executes whatever is in the script.

Example embedded script:

Code:
#!ipxe
#Generic Boot Script

set 0_attempt 1

:0_retry

dhcp ||
isset ${17} && goto 0_next ||
iseq ${0_attempt} 3 && goto 0_end
iseq ${0_attempt} 2 && set 0_attempt 3
iseq ${0_attempt} 1 && set 0_attempt 2

goto 0_retry

:0_next

chain ${17}/ipxe/boot/${uuid}.ipxe ||

:0_end

exit
Find all posts by this user
Quote this message in a reply
2012-12-07, 00:48
Post: #6
RE: starting script from command line
You know, I almost attached it; but then I thought about this for a minute...

There are two things preventing me from doing this:

a) If I did that and it didn't work (for almost any reason), you would come to me for help instead of troubleshooting it.

b) Any updates you would also come to me for, and there have been well over 100 commits in the past year.

In other words:
Quote:If you build a fire for someone he is warm for a night. If you set him afire, he is warm for the rest of his life.
...No, that's not quite right.

Ahem...
Quote:If you build a fire for someone he is warm for a night. If you set him afire, he is warm for the rest of his life. If you teach him to build a fire, he is warm for the rest of his life.
...Better.

So if you want it, ~as is~, I will post it for 24 hours.

"Thus far, you have been adrift within the sheltered harbor of my patience..."
Find all posts by this user
Quote this message in a reply
2012-12-07, 00:59
Post: #7
RE: starting script from command line
yes, im just learning, anything to play with do i need linux to compile my own or can it be done in windows 8? i will take it as is

(2012-12-07 00:48)MultimediaMan Wrote:  You know, I almost attached it; but then I thought about this for a minute...

There are two things preventing me from doing this:

a) If I did that and it didn't work (for almost any reason), you would come to me for help instead of troubleshooting it.

b) Any updates you would also come to me for, and there have been well over 100 commits in the past year.

In other words:
Quote:If you build a fire for someone he is warm for a night. If you set him afire, he is warm for the rest of his life.
...No, that's not quite right.

Ahem...
Quote:If you build a fire for someone he is warm for a night. If you set him afire, he is warm for the rest of his life. If you teach him to build a fire, he is warm for the rest of his life.
...Better.

So if you want it, ~as is~, I will post it for 24 hours.
Find all posts by this user
Quote this message in a reply
2012-12-07, 06:37
Post: #8
RE: starting script from command line
this is pretty cool, learning alot from this, i just wanted to say that
Find all posts by this user
Quote this message in a reply
2012-12-07, 20:57
Post: #9
RE: starting script from command line
If you want more hands-on learning in a bit faster tempo, IRC is the place to be. Smile

The channel is called #ipxe, and we're on the server called irc.freenode.net. If you've never used IRC before, just google it and download an IRC client (or use a web client). Wikipedia is your friend. It also has some decent articles that explains how the PXE network boot system works.
Visit this user's website Find all posts by this user
Quote this message in a reply
2012-12-07, 22:01
Post: #10
RE: starting script from command line
yea, i usually hang out on efnet, but sometimes freenode im there now as \\mr_c\\

(2012-12-07 20:57)robinsmidsrod Wrote:  If you want more hands-on learning in a bit faster tempo, IRC is the place to be. Smile

The channel is called #ipxe, and we're on the server called irc.freenode.net. If you've never used IRC before, just google it and download an IRC client (or use a web client). Wikipedia is your friend. It also has some decent articles that explains how the PXE network boot system works.
Find all posts by this user
Quote this message in a reply
2012-12-09, 18:34
Post: #11
RE: starting script from command line
really cool, i got it to work, my fire is lit now... hehe, back to your quote

(2012-12-06 19:01)mrc333777 Wrote:  hehe, thanks, can i have your already compiled ipxe.kpxe file that does this?

(2012-12-06 17:53)MultimediaMan Wrote:  Yes, or they embed them in the ipxe binary (undionly.kpxe/ipxe.pxe or ipxe.lkrn).

For the first time users, it would be safe to say that the CTRL-B command line is where you get your feet wet, but past that, it's all scripts on a webserver or a PHP engine.

That's the beauty of iPXE; you can compile a small embedded script which executes a certain repeatable process as specific or as general as you want; once that process is established, you can expand or leverage it further as you see fit.

Myself, I have an embedded script which attempt to dhcp (three times) and checks for the UUID of a system as the chainload file. If it's not there, then it exits out. If it is there, it executes whatever is in the script.

Example embedded script:

Code:
#!ipxe
#Generic Boot Script

set 0_attempt 1

:0_retry

dhcp ||
isset ${17} && goto 0_next ||
iseq ${0_attempt} 3 && goto 0_end
iseq ${0_attempt} 2 && set 0_attempt 3
iseq ${0_attempt} 1 && set 0_attempt 2

goto 0_retry

:0_next

chain ${17}/ipxe/boot/${uuid}.ipxe ||

:0_end

exit
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 4 Guest(s)