On Fri, 11.11.16 22:31, zerons (sironhide0n...@gmail.com) wrote: > >> Hi everyone. > >> > >> Everyday, I need to do something like `git pull` after system > >> bootup and `git push` before shutdown. I am using Ubuntu 16.04. > >> I have tried to put some script into /etc/rc0.d/, /etc/rc6.d/, > >> each time the script runs, the network has been stopped, so I > >> turn to systemd. > >> > >> > >> === Here is a test .service file. > >> [Unit] > >> Description=test systemd > >> Conflicts=reboot.target > >> After=network-online.target > >> Wants=network-online.target > > > > If you only care about shutdown, then After=network.target shouls > > suffice, as long as your network management service properly orders > > itself against that. See systemd.special(7) for details on this. > > > > Note that systemd only provides a number of hooks we document > > semantics for, but it's up to downstream packages to actually honour > > these correctly. > > > > Lennart > > > > Thanks, I have tried this. When this script runs, `ifconfig`-> `ping` > -> `ifconfig`, when `ping` runs, the network is unreachable, packet 87% > loss(only the first one received), then the net interface has no > "inet addr". I couldn't figure this out:(
That suggests your network management service of choice is not ordering itself properly against network.target. Please file a bug against it. Lennart -- Lennart Poettering, Red Hat _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel