0

I am very new to this. There is tuptime.db file which has records of uptime in my computer(local server). How can I upload it to web server and show the database content in a website. I want something that database in the web server updates itself from local server and show it to the website.

  • Are you asking how to copy a file to a remote computer or how to write a DB aware web application? – PerlDuck May 01 '18 at 11:21
  • I want to copy files from local server to web server. I have a hosting. I am working on tinkerboard which run Tinker OS based on debian. So I want something that is light. – life tree May 01 '18 at 11:25
  • Moreover its like synchronizing the local DB to Web Server. – life tree May 01 '18 at 11:44
  • Tuptime have a web wrapper "sample-wrapper-tuptime.php" what you can use for this purpose. Get it from the repo and save into the web directory, assure that you have php installed for the web server and all will be ok. – rfmoz Jun 10 '18 at 10:25

2 Answers2

2

From your other question I see that you use tuptime.

To keep the DB synchronized you would need to copy it to your webserver every time it is locally updated. This assumes that your local computer is the only process that updates the DB and no other computer synchronizes with the webserver. You can store the DB under a different name on the webserver for each local computer if you need that.

The DB gets updated during startup and shutdown and regularly by a cronjob or a systemd timer. You need to amend all these jobs so that the file is copied to the webserver after every update.

For the shutdown event this might be a bit tricky because the network might already be down when the tuptime update process is triggered so you cannot copy the file to the server any more.

Once the file is copied to the webserver you can (and need to) write a web application that reads the content of the DB, prefereably with parameters set by the web user, and then display the results in a table or something.

The file can be copied with e.g. scp, i.e.:

scp /var/lib/tuptime/tuptime.db user@webserver:/var/lib/tuptime/tuptime-$HOSTNAME.db

To make this run unattended you need to append your local public ssh key (usually ~/.ssh/id_rsa.pub) to the ~user/.ssh/authorized_keys file on the webserver.

Given the above points you can see that it is not as simple as issuing one single command.

Fabby
  • 34,259
PerlDuck
  • 13,335
1

You should be able to use scp /path/to/local/file user@remoteserver.url:/path/to/destination

More information on the scp command can be found here (https://help.ubuntu.com/community/SSH/TransferFiles)