LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 04-29-2004, 05:31 AM   #1
ulto
Member
 
Registered: Apr 2004
Posts: 52

Rep: Reputation: 1
sudo and at commands


ok i have the follwoing two lines below that are executed from a php script on my webserver

this line matches the ip address with the mac address of a users and enters this information in to the ip tables

echo exec("sudo arp | grep $REMOTE_ADDR | awk '{print $1}'| /root/user/www/cgi-bin/change");

this one does the opposite EXCEPT there is a time delay of 24 hours (i want the script to execute then)

echo exec("sudo at now + 24 hours | sudo arp | grep $REMOTE_ADDR | awk '{print $1}'| /root/user/www/cgi-bin/rem");

this is the one im having trouble with it works without the "sudo at now + 24 hours"

it seems ok that there is a job waiting when i type atq to see the jobs in the queue but they dont execute at all properly
must be the order in which it appears or something

any ideas?
would cron do the trick!
 
Old 04-29-2004, 10:57 AM   #2
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
Quote:
this is the one im having trouble with it works without the "sudo at now + 24 hours"
I would put the whole command line in a script, e.g. /usr/local/sbin/arpcheck.sh
Then make an entry for the script in /etc/sudoers

And execute:
echo "sudo /usr/local/sbin/arpcheck.sh" | at now + 24 hours
 
Old 05-01-2004, 08:36 AM   #3
ulto
Member
 
Registered: Apr 2004
Posts: 52

Original Poster
Rep: Reputation: 1
but who could i pass the ip address variable to the script!?

I think thats where the main problem lies
 
  


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
Restricting Editing in Sudo (Advanced Sudo Question) LinuxGeek Linux - Software 4 11-04-2006 03:20 PM
sudo loopoo AIX 7 01-30-2006 10:16 AM
sudo cgammel Linux - Newbie 2 11-30-2003 09:32 AM
need help with sudo mla Linux - Software 4 10-02-2003 11:05 AM
help with sudo raven Linux - General 7 01-27-2002 06:24 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:04 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration