How to keep your linux box in sync with cloud services
Rclone is an excellent tool for the purpose of keeping your linux box in sync with a cloud. It can work with OneSrive, google, dropbox and many such. Please check out the website to download and install in the linux box.
Installation and usage
After installation (for eg: pacman -S rclone)
- rclone config (* use the default options everywhere, the tool will itself open an authentication site, where you have to enter your keys)
- use rclone copy folder-source folder-destination
- config-name:folder_name should be used for refering to the cloud
- Example: rclone -u -v copy OneDrive:/Technical home~dir/Technical --backup-dir=dir-name --suffix=$dm --suffix-keep-extension
The -u option is used to prevent upgradating in the destination a file with same name and the destination file was last modified.
Rsync
I have found the hard way that the best candidate to talk to One-Drive is the one drive app, which works on Mac. So, I will leave the Mac to update the OneDrive.
I will sync the Mac, Office Desktop and Home office in this way with only rsync
- Mac will sync without file-deletion with Office system and Home computer both ways [one time with mac as source and second time with office/home as source]. This will make all computers to have the latest version of files.
- Mac is the master. I will do file removal and renaming only on Mac and also only when home computer and office are reachable. When ever I do this, I will enforce syncing wth file deletion only one way Mac to Office and Mac to Home.
- Sync website/active to webhome.iitk from Mac only.
This will need some discipline, but will work.
GIT and code backups
In April 2023, I am exploring the idea of creating backup of my custom made scripts. At this time, I have a bunch of scripts, I want to maintain, develop and possibly enhance. So want to maintain a version system as well as a detailed documentation for myself or my students to build on
- to initiate a git go to the directory and type git init .
- Add files with git add *.py to add all python files
- git commit -a -m "some comments for this current commit" # to commit all files
- This creates a local git setup. This will monitor the local directory and files for any changes
- For updating the github (remote repo) with the local, a few more things needs to be setup
- create a project say 'website' by going to the webpage. So, now the location of your project is KrishnaBalasubramanian/website.git (my user name is KrishnaBalasubramanian)
- To put files into the github, the easiest method is to use SSH. For that your need to create a ssh_key. WE have done this for the rsync activity for the NeoLab-servers.
- Do sshkeygen using the email id we set up "ssh-keygen -t ed25519 -C "krisxxxx@gmail.com"
- Now that the public key is generated at id_ed25519.pub, copy this into the github profile. Go to settings in your profile and look for sshkey and copy the information in the key.
- Now link your local directory git with the git hub: git remote add origin git@github.com:KrishnaBalasubramanian/website.git
- Now you can sync with: git push -u origin master
- There is some confusion with master and main. Will resolve it later