in reply to Create a folder/file and reboot the machine and check for the created file/folder on the location.
in thread reboot a system (machine or server) multiple times with perl script
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; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Create a folder/file and reboot the machine and check for the created file/folder on the location.
by GotToBTru (Prior) on Mar 13, 2015 at 18:50 UTC | |
by james28909 (Deacon) on Mar 13, 2015 at 21:57 UTC | |
by irthiza90 (Novice) on Mar 16, 2015 at 06:45 UTC |