Re: systemctl restart in script

2021-12-22 Thread Russell Coker via luv-main
On Wednesday, 22 December 2021 18:53:57 AEDT Andrew Pam wrote:
> On 22/12/21 6:48 pm, Russell Coker via luv-main wrote:
> > When pppd starts I have a script in /etc/ppp/ip-up.d that among other
> > things restarts the wide dhcpv6 client.  That hangs with the above in the
> > process list, the time I noticed this was 18:34 so for 4 minutes it had
> > been hung. When I ran "/etc/init.d/wide-dhcpv6-client restart" from a
> > regular root xterm it restarted the daemon and caused the other systemctl
> > session to exit with error code 0 and the rest of the script completed.
> > 
> > Any idea why it hung and how I can make it not hang in future?
> 
> On my router it doesn't hang, but it exits without actually starting the
> DHCPv6 client.  I always have to manually restart it after bringing up pppd.

root@xev:/etc/ppp/ip-up.d# cat ipv6 
#!/bin/bash
set -e

/etc/init.d/wide-dhcpv6-client restart
sleep 10
/sbin/ip -6 route add default dev ppp0
sleep 10
/usr/local/sbin/restart-radvd
/usr/local/sbin/update-dns
root@xev:/etc/ppp/ip-up.d# cat /usr/local/sbin/restart-radvd
#!/bin/bash
set -e

PREF=$(/sbin/ifconfig br0|grep inet6.*global|sed -e s/^.*inet6.//|cut -
f1,2,3,4 -d:)
CONF=/etc/radvd.conf
sed -e "s/prefix.*::/prefix $PREF::/" < $CONF > $CONF.new
mv $CONF.new $CONF
/sbin/restorecon $CONF
/etc/init.d/radvd restart
root@xev:/etc/ppp/ip-up.d# cat /usr/local/sbin/update-dns
#!/bin/bash
set -e

IPV6=$(ip addr list|grep inet6.*global|sed -e s/^.*inet6.// -e "s/\/.*$//")

if [ "$IPV6" == "" ]; then
  echo "No IPv6 address"
  exit 1
fi
ssh -T xev@xkcd /home/xev/bin/update-dns $IPV6 > /dev/null

I have the above scripts which do everything automatically except that it 
hangs on the wide-dhcpv6-client.  I need this to work as my NBN connection 
goes down every few weeks and I don't want to lose IPv6 or have to get 
manually involved.

For the update-dns script most of the workstations I run have NAT for the IPv4 
address so I ssh to a server and run the dynamic DNS update from there with 
the source address of the SSH connection as the public address.  Even though I 
have no NAT on this system I use the same script because it's easier to have 
lots of things run the same way.

-- 
My Main Blog http://etbe.coker.com.au/
My Documents Bloghttp://doc.coker.com.au/

___
luv-main mailing list -- luv-main@luv.asn.au
To unsubscribe send an email to luv-main-le...@luv.asn.au


Re: systemctl restart in script

2021-12-21 Thread Andrew Pam via luv-main

On 22/12/21 6:48 pm, Russell Coker via luv-main wrote:

When pppd starts I have a script in /etc/ppp/ip-up.d that among other things
restarts the wide dhcpv6 client.  That hangs with the above in the process
list, the time I noticed this was 18:34 so for 4 minutes it had been hung.
When I ran "/etc/init.d/wide-dhcpv6-client restart" from a regular root xterm
it restarted the daemon and caused the other systemctl session to exit with
error code 0 and the rest of the script completed.

Any idea why it hung and how I can make it not hang in future?


On my router it doesn't hang, but it exits without actually starting the 
DHCPv6 client.  I always have to manually restart it after bringing up pppd.


Cheers,
Andrew
--
mailto:and...@sericyb.com.au  Andrew Pam
https://sericyb.com.au/   Manager, Serious Cybernetics
https://glasswings.com.au/Partner, Glass Wings
___
luv-main mailing list -- luv-main@luv.asn.au
To unsubscribe send an email to luv-main-le...@luv.asn.au


systemctl restart in script

2021-12-21 Thread Russell Coker via luv-main
root2006  0.0  0.0   2432  1772 ?S18:30   0:00 /bin/sh /
etc/init.d/wide-dhcpv6-client restart
root2012  0.0  0.0   7096  1308 ?S18:30   0:00 systemctl 
--no-pager restart wide-dhcpv6-client.service

When pppd starts I have a script in /etc/ppp/ip-up.d that among other things 
restarts the wide dhcpv6 client.  That hangs with the above in the process 
list, the time I noticed this was 18:34 so for 4 minutes it had been hung.  
When I ran "/etc/init.d/wide-dhcpv6-client restart" from a regular root xterm 
it restarted the daemon and caused the other systemctl session to exit with 
error code 0 and the rest of the script completed.

Any idea why it hung and how I can make it not hang in future?

-- 
My Main Blog http://etbe.coker.com.au/
My Documents Bloghttp://doc.coker.com.au/

___
luv-main mailing list -- luv-main@luv.asn.au
To unsubscribe send an email to luv-main-le...@luv.asn.au