# ip-up.d/ip-down.d Scripts Not Running

## mneimeyer

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!

----------

## khayyam

 *mneimeyer wrote:*   

> 
> 
> ```
> for SCRIPT in *.sh ; do
> 
> ...

 

mneimeyer ... your sourcing rather than executing them ...

```
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

----------

## mv

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.

----------

