Thread: StartUp Script after network
hi,
************************
edit: found solution. fix written @ end
************************
have strane requirement cannot manage resolve, need ask help:
have ubuntu server 10.04 installation, configured "on lan awaken", several users may use it.
electricity saving , maintainance reasons, wrote script following:
- every ten seconds executes users command
- if no users found nothing
- if user logged in , me, ends script
- if user found , not me, sends me notification e-mail , ends script
- after 30 loop executions (so, after 5 minutes) , if no users have been found @ sends me notification e-mail , halts system.
now, script runs without issues (executed manually , cron job), cannot manage run @ startup.
tried following:
- setting script /etc/init.d/ folder , using update-rc.d register startup job. result script blocked boot process, , after 5 minutes halted system before networking had been started , have logged in. (i had start server locally , in recovery mode fix issue).
- putting script /etc/network/if-up.d folder: script works expected, hostname not registered dns (aka router) until log in using ip , script finished. so, sound being executed before networking started. part this, if restart networking @ time, script run again, not exepected behavior.
so, question is: how can configure script run @ startup , right after else have been executed? (so, executing once users able log in normally).
in advance!
********************************
edit: not aboug googling (i had searched lot), looking right thing:
fix issue, had configure right priority in upate-rc.d command instead of using defaults:
update-rc.d scriptname start 99 2 3 4 5 .
********************************
voyez
upstart replaced old sysvinit few years ago. /etc/rc*.d scripts still work, being migrated upstart.
use upstart listen network-up , run job or start daemon, create file (or link) in /etc/init. example, let's call /etc/init/my-network-up.conf
you can run script upon network-up placing (or link) in /etc/networking/if-up.d directory...in fact, can see upstart net-device-up emitter in there.code:# 'my-network-up.conf' - custom upstart events # # these scripts run when network appears. description "my custom upstart events" start on net-device-up # start daemon or run script stop on net-device-down # (optional) stop daemon, scripts self-terminate. script # can put shell script in here, including if/then , tests. /path/to/myscript1 /path/to/myscript2 end script
use net-device-up listener , net-device-down listener mount/unmount network drives, assign default network printers, add/remove network-related cron jobs, , more.
Forum The Ubuntu Forum Community Ubuntu Official Flavours Support Networking & Wireless [SOLVED] StartUp Script after network
Ubuntu
Comments
Post a Comment