I am sure this can be improved greatly, but if you put in there the reboot code, it should be ok. The key is to set this up as a task that will run on boot. so you may need to use a batch file to run the script, or even make the script into an exe. Otherwise i am unsure on how you would actually execute the code on bootuse warnings; use strict; open $my file, '<', "C:/reboot_attempts"; read $file, my $reboot_number, 1; if ($reboot_number == 0){ open my $file, '>', 'reboot_attempts'; print $file '1'; close $file; #reboot machine; } if ($reboot_number == 1){ open my $file, '>', 'reboot_attempts'; print $file '2'; close $file; #reboot machine; } if ($reboot_number == 2){ open my $file, '>', 'reboot_attempts'; print $file '3'; close $file; #reboot machine; } if ($reboot_number == 3){ open my $file, '>', 'reboot_attempts'; print $file '4'; close $file; #reboot machine; } if ($reboot_number == 4){ open my $file, '>', 'reboot_attempts'; print $file '5'; close $file; #reboot machine; } if ($reboot_number == 5){ open my $file, '>', 'reboot_attempts'; print $file '0'; #exit; }
In reply to Re: Create a folder/file and reboot the machine and check for the created file/folder on the location.
by james28909
in thread reboot a system (machine or server) multiple times with perl script
by irthiza90
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |