Restart network without reboot ?
ni at w21.org
Mon Feb 10 16:46:34 UTC 2014
On 10.02.2014 17:30, dteske at FreeBSD.org wrote:
> $ cat << EOF > /tmp/do_it_now.sh
> service netif restart
> dhclient em0
> dhclient em1
> Then add a line to your /etc/crontab that will fire in the next 1-2
> 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
> 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
> 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 555 bytes
Desc: OpenPGP digital signature
More information about the freebsd-questions