Posts Tagged ‘unix’

Unix Mail


Glad I did not need to sort these.

I had a departmental computer account set up for me, or at least I asked the IT guy to set one up for me. After I asked I never heard back about it.

Three weeks later my professor mentions something he showed me but he never did. He looks at his e-mail and he did send it to me, to my departmental e-mail address. I did not know that I had this e-mail address.

Turns out that I had an e-mail account and computer account set up but I was never told about it. Once I found this out I hunted down the IT guy and got the default password for the account. I then figure out how to set up forwarding.

However I noticed that I had about ten messages that I could get too, I know this since there was an error file with the names of the e-mails. Hoping a solution would turn up I continued on my way.

Today I logged onto my friends linux machine through SSH and saw a line at the top that I have never seen before “You have mail”. Odd I thought. I did not know what to do with this, so I blindly typed ‘mail’ and there it was. From here I could access the mail on my departments unix machines and finally read those e-mails.

I just could not forward the existing e-mails to a better e-mail account.

An important aspect of figuring out computer problems is knowing how to fiddle without breaking things or causing irrecoverable damage.

To get those messages I could probably use a modern mail client, I reasoned. I started up OS X Mail and tried to set up a new account based off my department server. Strangely it worked quite easily. I set up a temporary POP account, downloaded the messages, dragged them to an IMAP account and deleted the POP account.

It would have been nice if I knew I could do that from the beginning.

Read Full Post »

A good script.

A good script.

I just finished setting up something neat for my MacBook Pro: a script that takes the IP address of the laptop on wake and writes it to a file that is then synced online via Dropbox.

It starts with the set of terminal commands on scripts called SleepWatcher. This program looks for a file called .sleep and .wakeup int he users home directory and executes them upon sleep and wake respectively. They can contain any UNIX script from say “Goodnight Michael” to, well, grabbing the current IP.

The command used to get the current IP and write it to a file is:

curl http://myip.ozymo.com -o /Users/michaelhutchins/Documents/Dropbox/wan_ip_mac.txt

With the /michaelhutchins… part replaced with your username and where you want the file to go (and be called). To make the use TextEdit or anything to make a file called sleep.txt. Then rename this to .sleep saying yes to all the warning of hidden files and removing the .txt extension. My full script is the above with one added line:

sleep 5;

curl http://myip.ozymo.com -o /Users/michaelhutchins/Documents/Dropbox/wan_ip_mac.txt;

The sleep 5 just waits five seconds so the computer can make the connection to the internet. Once it was done in Terminal I typed chmod +x .wakeup to make it executable. With this and sleepwatcher installed it now updated the IP address whenever it wakes up.

Why is this useful? I see it as a security measure. If my laptop is ever lost or stolen I can use the IP to SSH in to maybe find out where it went or at least narrow down the options. I can also use Screen Sharing through OS X to see what is on the screen by connecting with the IP address. Or if the IP is for a coffee house or public place a well placed “say “I am stolen!” on repeat may help.

Also in the future I may see about setting my computer up as a file server I can wake remotely in case I need to get a file. Though I have yet to experiment with that.

Read Full Post »