Restart network without reboot ?

dteske at FreeBSD.org dteske at FreeBSD.org
Mon Feb 10 21:33:41 UTC 2014



> -----Original Message-----
> From: Juergen Nickelsen [mailto:ni at w21.org]
> Sent: Monday, February 10, 2014 8:46 AM
> To: dteske at FreeBSD.org; 'Vladislav Prodan'; 'Darren Pilgrim'
> Cc: 'Erich Dollansky'; questions at freebsd.org
> Subject: Re: Restart network without reboot ?
> 
> On 10.02.2014 17:30, dteske at FreeBSD.org wrote:
> > $ cat << EOF > /tmp/do_it_now.sh
> > #!/bin/sh
> > service netif restart
> > dhclient em0
> > dhclient em1
> > EOF
> >
> > Then add a line to your /etc/crontab that will fire in the next 1-2
> > minutes...
> >
> > sh -c 'echo "$((($(date +%M)+2)%60)) $(date +%H) * * * root sh
> > /tmp/do_it_now.sh" >> /etc/crontab'
> >
> > NB: That's a single command to be entered on a single line
> >
> > Then just wait a minute or two, you'll get kicked out, start a ping,
> > and when it starts responding on the new IP address (hopefully you
> > know what this is) you can log in on the new address.
> >
> > Of course, the next thing you should do is to edit /etc/crontab to
> > remove the entry else the same time tomorrow it will reset your
> > network.
> >
> > Lastly, remove the /tmp/do_it_now.sh script.
> 
> Is there any special reason you don't just
> 
>     $ echo 'service netif restart; dhclient em0; dhclient em1' | at now
> 
> , which looks so much easier to me?
> 
> Of course, at(1) drags your whole environment into the job, which may be
> not what you want. I wouldn't see much harm in this case, though.
> 
[Devin Teske] 

Thanks for the tip; I'll try that next time.
-- 
Devin

_____________
The information contained in this message is proprietary and/or confidential. If you are not the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, please be aware that any message addressed to our domain is subject to archiving and review by persons other than the intended recipient. Thank you.


More information about the freebsd-questions mailing list