View previous topic :: View next topic |
Author |
Message |
mneimeyer n00b
Joined: 14 Sep 2012 Posts: 10
|
Posted: Mon Feb 24, 2014 9:59 pm Post subject: ip-up.d/ip-down.d Scripts Not Running |
|
|
I just set up a PPTP VPN and it appears to be working... But I want to automatically add routing table entries.
From what I am able to find I would add something like /etc/ppp/ip-up.d/20-add-routes.sh with the commands I want to execute and then something similar to /etc/ppp/ip-down.d/ but nothing happens.
I got as far as tweaking the ip-up script like follows...
#!/bin/sh
logger Entering IP Up Scripts Directory
cd /etc/ppp/ip-up.d || exit
logger Running IP Up Scripts
for SCRIPT in *.sh ; do
. ./"${SCRIPT}" "$@"
done
I then run the "pon VPNName" command and in the system log I see the Entering... line but I don't see the Running... line. Any ideas why this would fail? I didn't see anything in the forums when I searched on ip-up.d or similarly on Google.
Thanks in advance! |
|
Back to top |
|
|
khayyam Watchman
Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Tue Feb 25, 2014 1:27 am Post subject: Re: ip-up.d/ip-down.d Scripts Not Running |
|
|
mneimeyer wrote: | Code: | for SCRIPT in *.sh ; do
. ./"${SCRIPT}" "$@"
done |
[...] Any ideas why this would fail? |
mneimeyer ... your sourcing rather than executing them ...
Code: | for f in /etc/ppp/ip-up.d/*.sh ; do
sh $f
done |
Also, its not clear if *.sh have the executable bit set (hence calling 'sh' above) ... and additionally I can't see where/why you're passing arguments.
HTH & best ... khay |
|
Back to top |
|
|
mv Watchman
Joined: 20 Apr 2005 Posts: 6747
|
Posted: Tue Feb 25, 2014 8:17 pm Post subject: |
|
|
If you see "Entering ..." but nur "Running ..." then it should be the "cd" which fails, shouldn't it?
Put 'logger "$(id -u)"' into your script to log which permissions you have when it is called and compare with the permissions of /etc/ppp and /etc/ppp/ip-up.d
Also, I would recommend to source your scripts in a subshell ( . ... ) so that they cannot influence each other. |
|
Back to top |
|
|
|