nMustaki / debinterface

A simple Python library for dealing with the /etc/network/interfaces file in most Debian based distributions.
BSD 3-Clause "New" or "Revised" License
10 stars 16 forks source link

run in crontab ? #18

Closed ymolinet closed 7 years ago

ymolinet commented 7 years ago

Hi,

My scritpt work as well in the root shell but not in the root crontab. /etc/network/interfaces is not updated and iface are not started. Do you have an idea to fix ?

Thanks, Yannick

ymolinet commented 7 years ago
Traceback (most recent call last):
  File "/opt/sonde/network_config.py", line 75, in <module>
    iface_file.writeInterfaces()
  File "/opt/sonde/debinterface/interfaces.py", line 55, in writeInterfaces
    self._backup_path
  File "/opt/sonde/debinterface/interfacesWriter.py", line 53, in write_interfaces
    self._check_interfaces(self._interfaces_path)
  File "/opt/sonde/debinterface/interfacesWriter.py", line 88, in _check_interfaces
    "one : {0}".format(output))
ValueError: Invalid network interfaces file written to disk, restoring to previous one : [Errno 2] No such file or directory
ymolinet commented 7 years ago

ok. found. _check_interfaces use ifup command but path is not set when the task is running in cron. It's better to specify the full path /sbin/ifup instead of ifup.

nMustaki commented 7 years ago

Hum sorry I thought I got them all. Hopefully I'll have time to push 3.1 tonight and this will be fixed. Thanks for reporting!

On Tue, 28 Feb 2017, 18:39 Yannick MOLINET, notifications@github.com wrote:

ok. found. _check_interfaces use ifup command but path is not set when the task is running in cron. It's better to specify the full path /sbin/ifup instead of ifup.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/nMustaki/debinterface/issues/18#issuecomment-283110789, or mute the thread https://github.com/notifications/unsubscribe-auth/AA-fUVGkw44Oi0t0_xaTdJYxykPrKUQ8ks5rhFvRgaJpZM4MOrR1 .