Results 1 to 3 of 3

Thread: cron problem

  1. #1
    Join Date
    May 2008
    Location
    Caversham, UK
    Beans
    71
    Distro
    Ubuntu 12.04 Precise Pangolin

    Question cron problem

    I've created a bash script which I can run on my home computer which will grab my external IP address and e-mail it to my gmail account. I've done this since work has just started blocking DynDNS and I wanted a way of getting to my TiVo on my home network from work.

    Anyway the script "GetMyIP.sh" works fine when I run it from the terminal and I get a nice e-mail with my home computers external IP address in it.

    Then I thought I'd like to run it automatically, so I tried to put in a cron entry to run it at 00:30 evry day like this

    crontab -e

    Code:
    # mmm  hhh  ddd  mmm  DAY   COMMAND
      30   00    *    *    *     /home/carl/RunGetMyIP.sh
    but this doesn't seem to work. Instead of an e-mail like theis
    Code:
    Message Begins
    IP ADDRESS = XX.XX.XX.XX
    Message Ends
    I get a message
    Code:
    /home/carl/RunGetMyIP.sh: line 18: ssmtp: command not found
    Do I need to declare the path to ssmtp explicitly?

  2. #2
    Join Date
    Apr 2008
    Location
    LOCATION=/dev/random
    Beans
    5,767
    Distro
    Ubuntu Development Release

    Re: cron problem

    Quote Originally Posted by CarlWalters View Post
    Do I need to declare the path to ssmtp explicitly?
    Yes.

    Crontab runs with a very limited set of environmental variables set. Giving the full path for any commands in the script should fix this.
    Cheesemill

  3. #3
    Join Date
    May 2008
    Location
    Caversham, UK
    Beans
    71
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: cron problem

    Quote Originally Posted by Cheesemill View Post
    Yes.

    Crontab runs with a very limited set of environmental variables set. Giving the full path for any commands in the script should fix this.
    Excellent! That did the trick. Thank you very much

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •