Tom Badran grabbed a keyboard and wrote:
>
> How can i use an if in a bash script so that it will only run commands if the
> specified file is empty?
>
> Basically, ive set up a cache system by which the output of ifconfig is
> stored in /var/cache/IP/1
>
> Then, every minute my script is run. It first puts the output of ifconfig in
> /var/cache/IP/2 and diff's it with 1 outputing that to a file 'diff'. I then
> want to run a series of commands if the file diff is not empty.
if [ -s diff ]; then
{do your command or commands here}
fi
> What im trying to do is get an email sent to me every time the IP changes on
> a specific machine, so i always have a record of it for logging in via ssh.
> The specific connection is ppp0 which auto redials on disconnect. If there is
> an easier way of doing this please share with me.
Have you checked out the free DDNS service at no-ip.com? They have a Linux
client that you can run when you connect, and then you can just ssh into
yourmachine.no-ip.com instead of worrying about the current IP address.
--Dave
--
David Guntner GEnie: Just say NO!
http://www.akaMail.com/pgpkey/davidg or key server
for PGP Public key
Want to buy your Pack or Services from MandrakeSoft?
Go to http://www.mandrakestore.com