What's new

Script for after network devices connected.

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

danjackson

New Around Here
Hi,

I'm trying to get cifs to auto mount a device once the router has booted and the devices have already got their IP addresses. Currently using init-start user script and its not working which I assume is because the devices connected to the router haven't got their Ip addresses by the time init start runs.

Can anyone suggest an alternative jffs script I could use other than init-start? This is what I have in it:

#!/bin/sh
mount -t cifs -o username=USER,password=PASSWORD //SERVERNAME/SHARENAME /cifs1

The command works in shell but I assume thats because the server has already got its IP address/SMB name.
 
init-start is the worst place to put that command:
init-start

Right after JFFS just got mounted, and before any of the services get start. This is the earliest part of the boot process where you can insert something.
I would suggest a better choice would be services-start.

Also, the router has no control over when a client tries to "get" its IP address. Probably the best you can do is look in the syslog and try and determine how many seconds after services-start runs it typically takes for all of the devices to connect and then add a delay to the beginning of your script, i.e. sleep 20
 

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top