Plop Forum

General Category => Plop Linux => Topic started by: cdusseau on October 28, 2010, 20:11:23 PM

Title: Run a Script after Login
Post by: cdusseau on October 28, 2010, 20:11:23 PM
I am writing a simple script to autoupdate some files on a usb drive from a network share. I need this script to run right after login and the connection to the network is up.

I honestly am not that familiar with any sort of task scheduling in Linux, but I already tried rc.local and it executes it too early (before net connection is up).

I can't find a cron (the fact that Im looking for one might speak to my ignorance) and I'm not sure how to use the rc.d system if that would work for me.

I know this is something a lot of you consider common knowledge, so please take a minute and help me out =)

Thanks.
Title: Re: Run a Script after Login
Post by: Elmar on October 28, 2010, 20:31:53 PM
hi,
Quote from: cdusseau on October 28, 2010, 20:11:23 PM
I honestly am not that familiar with any sort of task scheduling in Linux, but I already tried rc.local and it executes it too early (before net connection is up).

the network is started with rc.local. place your script at the end of rc.local and it should work

regards
elmar
Title: Re: Run a Script after Login
Post by: cdusseau on October 28, 2010, 20:44:45 PM
I tried that and got this as a result:

Connection to image-server failed (Error NT_STATUS_BAD_NETWORK_NAME)

But, if I execute the exact same script after login it connects and performs its function just fine. I said I was having issues with the connection not being ready because after the autologin I get a few lines about eth0. They tell me a few things about the link being ready, not ready and then ready again. After it becomes ready the second time my script works great.

Any way to delay the execution until the network is up? Aka detect if link is down or up and keep trying until it is up.
Title: Re: Run a Script after Login
Post by: Elmar on October 28, 2010, 21:01:40 PM
you can check it with dmesg|grep "eth0: link becomes ready" in a while loop
Title: Re: Run a Script after Login
Post by: cdusseau on October 28, 2010, 21:07:49 PM
Thanks for the input, its working great now.

BTW I truly love this distribution, its perfect for my needs!
Title: Re: Run a Script after Login
Post by: Elmar on October 28, 2010, 21:10:58 PM
nice to hear that its useful :)

best regards
elmar