Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm trying to automate a login process that can only be done through a browser. I am using the lynx browser to script the actions required to do this. Lynx does this by dumping a user's keystrokes into a file and then it allows a flag: -cmd_script=scriptfile to load the script.

I invoke lynx:

lynx -accept_all_cookies -cmd_script="myscript.lynx" www.example.com

From my interactive terminal, the resulting script works perfectly for me.

I have cron run the task and it doesn't work. I checked /var/log/everything.log and I noticed that when the script ran, lynx asks:

Your Terminal type is unknown!
Enter a terminal type: [vt100]

To fix this, I used the flag -term=linux which stopped the issue, but the login process still did not seem to get past the first page (by looking at the log file).

I've tried as many suggestions as I could find. I copied the results from env (in the interactive terminal) and pasted them into the script to see if the environment would fix it, but alas it did not.

Another note: My login process involves a redirect (which doesn't redirect in the lynx browser so I just follow the link it gives)

share|improve this question
    
This is moronic. I'm not allowed to answer my own question for 8 hours until I have 100 sunshine points. Here's the answer in a comment: –  Dennis Hodapp Jan 14 '12 at 9:41
4  
It seems whenever I think I've done everything I can, I haven't. Turns out, it was a simple mistake. When I used the flag: -cmd_script="myscript.lynx" I had placed myscript.lynx in the same directory as the script (which happened to be /root/bin). I figured out that lynx was never running the script, the reason being that apparently cron runs from the home directory of the user. Because I was using root's crontab, it was searching /root for myscript.lynx..not /root/bin like I had hoped. The simple fix? -cmd_script="/root/bin/myscript.lynx" –  Dennis Hodapp Jan 14 '12 at 9:42
    
Good find and good resolution too.. I will do +1 for this when you put this in your answer as you get a chance. –  Nikhil Mulley Jan 14 '12 at 11:23
    
@DennisHodapp It's been 8 hours; want to post an answer? You'll be able to earn more sunshine points –  Michael Mrozek Jan 15 '12 at 1:08
add comment

1 Answer

It seems whenever I think I've done everything I can, I haven't. Turns out, it was a simple mistake. When I used the flag: -cmd_script="myscript.lynx" I had placed myscript.lynx in the same directory as the script (which happened to be /root/bin). I figured out that lynx was never running the script, the reason being that apparently cron runs from the home directory of the user. Because I was using root's crontab, it was searching /root for myscript.lynx..not /root/bin like I had hoped. The simple fix? -cmd_script="/root/bin/myscript.lynx"

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.