Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Feb 2014 17:46:27 +0100
From:      Juergen Nickelsen <ni@w21.org>
To:        dteske@FreeBSD.org, 'Vladislav Prodan' <universite@ukr.net>,  'Darren Pilgrim' <list_freebsd@bluerosetech.com>
Cc:        'Erich Dollansky' <erichsfreebsdlist@alogt.com>, questions@freebsd.org
Subject:   Re: Restart network without reboot ?
Message-ID:  <52F90263.5010006@w21.org>
In-Reply-To: <0b7f01cf267d$72ac84b0$58058e10$@FreeBSD.org>
References:  <1391822758.499117562.qad9aups@frv35.fwdcdn.com> <20140208102029.04d2eb10@X220.alogt.com> <1391827303.738906888.k9hzy6eo@frv35.fwdcdn.com> <52F5BF3A.2030500@bluerosetech.com> <1391864386.931739885.x8t44ikc@frv35.fwdcdn.com> <0b7f01cf267d$72ac84b0$58058e10$@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--SD6FUb7STbVIH2A3bTEwBHpX33WLjr2BR
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On 10.02.2014 17:30, dteske@FreeBSD.org wrote:
> $ cat << EOF > /tmp/do_it_now.sh
> #!/bin/sh
> service netif restart
> dhclient em0
> dhclient em1
> EOF
>=20
> Then add a line to your /etc/crontab that will fire in the next 1-2
> minutes...
>=20
> sh -c 'echo "$((($(date +%M)+2)%60)) $(date +%H) * * * root sh
> /tmp/do_it_now.sh" >> /etc/crontab'
>=20
> NB: That's a single command to be entered on a single line
>=20
> Then just wait a minute or two, you'll get kicked out, start a ping, an=
d
> when
> it starts responding on the new IP address (hopefully you know what thi=
s is)
> you can log in on the new address.
>=20
> Of course, the next thing you should do is to edit /etc/crontab to remo=
ve
> the
> entry else the same time tomorrow it will reset your network.
>=20
> 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.

Regards, Juergen.


--SD6FUb7STbVIH2A3bTEwBHpX33WLjr2BR
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJS+QJjAAoJEEb28HuG6YEftjUH/Rzjuv3mJqlemfboqFwhOVp0
YAE4uyo8Lw4zTDgBRUDD4GiKliqiIYFoivIIDZKHR5VkWUqgJLoHLOANRNo1ycz3
J18MSMP2DxiZR4ISYWUW/2SSt1lLJW8DnQRKC2DkwxNaaMjDARDlMKKoC9Er0LeH
UsnW9VZ2HZncXJekM7puM4jkx8Pr7wdQ8GQHo5Xv74soXz+IhbfVY9Bff5G7vBtS
XKmhpJcWoWDbcTR8OcBEOFYA8/rWIY/oDqaTvUkAOQ6ZqNr1dxAng83FfzoswBHu
7gmEpWa/lisNSFznqicFyC97mVUcwu145UxlRAnhkhc1T/j/z7W/b7Q86duid/w=
=jcTV
-----END PGP SIGNATURE-----

--SD6FUb7STbVIH2A3bTEwBHpX33WLjr2BR--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?52F90263.5010006>