|
1,
2
Step-by-step
Instructions
Create
a directory called “bin” in
your home directory unless one already exists. Create a new text
file, copy and paste the above script into the file. Customize your
Gmail information and save the script as “dynip.” Right click the
script and give it a permission to execute. If that doesn't work in
your flavor of Linux, open up the terminal window and type these
commands:
cd
/home/yourusername/bin
chmod +x
dynip
Now
we need to make it possible for the
operating system to execute your script from the command line
regardless of your current directory. We'll add the directory you
created to the PATH system variable:
export
PATH=$PATH:/home/yourusername/bin
Next,
we'll install the sendEmail package unless you already have it. In
Debian/Ubuntu you can use:
sudo
apt-get install sendEmail
If
everything went right we can test the script by typing “dynip” at
the command prompt. The script will wait for 60 seconds and email the
IP address to the address specified within.
On
Boot Scheduling
The
script is now working at the command line level, but we need to add
it to your crontab so it runs automatically each time you log into
the computer. Crontab is a text file which keeps track of scheduled
jobs. To edit the crontab:
crontab
-e
Add
a line of text:
@reboot
/home/yourusername/bin/dynip
and
save crontab. This will cause your computer to ryn dynip script every
time you log in. It is possible to setup the
same or similar
automatic jobs for other users as well.
1,
2
1,
2
|