Ever Get board, then think of something you have been meaning to do, like make a simple solution to a rather annoying problem? Well my problem was, I kept getting kicked off of my server cause I idle to long sometimes. So to save the hassle of having to reconnect, I came up with the little bit of code below. After I made this, my sys admin told me there is a way to set a variable in bash to keep it from timing you out, oh well, no useful code so go to waste so I say.
Here is the result of a few min's of boredom:
#!/usr/bin/perl -w
#Script To Keep Term From Idling To long
#To Avoid Being Dissconnected from Server
#CTRL-C To Kill.
#Happy Idling!
use strict;
print "\nKeep Me Alive! CTRL-C to Kill Once Started\n";
print "\nDo you Want To Put Me To Sleep Now?(y,n):";
my $answ;
chomp($answ=<STDIN>);
if ($answ=~ /y/) { &sleep }
else{ print "\nFine, I didn't want a nap anyways!\n\n"; }
sub sleep {
my $sleep = sleep 30;
&sleep;
}
--
Yes, I am a criminal.
My crime is that of
curiosity.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.