3 ms·
>What is the better alternative? This is a bit complicated to do by hand, but this is probably the best way. I would suggest using existing software to handle
by _-david-_ 8y ago
>What is the better alternative?
This is a bit complicated to do by hand, but this is probably the best way. I would suggest using existing software to handle this though
Create a file that just has "2" with no quotes in it. Create a directory called 1. Create a symlink that points to that directory. Have the webserver use the symlink instead of the actual code directory.
When you want to update code lock the file that has the number in it. Read in the contents of the file. Replace the contents of the file with the next number. Unlock the file. Create a directory with whatever number you read in. Git clone in that new directory. Do whatever else you need to do (compilation or whatever). If all goes well then change a symlink to point to the new directory.
If you need to revert then change the symlink to the old directory. You could also delete old directories as well to save some space.