Results 1 to 2 of 2

Thread: Getting Lynx to behave with Cron job

  1. #1
    Join Date
    Apr 2008
    Beans
    422

    Getting Lynx to behave with Cron job

    Hi, my University makes us log in credentials every 12 hours in order to access the internet. I decided I'm tired of that, so I made a shell script that automates Lynx to log me off and log me back in immediately afterwards. This works like a charm with no problems to any programs, so I set a cron job to run the script every 11 hours.

    Things went well for a few days, and I was happy, but Lynx won't always kill itself after the task has been done. So I've had a few instances of 100 percent CPU usage for Lynx. Also, I've seen Lynx invoke another process of itself just minutes after the cron job has been run. As of right now, there are two Lynx processes running with a total of 4 megabytes memory usage, and no cpu usage. I'd be perfectly happy with that if it just stayed like that.

    This is the crontab that I have:

    Code:
    * */11 * * * sh /home/cornwall/.canenetrefresh.sh >>/home/cornwall/Desktop/.canenetdebug.txt
    The shell script goes like this:

    Code:
    #! /bin/bash
    
    lynx -accept_all_cookies -nopause -cmd_script ~/.canenetrefresh.txt https://canenetcs1.tel.miami.edu/logon
    exit
    Is something looking out of the ordinary? How can I trail the output of a running process to see what it's up to? I'm not familiar with how to do that.
    Last edited by Chauncellor; February 14th, 2010 at 07:57 AM.

  2. #2
    Join Date
    Apr 2008
    Beans
    422

    Re: Getting Lynx to behave with Cron job

    Alright! figured out a good solution.

    I use BASH in my shell script, and so I can use the $$ variable to get the process ID and then kill it at the end of the script.

    So, at the end of the script, this is invoked:

    Code:
    kill -1 $$
    Also, the cron job was set up wrong. The Asterisk in the minutes position meant that the script was being run every minute every 11 hours. I needed to put a zero there instead. So it would be:


    Code:
    0 */11 * * *
    Everything seems to work well now.
    Last edited by Chauncellor; March 10th, 2010 at 05:54 PM.

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
  •