Re: Bash script calling python script fails
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Tue, Jun 16, 2015 at 11:23:51AM +0200, rudu wrote:
> Hello,
> There's something I just can't figure out :
> I wrote a bash script to compare my actual IP address to the one of
> my DynDNS service provider.
> That bash script calls a python script (provided by the DynDNS
> service) to update my DynDNS Address if necessary.
> Everything runs smoothly when I run my script by hand as root or as
> a standard user.
>
> But when I put a symbolic link to my script in /etc/network/if-up.d/
> in order to make the checking / updating automatic at boot time, the
> python script doesn't seem to be launched at all, although my Bash
> script logs fine and sends me a success e-mail.
>
> What could prevent a python script to be executed in such circumstances ?
Difficult to say without seeing the actual scripts, but my hunch would be
that some environment variable(s) is different when run "by hand" and
when run from if-up. The first candidate would be, of course, PATH.
If you call ipcheck from the shell script just like "ipcheck.py", then
the shell looks for it in all places indicated by $PATH.
As a first test, try putting the call with the full path like so:
/usr/local/bin/ipcheck.py (replace the path by the correct one in
your case).
hth
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iEYEARECAAYFAlV//sEACgkQBcgs9XrR2kZtHwCcDQNR0Y3raMAAGCEMLHaH3Mn4
Wz4AmwYSHBaTJbLdfFai4mhmQmOhFeTT
=dpWB
-----END PGP SIGNATURE-----
Reply to: