LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   sudo and at commands (https://www.linuxquestions.org/questions/programming-9/sudo-and-at-commands-175868/)

ulto 04-29-2004 05:31 AM

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!

Hko 04-29-2004 10:57 AM

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

ulto 05-01-2004 08:36 AM

but who could i pass the ip address variable to the script!?

I think thats where the main problem lies


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