Junior hacker assignment :o
Hello, I'd like to make my own modification to FreeBSD, but I really don't know where to start. This is what I want to do: After doing a shutdown (no APM nor ACPI) FreeBSD tells me that the system is ready to be powered down. I'd like to add a (configurable) timeout to this final system notice that automatically reboots when this timer has expired. Where do I start reading? I mean, I think this is a kernel thingy, right? Best regards, Carlos. __ Do you Yahoo!? HotJobs - Search new jobs daily now http://hotjobs.yahoo.com/ To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-questions in the body of the message
Re: Junior hacker assignment :o
+ Carlos Carnero wrote: | Hello, | | I'd like to make my own modification to FreeBSD, but I | really don't know where to start. This is what I want | to do: | | After doing a shutdown (no APM nor ACPI) FreeBSD tells | me that the system is ready to be powered down. I'd | like to add a (configurable) timeout to this final | system notice that automatically reboots when this | timer has expired. | | Where do I start reading? I mean, I think this is a | kernel thingy, right? Does shutdown -r now reboot the machine without APM? -- Steve Tremblett To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-questions in the body of the message
Re: Junior hacker assignment :o
Hello, I'd like to make my own modification to FreeBSD, but I really don't know where to start. This is what I want to do: After doing a shutdown (no APM nor ACPI) FreeBSD tells me that the system is ready to be powered down. I'd like to add a (configurable) timeout to this final system notice that automatically reboots when this timer has expired. Um - its already in there - man shutdown Where do I start reading? I mean, I think this is a kernel thingy, right? Best regards, Carlos. __ Do you Yahoo!? HotJobs - Search new jobs daily now http://hotjobs.yahoo.com/ To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-questions in the body of the message To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-questions in the body of the message
Re: Junior hacker assignment :o
Hi, Does shutdown -r now reboot the machine without APM? yes it does. And it can set for a specific time if I use something other than now :) But I need it for other purposes. Let me see if I can explain this. I'm using a real dumb UPS, which can signal FreeBSD that not only the AC's gone, but that the battery will be depleted. So, when this second signal arrives I properly shutdown my server. The problem (that just bit me yesterday) is that the AC power was restored after the FreeBSD box was shut down but _before_ the battery depleted. So, the battery didn't reboot and my server was still waiting for a key to reboot. See the problem? And I can't program the UPS. Thanks a lot, Carlos. __ Do you Yahoo!? HotJobs - Search new jobs daily now http://hotjobs.yahoo.com/ To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-questions in the body of the message
Re: Junior hacker assignment :o
- Original Message - From: Carlos Carnero [EMAIL PROTECTED] To: FreeBSD Questions [EMAIL PROTECTED] Sent: Tuesday, November 05, 2002 1:20 PM Subject: Junior hacker assignment :o Hello, I'd like to make my own modification to FreeBSD, but I really don't know where to start. This is what I want to do: After doing a shutdown (no APM nor ACPI) FreeBSD tells me that the system is ready to be powered down. I'd like to add a (configurable) timeout to this final system notice that automatically reboots when this timer has expired. Where do I start reading? I mean, I think this is a kernel thingy, right? Best regards, Carlos. And this is a need that shutdown -r doesn't address? Kevin Kinsey DaleCo, S.P. To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-questions in the body of the message
Re: Junior hacker assignment :o
- Original Message - From: Carlos Carnero [EMAIL PROTECTED] To: FreeBSD Questions [EMAIL PROTECTED] Sent: Tuesday, November 05, 2002 1:20 PM Subject: Junior hacker assignment :o Hello, I'd like to make my own modification to FreeBSD, but I really don't know where to start. This is what I want to do: After doing a shutdown (no APM nor ACPI) FreeBSD tells me that the system is ready to be powered down. I'd like to add a (configurable) timeout to this final system notice that automatically reboots when this timer has expired. Where do I start reading? I mean, I think this is a kernel thingy, right? Best regards, Carlos. With a second look, you say (configurable) so I guess the -r switch isn't enough. I suppose you want to read the code in /usr/src/sbin/shutdown/shutdown.c Kevin Kinsey DaleCo, S.P. To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-questions in the body of the message
Re: Junior hacker assignment :o
Hi, --- DaleCo Help Desk [EMAIL PROTECTED] wrote: And this is a need that shutdown -r doesn't address? From an earlier message: --- Steve Tremblett wrote: Does shutdown -r now reboot the machine without APM? yes it does. And it can set for a specific time if I use something other than now :) But I need it for other purposes. Let me see if I can explain this. I'm using a real dumb UPS, which can signal FreeBSD that not only the AC's gone, but that the battery will be depleted. So, when this second signal arrives I properly shutdown my server. The problem (that just bit me yesterday) is that the AC power was restored after the FreeBSD box was shut down but _before_ the battery depleted. So, the battery didn't reboot and my server was still waiting for a key to reboot. See the problem? And I can't program the UPS. Thanks a lot, Carlos. __ Do you Yahoo!? HotJobs - Search new jobs daily now http://hotjobs.yahoo.com/ To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-questions in the body of the message
Re: Junior hacker assignment :o
Hi, --- Stephen Hovey [EMAIL PROTECTED] wrote: Um - its already in there - man shutdown This is from an earlier message: Hi, --- DaleCo Help Desk [EMAIL PROTECTED] wrote: And this is a need that shutdown -r doesn't address? From an earlier message: --- Steve Tremblett wrote: Does shutdown -r now reboot the machine without APM? yes it does. And it can set for a specific time if I use something other than now :) But I need it for other purposes. Let me see if I can explain this. I'm using a real dumb UPS, which can signal FreeBSD that not only the AC's gone, but that the battery will be depleted. So, when this second signal arrives I properly shutdown my server. The problem (that just bit me yesterday) is that the AC power was restored after the FreeBSD box was shut down but _before_ the battery depleted. So, the battery didn't reboot and my server was still waiting for a key to reboot. See the problem? And I can't program the UPS. Thanks a lot, Carlos. __ Do you Yahoo!? HotJobs - Search new jobs daily now http://hotjobs.yahoo.com/ To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-questions in the body of the message
Re: Junior hacker assignment :o
Hello, --- DaleCo Help Desk [EMAIL PROTECTED] wrote: I suppose you want to read the code in /usr/src/sbin/shutdown/shutdown.c in the (appropiately named? :) function die_you_gravy_sucking_pig_dog() rebooting means sending init a INT signal... I'll heck init (and that's kernel turf right?) Thanks a lot, Carlos. __ Do you Yahoo!? HotJobs - Search new jobs daily now http://hotjobs.yahoo.com/ To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-questions in the body of the message
Re: Junior hacker assignment :o
- Original Message - From: Carlos Carnero [EMAIL PROTECTED] To: DaleCo Help Desk [EMAIL PROTECTED]; FreeBSD Questions [EMAIL PROTECTED] Sent: Tuesday, November 05, 2002 2:07 PM Subject: Re: Junior hacker assignment :o Hello, --- DaleCo Help Desk [EMAIL PROTECTED] wrote: I suppose you want to read the code in /usr/src/sbin/shutdown/shutdown.c in the (appropiately named? :) function die_you_gravy_sucking_pig_dog() rebooting means sending init a INT signal... I'll heck init (and that's kernel turf right?) Thanks a lot, Carlos. Is that 'check init' or 'hack init'? ifIWasAGoodCProgrammer I might just alter shutdown so it took an additional argument to -r along the lines of shutdown -r [when-die] [when-resurrect] /ifIWasAGoodCProgrammer .but I'm just a converted Windoze Luser and amateur sysadmin, so you're getting beyond me here. If the OS is shut down, then the kernel's shut down, right, and how's it gonna count seconds 'til Resurrection Day? KDK To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-questions in the body of the message
Re: Junior hacker assignment :o
- Original Message - From: Carlos Carnero [EMAIL PROTECTED] To: DaleCo Help Desk [EMAIL PROTECTED]; FreeBSD Questions [EMAIL PROTECTED] Sent: Tuesday, November 05, 2002 2:07 PM Subject: Re: Junior hacker assignment :o Hello, --- DaleCo Help Desk [EMAIL PROTECTED] wrote: I suppose you want to read the code in /usr/src/sbin/shutdown/shutdown.c in the (appropiately named? :) function die_you_gravy_sucking_pig_dog() rebooting means sending init a INT signal... I'll heck init (and that's kernel turf right?) Thanks a lot, Carlos. Is that 'check init' or 'hack init'? ifIWasAGoodCProgrammer I might just alter shutdown so it took an additional argument to -r along the lines of shutdown -r [when-die] [when-resurrect] /ifIWasAGoodCProgrammer .but I'm just a converted Windoze Luser and amateur sysadmin, so you're getting beyond me here. If the OS is shut down, then the kernel's shut down, right, and how's it gonna count seconds 'til Resurrection Day? Well whatever function the kernel is in while it loops, polling the keyboard asking press any key to reboot could have additional logic for a countdown timer to reboot. How and where to do this? I don't know. Good Luck, - Mike To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-questions in the body of the message
Re: Junior hacker assignment :o
Hi, Is that 'check init' or 'hack init'? Um... at this moment make that 'check'. Hopefully I can change it to 'hack' in the future :) ifIWasAGoodCProgrammer I might just alter shutdown so it took an additional argument to -r along the lines of shutdown -r [when-die] [when-resurrect] /ifIWasAGoodCProgrammer Yep, nice interface. .. If the OS is shut down, then the kernel's shut down, right, and how's it gonna count seconds 'til Resurrection Day? Yes, but I think there's something going still, since it's waiting for a keypress. Carlos. __ Do you Yahoo!? HotJobs - Search new jobs daily now http://hotjobs.yahoo.com/ To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-questions in the body of the message
Re: Junior hacker assignment :o
Hi, --- Mike Hogsett [EMAIL PROTECTED] wrote: Well whatever function the kernel is in while it loops, polling the keyboard asking press any key to reboot could have additional logic for a countdown timer to reboot. Great! How and where to do this? I don't know. Not so great ;) Thanks a lot, Carlos. __ Do you Yahoo!? HotJobs - Search new jobs daily now http://hotjobs.yahoo.com/ To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-questions in the body of the message
Re: Junior hacker assignment :o
Look in /usr/src/sys/kern/kern_shutdown.c static void shutdown_halt(void *junk, int howto) { ... } Looks interesting. - Mike Hi, --- Mike Hogsett [EMAIL PROTECTED] wrote: Well whatever function the kernel is in while it loops, polling the keyboard asking press any key to reboot could have additional logic for a countdown timer to reboot. Great! How and where to do this? I don't know. Not so great ;) Thanks a lot, Carlos. __ Do you Yahoo!? HotJobs - Search new jobs daily now http://hotjobs.yahoo.com/ To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-questions in the body of the message
Re: Junior hacker assignment :o
On Tue, 5 Nov 2002, DaleCo Help Desk wrote: With a second look, you say (configurable) so I guess the -r switch isn't enough. I suppose you want to read the code in /usr/src/sbin/shutdown/shutdown.c Nope. This is the code to the shutdown command, which tells the kernel to shut down. The kernel code to shutdown is in /usr/src/sys/kern/kern_shutdown.c Fer Kevin Kinsey DaleCo, S.P. To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-questions in the body of the message To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-questions in the body of the message
Re: Junior hacker assignment :o
--- Mike Hogsett [EMAIL PROTECTED] wrote: Look in /usr/src/sys/kern/kern_shutdown.c static void shutdown_halt(void *junk, int howto) { ... } Looks interesting. - Mike Hi, --- Mike Hogsett [EMAIL PROTECTED] wrote: Well whatever function the kernel is in while it loops, polling the keyboard asking press any key to reboot could have additional logic for a countdown timer to reboot. Great! How and where to do this? I don't know. Not so great ;) Thanks a lot, Carlos. Not a real programmer but I wonder if adding the following (taken from shutdown_reset lines in kern_shutdown.c) DELAY(100); cpu_reset(); to the following in the cpu_halt(); area would work. You would have to modify the delay time. /* * If the shutdown was a clean halt, behave accordingly. */ static void shutdown_halt(void *junk, int howto) { if (howto RB_HALT) { printf(\n); printf(The operating system has halted.\n); printf(Please press any key to reboot.\n\n); switch (cngetc()) { case -1: /* No console, just die */ cpu_halt(); /* NOTREACHED */ default: howto = ~RB_HALT; break; } } } __ Do you Yahoo!? HotJobs - Search new jobs daily now http://hotjobs.yahoo.com/ To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-questions in the body of the message
RE: Junior hacker assignment :o
-Original Message- From: DaleCo Help Desk [mailto:daleco;daleco.biz] If the OS is shut down, then the kernel's shut down, right, and how's it gonna count seconds 'til Resurrection Day? I'm going out on a limb here, but there is an article in SysAdmin magazine that discusses the idea of a halted firewall on Linux: http://www.samag.com/documents/s=1824/sam0201d/0201d.htm The idea is that even when you issue a shutdown -h command and it says the system is halted the kernel, scheduler and memory manager are still running, but interactive processes that could possibly cause it do start doing stuff like writing to disk are not. A quote: When the machine is halted, the kernel still resides in memory, even when the machine runs through the shutdown process. [...] However, the kernel is still running as a scheduler and memory manager at that point. [...] Because the kernel is still running, any kernel-based tasks that we can run in normal use can be run while halted. You just need some form of input/output to/from the kernel and seriel port for your UPS. I don't know enough about kernel hacking on Linux or FreeBSD and the article only messed around with the shutdown scripts, but this might be a useful starting point. -- Andrew Boring, Senior Network Engineer Miller Zell 404-526-1440 [EMAIL PROTECTED] To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-questions in the body of the message
Re: Junior hacker assignment :o
--- Dave McCammon [EMAIL PROTECTED] wrote: --- Mike Hogsett [EMAIL PROTECTED] wrote: Look in /usr/src/sys/kern/kern_shutdown.c static void shutdown_halt(void *junk, int howto) { ... } Looks interesting. - Mike Hi, --- Mike Hogsett [EMAIL PROTECTED] wrote: Well whatever function the kernel is in while it loops, polling the keyboard asking press any key to reboot could have additional logic for a countdown timer to reboot. Great! How and where to do this? I don't know. Not so great ;) Thanks a lot, Carlos. Not a real programmer but I wonder if adding the following (taken from shutdown_reset lines in kern_shutdown.c) DELAY(100); cpu_reset(); to the following in the cpu_halt(); area would work. You would have to modify the delay time. /* * If the shutdown was a clean halt, behave accordingly. */ static void shutdown_halt(void *junk, int howto) { if (howto RB_HALT) { printf(\n); printf(The operating system has halted.\n); printf(Please press any key to reboot.\n\n); switch (cngetc()) { case -1: /* No console, just die */ cpu_halt(); /* NOTREACHED */ default: howto = ~RB_HALT; break; } } } DUH!! on my part. My previous response was a little overboard. Why not just increase the delay to close to your ups battery's runtime. (from kern_shutdown.c, starts on line 380) /* * Everything done, now reset */ static void shutdown_reset(void *junk, int howto) { printf(Rebooting...\n); DELAY(100); /* wait 1 sec for printf's to complete and be read */ /* cpu_boot(howto); */ /* doesn't do anything at the moment */ cpu_reset(); /* NOTREACHED */ /* assuming reset worked */ } __ Do you Yahoo!? HotJobs - Search new jobs daily now http://hotjobs.yahoo.com/ To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-questions in the body of the message