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:
The shell script goes like this:
* */11 * * * sh /home/cornwall/.canenetrefresh.sh >>/home/cornwall/Desktop/.canenetdebug.txt
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.
lynx -accept_all_cookies -nopause -cmd_script ~/.canenetrefresh.txt https://canenetcs1.tel.miami.edu/logon
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:
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:
Everything seems to work well now.