Unix & Linux Asked by CutePoison on December 5, 2020
I have a simple python script hello.py
and a hello.sh
file:
#!/bin/bash
python -c "from hello import hello; hello()"
(hello.py
is in PYTHONPATH)
made it executeable and placed in the if-up.d
directory. Being in the directory and running ./hello.sh
it works as it should. But disconnecting and re-connecting does not trigger the script.
Even it the script is just echo "hello">>out.txt
it still doesn’t get executed. My user is owner of the script (running ubuntu 20.04)
Any idea?
You can use the code below with setting the correct interface name :
#!/bin/sh
if [ "$IFACE" = <interface-name> ]; then
python <path_to_your_script>.py
fi
Don't forget to make it executable :
sudo chmod +x <path_to_your_script>.sh
Also if your interface is managed by NetworkManager this wil not work.
Answered by Reda Salih on December 5, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP