Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I want to write a bash script that will notify me about changes on a trac wiki timeline. Unfortunately I can't "login" (it needs cookie for next logins).

wget http://someserver.com/trac/xxx/login \
--save-cookies=cookies --keep-session-cookies

wget http://someserver.com/trac/xxx/login \
--load-cookies=cookies \ 
--save-cookies=cookies.new --keep-session-cookies\
--post-data=user=viroos&password=myPassword

I get:

Error 400: Bad Request

I also tried --user --password options:

wget --no-check-certificate --user viroos --password myPassword\ 
https://someserver.com/trac/xxx/timeline?ticket=on&changeset=on&milestone=on&wiki=on&blog=on&max=50&daysback=90&format=rss

But this downloads only the login page.

What am I doing wrong?

share|improve this question

2 Answers 2

I think you are very close to the solution. This should work depending on your configuration:

wget --no-check-certificate --user viroos --password myPassword \
     --save-cookies=cookies --keep-session-cookies \
     https://someserver.com/trac/xxx/login

wget --no-check-certificate --load-cookies=cookies \
     https://someserver.com/trac/xxx/timeline?ticket=on&changeset=on&milestone=on&wiki=on&blog=on&max=50&daysback=90&format=rss

First call does the authorization on /login url and saves the auth cookie. The second call should get what you want.

This will work if you have basic autohrization enabled on ..../trac/login url.

share|improve this answer

The --user/--password flags in wget, for http URLs, cover HTTP basic authentication. Trac has its own login mechanism, so these flags won't work in this case.

There is a way to do what you want, (although I'm not sure wget is capable of doing it), but before spending time on that direction, did you consider using the TRAC timeline RSS feed?

The RSS feed will allow you to subscribe to the timeline changes, using your favorite RSS reader, and be notified of them. It will also give you a standard XML file for easy parsing, so you'll be able to do what you want with the data.

share|improve this answer
    
I now about rss time line, in fact I'm trying fetch it (at the end of url I have 50&daysback=90&format=rss). So I will parse XML. I'm doing this because I checking email often then rss reader and because trac authentication doesn't works with google reader so it's little. –  Maciek Sawicki Nov 6 '09 at 17:20

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.