Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Silly question but do you run it from crontab with root permissions?
Have you checked /var/log/syslog for this job, did the job run at all, or did it fail?
Thanks for the reply, I didn't think about permissions. The script runs and is called from root's crontab, I thought that was sufficient as far as permissions go. However, changing the script to sudo /usr/bin/pon seems to fix things. Is there a better way to go about this?
Did you try setting 'suid' bit for /usr/bin/pon? Perhaps, that should help.
If not, the other simple way of doing this is, run the script in an infinite loop with proper sleep. So the script will be running all the time doing things for you.
Thanks for the reply. Setting suid on pon (itself a script that calls pppd) didn't do the trick. But adding the sudo to the call to /usr/bin/pon works fine, so problem solved. It's still a puzzle why something called from root's crontab fails w/o the sudo. Btw, pppd does have the suid bit set.
Distribution: Debian Wheezy/Jessie/Sid, Linux Mint DE
If /usr/bin/pon is a script, it is better to call explicitely /bin/bash /usr/bin/pon. In general, use an absolute path on everything in cron.
Did you set rwxr-xr-x permissions for /usr/bin/pon? If not, even root cannot execute it. (Just guessing, too lazy to try it) Anyway, I have stopped by calling scripts depending on #!/bin/bash or #!/bin/sh on the first line. Just call a script with /bin/bash so you are sure that (a) bash is used to execute and (b) you don't have to discover that you forgot execute permissions.
In case anyone finds this thread in the future, I put together something along these lines that turned into a pet project. It's basically a 'VPN companion' script that checks the system in a few different ways to see if the VPN has dropped or what-have-you. I wrote it for a CentOS 6 system, but it's pretty well commented in case it needs to be tailored for another distro or different uses.