elentz Posted July 30, 2018 Share Posted July 30, 2018 I need to use rsync to keep a list of files synced with a server. I will have many "clients". On the clients I want to create a webpage where the user can operate a button and run the rsync command. I have the rsync and ssh setup with passwordless login using a RSA key The rsync command I can run from a command line or using cron. All that I have found to do this in php is this: <?php $copy = 'rsync -chavzP RcyEJtB2@xxx.xxx.yyy.yyy:/home/PhoneFirmware/ /var/www/html/cqfirmware/'; shell_exec ($copy); ?> I am open to any other way of doing this. Thanks for any ideas Quote Link to comment Share on other sites More sharing options...
requinix Posted July 30, 2018 Share Posted July 30, 2018 Is... there a problem with that? Quote Link to comment Share on other sites More sharing options...
gizmola Posted July 31, 2018 Share Posted July 31, 2018 Not sure I understand the design here. Your rsync keeping files up to date on the local machine, correct? Running a "webserver" in order to have a page with a button that says "Sync" would require a whole bunch of software and configuration on each machine. What instructions will be provided to each client instructing them on how to navigate to/find the magical "sync" button page? Obvious alternatives would be a bash script or even an electron app. Quote Link to comment Share on other sites More sharing options...
requinix Posted July 31, 2018 Share Posted July 31, 2018 Yeah, if this was something your client said to do then you should advise them that something automated, like perhaps cron, would be better. Because working for them means more than simply doing what they order - you have knowledge and expertise to offer, not just man-hours. Quote Link to comment Share on other sites More sharing options...
elentz Posted July 31, 2018 Author Share Posted July 31, 2018 Thanks guys for the replies. I have used the rsync command in a cron job ane it works well. This particular instance I am reluctant to run this automatically. It is for updating firmware on IP phones. I am the provider of the system and the phones. I am a firm believer if the firmware is working now for your phone and there are no reasons to update it it makes no sense to update. Conversely I want them to have the option to be able to get the new firmware if necessary. As the php script is now it provides a blank page and the log file shows that it timed out. I could write a bash script to query a db to see if they are allowed to update and run that from a cron job. Quote Link to comment Share on other sites More sharing options...
requinix Posted July 31, 2018 Share Posted July 31, 2018 Well in that case I would agree with you: don't deploy firmware updates automatically. A timeout means the rsync command is taking too long to execute. Is that to be expected? What you could do instead is run the rsync automatically but don't put the files into the live location. Put them in a staging directory, ready to be deployed when someone presses that button. Exactly how you set up staging and deployment could vary greatly - maybe a simple copy (or local rsync), but I think I would go for a symlink. Quote Link to comment Share on other sites More sharing options...
elentz Posted August 1, 2018 Author Share Posted August 1, 2018 requinix That's what I figured was happening, taking to long The whole process could take a few minutes. So that is out. But I like the idea of automatically downloading it with a cron job and using a "staging" directory. Then the rest would be easy or easier. Thanks for the idea!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.