LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 01-12-2004, 05:16 AM   #1
cccc
Senior Member
 
Registered: Sep 2003
Distribution: Debian Squeeze / Wheezy
Posts: 1,615

Rep: Reputation: 47
howto start vpnclient with php script and sudo ?


hi

I wrote PHP script, to start vpnclient on my linux server:

<?php

$result = exec("ping -c 4 X.X.X.X");

if ("$result?"!= "0") {

exec("/etc/init.d/vpnclient_init restart");

}

?>

from shell as root user this script is working well.

my problem is:
howto start vpnclient via browser with this script using sudo ?

I'm using linux SuSE 8.2 and Apache 1.3.27

kind regards
cccc
 
Old 01-12-2004, 11:46 AM   #2
cccc
Senior Member
 
Registered: Sep 2003
Distribution: Debian Squeeze / Wheezy
Posts: 1,615

Original Poster
Rep: Reputation: 47
I tried with :

exec("sudo -u root /etc/init.d/vpnclient_init restart");

and is working well.

regards
cccc

Last edited by cccc; 01-31-2004 at 06:52 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Howto start script at boot ? hendrixx Programming 3 11-15-2005 01:42 PM
howto start a perl script only from tuesday to friday at 8.00 am ? cccc Linux - Newbie 4 03-19-2005 04:23 AM
PHP HOWTO : Run script as root guideweb Linux - Software 3 08-22-2004 11:38 PM
Help with Howto start a shell script at boot draven Linux - Newbie 7 03-03-2004 11:20 PM
I'm looking for a script to keep cisco vpnclient up and running cccc Linux - Networking 0 09-16-2003 04:09 PM


All times are GMT -5. The time now is 02:00 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration