I'm writing a script that will find every newly updated file in /var/
www/vhosts/cyber.com/httpdocs/
and then cp the the files over to /var/www/vhosts/theroad.com/
httpdocs/
I used to do this by ssh to the server and typing in the copy command
manually. But my client would like to be able to control the timing
of these updates, so I'm trying to make it an easy-to-run script.
Only thing is, when I've done this copy in the past, I've always been
root, as no other user has the permission to copy from the one
directory to the other. So I need the script to run as root. Can I use
exec() to use su to become root? Anyone have a working example of
that?
Comment