Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
ip-up.d/ip-down.d Scripts Not Running
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
mneimeyer
n00b
n00b


Joined: 14 Sep 2012
Posts: 10

PostPosted: Mon Feb 24, 2014 9:59 pm    Post subject: ip-up.d/ip-down.d Scripts Not Running Reply with quote

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
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Tue Feb 25, 2014 1:27 am    Post subject: Re: ip-up.d/ip-down.d Scripts Not Running Reply with quote

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
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6747

PostPosted: Tue Feb 25, 2014 8:17 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum