#!/usr/local/bin/perl -w #-*-perl-*- # # # use strict; use Win32; use Getopt::Std; use vars qw ( %Option ); my ($VERSION) = '$Revision: 1.0 $' =~ /([.\d]+)/; my $warnings = 0; # Print a usuage message on a unknown option. $SIG {__WARN__} = sub { if (substr ($_ [0], 0, 14) eq "Unknown option") {die "Usage"}; require File::Basename; $0 = File::Basename::basename ($0); $warnings = 1; warn "$0: @_"; }; $SIG {__DIE__} = sub { require File::Basename; $0 = File::Basename::basename ($0); if (substr ($_ [0], 0, 5) eq "Usage") { die < 1 ); my $Server = ""; if ( $Option{'a'} ) { Win32::AbortSystemShutdown ( $Server ) or die "$^E\n"; exit; } my $Message = "Reboot initiated by " . getlogin . "\n"; my $Timeout = $Option{'q'} || "60"; my $ForceClose = $Option{'q'} || "0"; my $Reboot = "6"; Win32::InitiateSystemShutdown ( $Server, $Message, $Timeout, $ForceClose, $Reboot - 5 ) or die "$^E\n"; =pod =head1 NAME B -- restart the operating system =head1 SYNOPSIS B [ -a ] B [ -q ] =head1 DESCRIPTION B restarts the hardware and operating system. Although B can be run by the super-user at any time, B is normally used first to warn all users logged in of the impending loss of service. See B for details. =head2 OPTIONS =over 4 =item -a Abort the B command. =item -q Quick. Reboot quickly without notifying logged-in users or saving data. =item -h Display syntax. =back =head1 EXAMPLES In the following example, B is being executed on host foo in 60 seconds. example# reboot In the example below, a quick reboot is requested immediately. example# reboot -q The following example aborts the above. example# reboot -a =head1 ENVIRONMENT The working of B is not influenced by any environment variables. =head1 BUGS B suffers from no known bugs at this time. =head1 STANDARDS It does not make sense to talk about standards in a B manual page. =head1 REVISION HISTORY reboot Revision 1.0 2000/06/22 08:35:57 idnopheq Initial revision =head1 AUTHOR The Perl implementation of B was written by Dexter Coffin, I. =head1 COPYRIGHT and LICENSE This program is copyright by Dexter Coffin 2000. This program is free and open software. You may use, copy, modify, distribute, and sell this program (and any modified variants) in any way you wish, provided you do not restrict others from doing the same. =head1 SEE ALSO =for html shutdown

=head1 NEXT TOPIC =cut